Skip to content

Commit

Permalink
NRD v3.2.3:
Browse files Browse the repository at this point in the history
HIGHLIGHTS:

 - RELAX / REBLUR: added probabilistic sampling support
 - RELAX / REBLUR: improved performance by ~13% (REBLUR) and ~17% (RELAX)
 - RELAX / REBLUR: specular tracking improvements
 - RELAX / REBLUR: better ortho projection support
 - RELAX / REBLUR: less blurry & leaky pre-pass
 - NRD: exposed optional "prev world" to "world" matrix to simplify use of "virtual space" normals
 - NRD: LibraryDesc exposes supported material bits and normal encoding
 - NRD: exposed "convenient" function to convert "ResourceType" to string
 - NRD: improved compatibility with POSIX-compliant systems

 DETAILS:

 - NRD: default disocclusion threshold reduced to 0.5%
 - NRD: maximized code reuse
 - NRD: optimized matrix usage
 - NRD: clarified "denoising range" limits
 - NRD: exposed optional world-prev to world transform for normals
 - NRD: fixed script for NRD SDK generation
 - NRD: improved compatibility with POSIX-compliant systems
 - NRD: fixed and improved curvature calculations
 - NRD: fixed and improved parallax calculations
 - NRD: fixed bug in SMEM preloader not affecting current use cases
 - NRD: added API function to convert "ResourceType" to string
 - NRD: LibraryDesc exposes supported material bits and normal encoding
 - NRD: GitHub automation support
 - NRD: updated MathLib
 - NRD: updated and improved docs
 - RELAX: added hit distance reconstruction pass
 - RELAX: more stability and less biasing in specular, especially on surfaces with low roughness
 - RELAX: better specular reprojection for low-mid roughness
 - RELAX: decreased surface motion based reprojection weight for specular for ortho case
 - RELAX: minHitT3x3 and minHitT5x5 calculation bug fix
 - RELAX: set specular variance boost to 0 by default
 - RELAX: improved per-pass in case of contact reflections
 - RELAX: clamping of specular based on virtual motion doe not depend on surface roughness anymore
 - RELAX: clamping strength significantly decreased
 - RELAX: reflection HitT check now affects fast history length
 - RELAX: switched to single channel history length for all denoisers
 - RELAX: removed diffuseHistoryRejectionNormalThreshold
 - RELAX: moved to BicubicFilterNoCornersWithFallbackToBilinearFilterWithCustomWeights in temporal accumulation shader
 - RELAX: bicubic is used everywhere
 - RELAX: memory usage optimization
 - RELAX: decreased influence of back-back normal weight in reprojection
 - RELAX: improved curvature handling in specular
 - RELAX: added separate diffuse and specular minLuminanceWeight
 - RELAX: tiny bugfix in Atrous
 - RELAX: various performance optimizations
 - RELAX: max history length increased to 255
 - RELAX: refactoring, bug fixes & code cleanup
 - REBLUR: added hit distance reconstruction pass
 - REBLUR: better code unification between "common" and "occlusion-only" denoisers
 - REBLUR: better ortho projection support
 - REBLUR: disocclusion threshold doesn't depend on NoV (led to rare problems on edges)
 - REBLUR: removed internal sanitization (was OFF all the time)
 - REBLUR: improved per-pass in case of contact reflections
 - REBLUR: refactored CatRom functions
 - REBLUR: improved advanced pre-pass
 - REBLUR: virtual hitT accumulated similarly to radiance
 - REBLUR: increased blur radius in HistoryFix pass
 - REBLUR: 4x4 disocclusion test simplified to 12 taps
 - REBLUR: improved disocclusion check (now works better in ortho mode)
 - REBLUR: footprint quality affects history based on accumulated frames
 - REBLUR: hit distance based specular confidence uses not accelerated hitT
 - REBLUR: temporal stabilization improvements
 - REBLUR: footprint stretching test now works in ortho mode
 - REBLUR: removed error recalculation in spatial passes
 - REBLUR: improved surface based disocclusion test for virtual motion
 - REBLUR: tuned radius boost
 - REBLUR: less aggressive TS after disocclusion
 - REBLUR: simplified backface-normal test
 - REBLUR: better "no spatial" support
 - REBLUR: exposed diff / spec pre-pass blur radius
 - REBLUR: more stable specular reprojection
 - REBLUR: fixed insane pre-pass blur radius
 - REBLUR: improved specular reprojection on high FPS
 - REBLUR: improved hit distance based specular confidence calculations
 - REBLUR: fixed "miscommunication" between some parameters
 - REBLUR: simplified fade calculations for anisotropic kernel
 - REBLUR: reworked HistoryFix - now uses 1 mip instead of 4
 - REBLUR: getting rid of Nflat (almost)
 - REBLUR: made anti-firefly roughness-independent
 - REBLUR: tuned default hit distance antilag settings
 - REBLUR: tuned interpolation of accumulation speeds
 - REBLUR: auto disocclusion threshold correction
 - REBLUR: tweaked virtual history amount in temporal stabilization
 - REBLUR: fixed re-packing issue when input normals are more precise than internal ones
 - REBLUR: removed clamping for virtual history
 - REBLUR: removed color compression (real exposure is needed)
 - REBLUR: polished debug visualization
 - REBLUR: various performance optimizations
 - REBLUR: refactoring, bug fixes & code cleanup
 - CMAKE: fixed shader compilation if WinSDK is older than 22000
 - CMAKE: exposed NRD_STATIC_CPP_RUNTIME for Linux
  • Loading branch information
dzhdanNV committed May 27, 2022
1 parent ea7ddea commit 4cdbf36
Show file tree
Hide file tree
Showing 142 changed files with 4,181 additions and 4,424 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build NRD SDK
on:
push:
branches:
- master
jobs:
Build-Windows:
runs-on: windows-latest
steps:
-
name : Checkout
uses: actions/checkout@v3
with:
submodules: true
-
name: Install dependencies
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install windows-sdk-10.0 cmake -y
-
name: Install Vulkan
run: |
$ver = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest.json" | ConvertFrom-Json).windows
echo Vulkan SDK version $ver
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/$ver/windows/VulkanSDK-$ver-Installer.exe" -OutFile VulkanSDK.exe
echo Downloaded
.\VulkanSDK.exe --root C:\VulkanSDK --accept-licenses --default-answer --confirm-command install
-
name: Deploy NRD SDK
run: |
$Env:VULKAN_SDK = "C:/VulkanSDK/"
$Env:Path += ";C:/VulkanSDK/Bin"
.\1-Deploy.bat --no-pause
-
name: Build NRD SDK
run: |
$Env:VULKAN_SDK = "C:/VulkanSDK/"
$Env:Path += ";C:/VulkanSDK/Bin"
.\2-Build.bat --no-pause --debug-build
-
name: Prepare NRD SDK
run: |
&'.\3-Prepare NRD SDK.bat' --no-pause --copy-shaders
-
name: Upload NRD SDK as artefact
uses: actions/upload-artifact@v3
with:
name: NRD SDK
path: _NRD_SDK
25 changes: 24 additions & 1 deletion 1-Deploy.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
@echo off

set "use_pause=y"

:PARSE
if "%~1"=="" goto :MAIN

if /i "%~1"=="-h" goto :HELP
if /i "%~1"=="--help" goto :HELP

if /i "%~1"=="--no-pause" set "use_pause="

shift
goto :PARSE

:MAIN

git submodule update --init --recursive
if %errorlevel% neq 0 exit /b %errorlevel%

mkdir "_Compiler"

cd "_Compiler"
cmake .. -A x64
if %errorlevel% neq 0 exit /b %errorlevel%
cd ..

pause
if defined use_pause pause
exit

:HELP
echo. -h, --help show help message
echo. --no-pause skip pause in the end of script
exit
37 changes: 35 additions & 2 deletions 2-Build.bat
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
@echo off

set "use_pause=y"
set "debug_build="
set "no_debug_build="

:PARSE
if "%~1"=="" goto :MAIN

if /i "%~1"=="-h" goto :HELP
if /i "%~1"=="--help" goto :HELP

if /i "%~1"=="--no-pause" set "use_pause="

if /i "%~1"=="--debug-build" set "debug_build=y"
if /i "%~1"=="--no-debug-build" set "no_debug_build=y"

shift
goto :PARSE

:MAIN
mkdir "_Compiler"

cd "_Compiler"
del CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=Release .. -A x64
if %errorlevel% neq 0 goto :END
cmake --build . --config Release
if %errorlevel% neq 0 goto :END
cd ..

echo.
if defined debug_build goto :BUILD_DEBUG
if defined no_debug_build goto :END
set /P M=Do you want to build DEBUG configuration? [y/n]
if /I "%M%" neq "y" goto END
if /I "%M%" neq "y" goto :END

:BUILD_DEBUG

cd "_Compiler"
del CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=Debug .. -A x64
if %errorlevel% neq 0 goto :END
cmake --build . --config Debug
if %errorlevel% neq 0 goto :END
cd ..

:END
pause
if defined use_pause pause
exit /b %errorlevel%

:HELP
echo. -h, --help show help message
echo. --no-pause skip pause in the end of script
echo. --debug-build build NRD SDK in Debug configuration
echo. --no-debug-build don't build NRD SDK in Debug configuration
exit
31 changes: 31 additions & 0 deletions 3-Prepare NRD SDK.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
@echo off

set NRD_DIR=.
set "use_pause=y"
set "copy_shaders="
set "no_copy_shaders="

:PARSE
if "%~1"=="" goto :MAIN

if /i "%~1"=="-h" goto :HELP
if /i "%~1"=="--help" goto :HELP

if /i "%~1"=="--no-pause" set "use_pause="

if /i "%~1"=="--copy-shaders" set "copy_shaders=y"
if /i "%~1"=="--no-copy-shaders" set "no_copy_shaders=y"

shift
goto :PARSE

:MAIN

rd /q /s "_NRD_SDK"

Expand All @@ -22,9 +41,12 @@ copy "..\%NRD_DIR%\LICENSE.txt" "."
copy "..\%NRD_DIR%\README.md" "."

echo.
if defined copy_shaders goto :SHADERS
if defined no_copy_shaders goto :END
set /P M=Do you need the shader source code for a white-box integration? [y/n]
if /I "%M%" neq "y" goto END

:SHADERS
mkdir "Shaders"

xcopy "..\%NRD_DIR%\Shaders\" "Shaders" /s
Expand All @@ -33,3 +55,12 @@ copy "..\%NRD_DIR%\External\MathLib\*.hlsli" "Shaders\Source"
:END

cd ..
if defined use_pause pause
exit

:HELP
echo. -h, --help show help message
echo. --no-pause skip pause in the end of script
echo. --copy-shaders copy shadres for a white-box integration
echo. --no-copy-shaders don't copy shadres for a white-box integration
exit
6 changes: 3 additions & 3 deletions 4-Clean.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off

rd /q /s "_Build"
rd /q /s "_Compiler"
rd /q /s "_NRD_SDK"
if exist "_Build" rd /q /s "_Build"
if exist "_Compiler" rd /q /s "_Compiler"
if exist "_NRD_SDK" rd /q /s "_NRD_SDK"
25 changes: 15 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ cmake_minimum_required(VERSION 3.15)

message("Processing 'NRD'...")

set(NRD_DXC_CUSTOM_PATH "custom/path/to/dxc" CACHE STRING "This DXC will be used if Vulkan SDK is not installed")
set(NRD_DXC_CUSTOM_PATH "custom/path/to/dxc" CACHE STRING "Custom DXC to use if Vulkan SDK is not installed")
set(NRD_SHADER_OUTPUT_PATH "" CACHE STRING "Shader output path override")
set(NRD_USE_OCT_NORMAL_ENCODING "0" CACHE STRING "NRD_USE_OCT_NORMAL_ENCODING")
set(NRD_USE_MATERIAL_ID "0" CACHE STRING "NRD_USE_MATERIAL_ID")

# Settings
option(NRD_DISABLE_INTERPROCEDURAL_OPTIMIZATION "Disable interprocedural optimization" OFF)
option(NRD_DISABLE_SHADER_COMPILATION "Disable compilation of shaders" OFF)
option(NRD_USE_PRECOMPILED_SHADERS "Use precompiled shaders" ON)
option(NRD_STATIC_LIBRARY "Build static lib" OFF)
option(NRD_DISABLE_SHADER_COMPILATION "Disable shader compilation" OFF)
option(NRD_USE_PRECOMPILED_SHADERS "Use precompiled (embedded) shaders" ON)
option(NRD_STATIC_LIBRARY "Build static library" OFF)
option(NRD_STATIC_CPP_RUNTIME "Link static C++ runtime (Linux only), on Windows use CMAKE_MSVC_RUNTIME_LIBRARY" OFF)
option(NRD_CROSSCOMPILE_AARCH64 "Cross compilation for aarch64" OFF)
option(NRD_CROSSCOMPILE_X86_64 "Cross compilation for x86_64" OFF)
option(NRD_INTERPROCEDURAL_OPTIMIZATION "Interprocedural optimization" OFF)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/Include/NRD.h" ver_h)
string(REGEX MATCH "NRD_VERSION_MAJOR ([0-9]*)" _ ${ver_h})
Expand Down Expand Up @@ -43,11 +44,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_POSITION_INDEPENDENT_BINARIES ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)


if (NRD_DISABLE_INTERPROCEDURAL_OPTIMIZATION)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION NRD_INTERPROCEDURAL_OPTIMIZATION)

if ("${NRD_SHADER_OUTPUT_PATH}" STREQUAL "")
set(NRD_SHADER_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Shaders")
Expand Down Expand Up @@ -114,9 +111,17 @@ if (NRD_USE_PRECOMPILED_SHADERS)
target_include_directories(${PROJECT_NAME} PRIVATE "${NRD_SHADER_OUTPUT_PATH}")
endif()

if (NRD_USE_OCT_NORMAL_ENCODING)
target_compile_definitions(${PROJECT_NAME} PRIVATE NRD_USE_OCT_NORMAL_ENCODING)
endif()

if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX _CRT_SECURE_NO_WARNINGS _UNICODE UNICODE)
else()
if (NRD_STATIC_CPP_RUNTIME)
target_link_options(${PROJECT_NAME} PRIVATE -static-libstdc++)
endif()

# on non-Windows, FXC is not available and VulkanSDK DXC does not produce signed DXIL
target_compile_definitions(${PROJECT_NAME} PRIVATE NRD_ONLY_SPIRV_SHADERS_AVAILABLE=1)
endif()
Expand Down
2 changes: 1 addition & 1 deletion External/MathLib
Submodule MathLib updated 5 files
+1 −1 External/sse2neon
+2 −2 MathLib.h
+16 −10 MathLib_d.h
+17 −13 MathLib_f.h
+20 −3 STL.hlsli
7 changes: 4 additions & 3 deletions Include/NRD.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#include <cstddef>

#define NRD_VERSION_MAJOR 3
#define NRD_VERSION_MINOR 1
#define NRD_VERSION_BUILD 0
#define NRD_VERSION_DATE "25 March 2022"
#define NRD_VERSION_MINOR 2
#define NRD_VERSION_BUILD 3
#define NRD_VERSION_DATE "25 May 2022"

#if defined(_MSC_VER)
#define NRD_CALL __fastcall
Expand Down Expand Up @@ -62,4 +62,5 @@ namespace nrd
NRD_API Result NRD_CALL SetMethodSettings(Denoiser& denoiser, Method method, const void* methodSettings);
NRD_API Result NRD_CALL GetComputeDispatches(Denoiser& denoiser, const CommonSettings& commonSettings, const DispatchDesc*& dispatchDescs, uint32_t& dispatchDescNum);
NRD_API void NRD_CALL DestroyDenoiser(Denoiser& denoiser);
NRD_API const char* GetResourceTypeString(ResourceType resourceType);
}
6 changes: 4 additions & 2 deletions Include/NRDDescs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#pragma once

#define NRD_DESCS_VERSION_MAJOR 3
#define NRD_DESCS_VERSION_MINOR 1
#define NRD_DESCS_VERSION_MINOR 2

static_assert (NRD_VERSION_MAJOR == NRD_DESCS_VERSION_MAJOR && NRD_VERSION_MINOR == NRD_DESCS_VERSION_MINOR, "Please, update all NRD SDK files");

Expand Down Expand Up @@ -326,6 +326,8 @@ namespace nrd
uint8_t versionMajor;
uint8_t versionMinor;
uint8_t versionBuild;
uint8_t maxSupportedMaterialBitNum;
bool isCompiledWithOctPackNormalEncoding : 1;
};

struct MethodDesc
Expand Down Expand Up @@ -400,7 +402,7 @@ namespace nrd

// if "true" all constant buffers share same "ConstantBufferDesc" description
// if "false" this pipeline doesn't have a constant buffer
bool hasConstantData;
bool hasConstantData : 1;
};

struct DescriptorSetDesc
Expand Down
Loading

0 comments on commit 4cdbf36

Please sign in to comment.