Skip to content

Commit a4cbf7c

Browse files
committed
v4.14.0 (WIP):
HIGHLIGHTS: - REBLUR: improved performance (+6% in non-SH mode, +10% in SH mode) - REBLUR: reduced memory usage (-10% in all modes) - REBLUR: outputs are not used as history buffers anymore! (removed inter-frame dependencies) - REBLUR: improved IQ by regaining more contact shadows - RELAX/REBLUR: more flexible "materialID" support DETAILS: - REBLUR: removed "hitDistance" related antilag settings (AO/SO is not temporally stabilized anymore) - REBLUR: removed history length "smoothing" from HistoryFix pass (not needed anymore) - REBLUR: relaxed disocclusion checks if parallax is very small (~0 motion) - REBLUR: temporal stabilization pass now operates only on luminance - REBLUR: lots of C++ code changes to reflect changes in texture layouts - RELAX/REBLUR: "enableMaterialTestFor..." replaced with "minMaterialFor..." to make "materialID" test more flexible - updated ShaderMake - cleanup
1 parent 3edea46 commit a4cbf7c

File tree

64 files changed

+534
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+534
-986
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ else()
176176
set(NRD_SHADER_BINARIES "--binary")
177177
endif()
178178

179-
message("NRD shaders output path: '${NRD_SHADERS_PATH}'")
179+
message("NRD shaders path: '${NRD_SHADERS_PATH}'")
180180

181181
target_link_libraries(${PROJECT_NAME} PRIVATE MathLib)
182182
target_include_directories(${PROJECT_NAME} PUBLIC "Include")
@@ -223,7 +223,8 @@ if(NOT NRD_DISABLE_SHADER_COMPILATION)
223223
--allResourcesBound
224224
--vulkanVersion 1.2
225225
--sourceDir "Shaders/Source"
226-
-c Shaders.cfg
226+
--ignoreConfigDir
227+
-c "Shaders/Shaders.cfg"
227228
-o "${NRD_SHADERS_PATH}"
228229
-I "${ML_SOURCE_DIR}"
229230
-I "Shaders/Include"

Include/NRD.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
2828
#include <cstddef>
2929

3030
#define NRD_VERSION_MAJOR 4
31-
#define NRD_VERSION_MINOR 13
31+
#define NRD_VERSION_MINOR 14
3232
#define NRD_VERSION_BUILD 0
33-
#define NRD_VERSION_DATE "7 February 2025"
33+
#define NRD_VERSION_DATE "19 February 2025"
3434

3535
#if defined(_WIN32)
3636
#define NRD_CALL __stdcall

Include/NRDDescs.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
1111
#pragma once
1212

1313
#define NRD_DESCS_VERSION_MAJOR 4
14-
#define NRD_DESCS_VERSION_MINOR 13
14+
#define NRD_DESCS_VERSION_MINOR 14
1515

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

@@ -101,10 +101,6 @@ namespace nrd
101101
// Some signal (R8+)
102102
IN_SIGNAL,
103103

104-
// Primary and secondary world-space positions (RGBA16f+)
105-
IN_DELTA_PRIMARY_POS,
106-
IN_DELTA_SECONDARY_POS,
107-
108104
//=============================================================================================================================
109105
// OUTPUTS
110106
//=============================================================================================================================
@@ -114,24 +110,24 @@ namespace nrd
114110
// Radiance and hit distance
115111
// REBLUR: use "REBLUR_BackEnd_UnpackRadianceAndNormHitDist" for decoding (RGBA16f+)
116112
// RELAX: use "RELAX_BackEnd_UnpackRadiance" for decoding (R11G11B10f+)
117-
OUT_DIFF_RADIANCE_HITDIST, // IMPORTANT: used as history if "stabilizationStrength != 0"
118-
OUT_SPEC_RADIANCE_HITDIST, // IMPORTANT: used as history if "stabilizationStrength != 0"
113+
OUT_DIFF_RADIANCE_HITDIST,
114+
OUT_SPEC_RADIANCE_HITDIST,
119115

120116
// SH data
121117
// REBLUR: use "REBLUR_BackEnd_UnpackSh" for decoding (2x RGBA16f+)
122118
// RELAX: use "RELAX_BackEnd_UnpackSh" for decoding (2x RGBA16f+)
123-
OUT_DIFF_SH0, // IMPORTANT: used as history if "stabilizationStrength != 0"
124-
OUT_DIFF_SH1, // IMPORTANT: used as history if "stabilizationStrength != 0"
125-
OUT_SPEC_SH0, // IMPORTANT: used as history if "stabilizationStrength != 0"
126-
OUT_SPEC_SH1, // IMPORTANT: used as history if "stabilizationStrength != 0"
119+
OUT_DIFF_SH0,
120+
OUT_DIFF_SH1,
121+
OUT_SPEC_SH0,
122+
OUT_SPEC_SH1,
127123

128124
// Normalized hit distance (R8+)
129125
OUT_DIFF_HITDIST,
130126
OUT_SPEC_HITDIST,
131127

132128
// Bent normal and normalized hit distance (RGBA8+)
133129
// REBLUR: use "REBLUR_BackEnd_UnpackDirectionalOcclusion" for decoding
134-
OUT_DIFF_DIRECTION_HITDIST, // IMPORTANT: used as history if "stabilizationStrength != 0"
130+
OUT_DIFF_DIRECTION_HITDIST,
135131

136132
// Shadow and optional transcluceny (R8+ or RGBA8+)
137133
// SIGMA: use "SIGMA_BackEnd_UnpackShadow" for decoding

Include/NRDSettings.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
1111
#pragma once
1212

1313
#define NRD_SETTINGS_VERSION_MAJOR 4
14-
#define NRD_SETTINGS_VERSION_MINOR 13
14+
#define NRD_SETTINGS_VERSION_MINOR 14
1515

1616
static_assert(NRD_VERSION_MAJOR == NRD_SETTINGS_VERSION_MAJOR && NRD_VERSION_MINOR == NRD_SETTINGS_VERSION_MINOR, "Please, update all NRD SDK files");
1717

@@ -178,7 +178,7 @@ namespace nrd
178178
AccumulationMode accumulationMode = AccumulationMode::CONTINUE;
179179

180180
// If "true" IN_MV is 3D motion in world-space (0 should be everywhere if the scene is static, camera motion must not be included),
181-
// otherwise it's 2D (+ optional Z delta) screen-space motion (0 should be everywhere if the camera doesn't move) (recommended value = true)
181+
// otherwise it's 2D (+ optional Z delta) screen-space motion (0 should be everywhere if the camera doesn't move)
182182
bool isMotionVectorInWorldSpace = false;
183183

184184
// If "true" IN_DIFF_CONFIDENCE and IN_SPEC_CONFIDENCE are available
@@ -222,11 +222,9 @@ namespace nrd
222222
{
223223
// [1; 5] - delta is reduced by local variance multiplied by this value
224224
float luminanceSigmaScale = 4.0f; // can be 3.0 or even less if signal is good
225-
float hitDistanceSigmaScale = 3.0f;
226225

227226
// [1; 5] - antilag sensitivity (smaller values increase sensitivity)
228227
float luminanceSensitivity = 3.0f; // can be 2.0 or even less if signal is good
229-
float hitDistanceSensitivity = 2.0f;
230228
};
231229

232230
struct ReblurSettings
@@ -300,9 +298,9 @@ namespace nrd
300298
// Boosts performance by sacrificing IQ
301299
bool enablePerformanceMode = false;
302300

303-
// (Optional) material ID comparison: enableMaterialTest ? materialID[x] == materialID[y] : 1 (requires "NormalEncoding::R10_G10_B10_A2_UNORM")
304-
bool enableMaterialTestForDiffuse = false;
305-
bool enableMaterialTestForSpecular = false;
301+
// (Optional) material ID comparison: max(m0, minMaterial) == max(m1, minMaterial) (requires "NormalEncoding::R10_G10_B10_A2_UNORM")
302+
float minMaterialForDiffuse = 4.0f;
303+
float minMaterialForSpecular = 4.0f;
306304

307305
// In rare cases, when bright samples are so sparse that any other bright neighbor can't
308306
// be reached, pre-pass transforms a standalone bright pixel into a standalone bright blob,
@@ -423,9 +421,9 @@ namespace nrd
423421
// Roughness based rejection
424422
bool enableRoughnessEdgeStopping = true;
425423

426-
// (Optional) material ID comparison: enableMaterialTest ? materialID[x] == materialID[y] : 1 (requires "NormalEncoding::R10_G10_B10_A2_UNORM")
427-
bool enableMaterialTestForDiffuse = false;
428-
bool enableMaterialTestForSpecular = false;
424+
// (Optional) material ID comparison: max(m0, minMaterial) == max(m1, minMaterial) (requires "NormalEncoding::R10_G10_B10_A2_UNORM")
425+
float minMaterialForDiffuse = 4.0f;
426+
float minMaterialForSpecular = 4.0f;
429427
};
430428

431429
//====================================================================================================================================================

README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# NVIDIA REAL-TIME DENOISERS v4.13.0 (NRD)
1+
# NVIDIA REAL-TIME DENOISERS v4.14.0 (NRD)
22

33
[![Build NRD SDK](https://github.com/NVIDIA-RTX/NRD/actions/workflows/build.yml/badge.svg)](https://github.com/NVIDIA-RTX/NRD/actions/workflows/build.yml)
44

@@ -16,8 +16,8 @@ For quick starting see *[NRD sample](https://github.com/NVIDIA-RTX/NRD-Sample)*
1616
- *SIGMA* - shadow-only denoiser
1717

1818
Performance on RTX 4080 @ 1440p (native resolution, default denoiser settings, `NormalEncoding::R10_G10_B10_A2_UNORM`):
19-
- `REBLUR_DIFFUSE_SPECULAR` - 2.40 ms (2.15 in performance mode)
20-
- `RELAX_DIFFUSE_SPECULAR` - 2.95 ms
19+
- `REBLUR_DIFFUSE_SPECULAR` - 2.30 ms (2.00 ms in performance mode, 3.15 ms in `SH` mode)
20+
- `RELAX_DIFFUSE_SPECULAR` - 3.00 ms (4.85 ms in `SH` mode)
2121
- `SIGMA_SHADOW` - 0.40 ms
2222
- `SIGMA_SHADOW_TRANSLUCENCY` - 0.50 ms
2323

@@ -207,11 +207,11 @@ See `NRDDescs.h` and `NRD.hlsli` for more details and descriptions of other inpu
207207
# NOISY & NON-NOISY DATA REQUIREMENTS
208208

209209
Noisy inputs:
210-
- garbage values are allowed outside of active viewport, i.e. `>= CommonSettings::rectSize`
211-
- garbage values are allowed outside of denoising range, i.e. `>= CommonSettings::denoisingRange`
210+
- garbage values are allowed outside of active viewport, i.e. `pixelPos >= CommonSettings::rectSize`
211+
- garbage values are allowed outside of denoising range, i.e. `abs( viewZ ) >= CommonSettings::denoisingRange`
212212

213213
Non-noisy inputs (guides):
214-
- must not contain garbage
214+
- must not contain `NAN/INF` values
215215

216216
Where "garbage" is `NAN/INF` or undesired value.
217217

@@ -319,16 +319,16 @@ The *Persistent* column (matches *NRD Permanent pool*) indicates how much of the
319319

320320
| Resolution | Denoiser | Working set (Mb) | Persistent (Mb) | Aliasable (Mb) |
321321
|------------|--------------------------------------|------------------|------------------|------------------|
322-
| 1080p | REBLUR_DIFFUSE | 84.56 | 42.25 | 42.31 |
323-
| | REBLUR_DIFFUSE_OCCLUSION | 40.31 | 25.38 | 14.94 |
324-
| | REBLUR_DIFFUSE_SH | 135.19 | 59.12 | 76.06 |
325-
| | REBLUR_SPECULAR | 103.62 | 50.75 | 52.88 |
326-
| | REBLUR_SPECULAR_OCCLUSION | 48.81 | 33.88 | 14.94 |
327-
| | REBLUR_SPECULAR_SH | 154.25 | 67.62 | 86.62 |
328-
| | REBLUR_DIFFUSE_SPECULAR | 164.88 | 71.88 | 93.00 |
329-
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 67.94 | 38.12 | 29.81 |
330-
| | REBLUR_DIFFUSE_SPECULAR_SH | 266.12 | 105.62 | 160.50 |
331-
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 84.56 | 42.25 | 42.31 |
322+
| 1080p | REBLUR_DIFFUSE | 76.19 | 50.75 | 25.44 |
323+
| | REBLUR_DIFFUSE_OCCLUSION | 36.06 | 25.38 | 10.69 |
324+
| | REBLUR_DIFFUSE_SH | 109.94 | 67.62 | 42.31 |
325+
| | REBLUR_SPECULAR | 95.25 | 59.25 | 36.00 |
326+
| | REBLUR_SPECULAR_OCCLUSION | 44.56 | 33.88 | 10.69 |
327+
| | REBLUR_SPECULAR_SH | 129.00 | 76.12 | 52.88 |
328+
| | REBLUR_DIFFUSE_SPECULAR | 148.12 | 88.88 | 59.25 |
329+
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 59.44 | 38.12 | 21.31 |
330+
| | REBLUR_DIFFUSE_SPECULAR_SH | 232.50 | 122.62 | 109.88 |
331+
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 76.19 | 50.75 | 25.44 |
332332
| | RELAX_DIFFUSE | 90.81 | 54.88 | 35.94 |
333333
| | RELAX_DIFFUSE_SH | 158.31 | 88.62 | 69.69 |
334334
| | RELAX_SPECULAR | 101.44 | 63.38 | 38.06 |
@@ -339,16 +339,16 @@ The *Persistent* column (matches *NRD Permanent pool*) indicates how much of the
339339
| | SIGMA_SHADOW_TRANSLUCENCY | 50.81 | 8.44 | 42.38 |
340340
| | REFERENCE | 33.75 | 33.75 | 0.00 |
341341
| | | | | |
342-
| 1440p | REBLUR_DIFFUSE | 150.06 | 75.00 | 75.06 |
343-
| | REBLUR_DIFFUSE_OCCLUSION | 71.31 | 45.00 | 26.31 |
344-
| | REBLUR_DIFFUSE_SH | 240.06 | 105.00 | 135.06 |
345-
| | REBLUR_SPECULAR | 183.81 | 90.00 | 93.81 |
346-
| | REBLUR_SPECULAR_OCCLUSION | 86.31 | 60.00 | 26.31 |
347-
| | REBLUR_SPECULAR_SH | 273.81 | 120.00 | 153.81 |
348-
| | REBLUR_DIFFUSE_SPECULAR | 292.56 | 127.50 | 165.06 |
349-
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 120.06 | 67.50 | 52.56 |
350-
| | REBLUR_DIFFUSE_SPECULAR_SH | 472.56 | 187.50 | 285.06 |
351-
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 150.06 | 75.00 | 75.06 |
342+
| 1440p | REBLUR_DIFFUSE | 135.06 | 90.00 | 45.06 |
343+
| | REBLUR_DIFFUSE_OCCLUSION | 63.81 | 45.00 | 18.81 |
344+
| | REBLUR_DIFFUSE_SH | 195.06 | 120.00 | 75.06 |
345+
| | REBLUR_SPECULAR | 168.81 | 105.00 | 63.81 |
346+
| | REBLUR_SPECULAR_OCCLUSION | 78.81 | 60.00 | 18.81 |
347+
| | REBLUR_SPECULAR_SH | 228.81 | 135.00 | 93.81 |
348+
| | REBLUR_DIFFUSE_SPECULAR | 262.56 | 157.50 | 105.06 |
349+
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 105.06 | 67.50 | 37.56 |
350+
| | REBLUR_DIFFUSE_SPECULAR_SH | 412.56 | 217.50 | 195.06 |
351+
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 135.06 | 90.00 | 45.06 |
352352
| | RELAX_DIFFUSE | 161.31 | 97.50 | 63.81 |
353353
| | RELAX_DIFFUSE_SH | 281.31 | 157.50 | 123.81 |
354354
| | RELAX_SPECULAR | 180.06 | 112.50 | 67.56 |
@@ -359,16 +359,16 @@ The *Persistent* column (matches *NRD Permanent pool*) indicates how much of the
359359
| | SIGMA_SHADOW_TRANSLUCENCY | 90.12 | 15.00 | 75.12 |
360360
| | REFERENCE | 60.00 | 60.00 | 0.00 |
361361
| | | | | |
362-
| 2160p | REBLUR_DIFFUSE | 318.88 | 159.38 | 159.50 |
363-
| | REBLUR_DIFFUSE_OCCLUSION | 151.50 | 95.62 | 55.88 |
364-
| | REBLUR_DIFFUSE_SH | 510.12 | 223.12 | 287.00 |
365-
| | REBLUR_SPECULAR | 390.56 | 191.25 | 199.31 |
366-
| | REBLUR_SPECULAR_OCCLUSION | 183.38 | 127.50 | 55.88 |
367-
| | REBLUR_SPECULAR_SH | 581.81 | 255.00 | 326.81 |
368-
| | REBLUR_DIFFUSE_SPECULAR | 621.62 | 270.94 | 350.69 |
369-
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 255.06 | 143.44 | 111.62 |
370-
| | REBLUR_DIFFUSE_SPECULAR_SH | 1004.12 | 398.44 | 605.69 |
371-
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 318.88 | 159.38 | 159.50 |
362+
| 2160p | REBLUR_DIFFUSE | 287.00 | 191.25 | 95.75 |
363+
| | REBLUR_DIFFUSE_OCCLUSION | 135.56 | 95.62 | 39.94 |
364+
| | REBLUR_DIFFUSE_SH | 414.50 | 255.00 | 159.50 |
365+
| | REBLUR_SPECULAR | 358.69 | 223.12 | 135.56 |
366+
| | REBLUR_SPECULAR_OCCLUSION | 167.44 | 127.50 | 39.94 |
367+
| | REBLUR_SPECULAR_SH | 486.19 | 286.88 | 199.31 |
368+
| | REBLUR_DIFFUSE_SPECULAR | 557.88 | 334.69 | 223.19 |
369+
| | REBLUR_DIFFUSE_SPECULAR_OCCLUSION | 223.19 | 143.44 | 79.75 |
370+
| | REBLUR_DIFFUSE_SPECULAR_SH | 876.62 | 462.19 | 414.44 |
371+
| | REBLUR_DIFFUSE_DIRECTIONAL_OCCLUSION | 287.00 | 191.25 | 95.75 |
372372
| | RELAX_DIFFUSE | 342.81 | 207.25 | 135.56 |
373373
| | RELAX_DIFFUSE_SH | 597.81 | 334.75 | 263.06 |
374374
| | RELAX_SPECULAR | 382.69 | 239.12 | 143.56 |

Resources/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Versioning rules:
2222
*/
2323

2424
#define VERSION_MAJOR 4
25-
#define VERSION_MINOR 13
25+
#define VERSION_MINOR 14
2626
#define VERSION_BUILD 0
2727

2828
#define VERSION_STRING STR(VERSION_MAJOR.VERSION_MINOR.VERSION_BUILD encoding=NRD_NORMAL_ENCODING.NRD_ROUGHNESS_ENCODING)

Shaders/Include/Common.hlsli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
3232

3333
// FP16
3434

35-
#ifdef NRD_COMPILER_DXC
35+
#ifdef __hlsl_dx_compiler
3636
#define half_float float16_t
3737
#define half_float2 float16_t2
3838
#define half_float3 float16_t3
@@ -226,9 +226,9 @@ static const float3 g_Special8[ 8 ] =
226226
#define GetStdDev( m1, m2 ) sqrt( abs( ( m2 ) - ( m1 ) * ( m1 ) ) ) // sqrt( max( m2 - m1 * m1, 0.0 ) )
227227

228228
#if( NRD_NORMAL_ENCODING == NRD_NORMAL_ENCODING_R10G10B10A2_UNORM )
229-
#define CompareMaterials( m0, m, mask ) ( ( mask ) == 0 ? 1.0 : ( ( m0 ) == ( m ) ) )
229+
#define CompareMaterials( m0, m, minm ) ( max( m0, minm ) == max( m, minm ) )
230230
#else
231-
#define CompareMaterials( m0, m, mask ) 1.0
231+
#define CompareMaterials( m0, m, minm ) true
232232
#endif
233233

234234
#define UnpackViewZ( z ) abs( z * gViewZScale )

Shaders/Include/NRD.hlsli

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ distribution of this software and related documentation without an express
88
license agreement from NVIDIA CORPORATION is strictly prohibited.
99
*/
1010

11-
// NRD v4.13
11+
// NRD v4.14
1212

1313
// IMPORTANT: DO NOT MODIFY THIS FILE WITHOUT FULL RECOMPILATION OF NRD LIBRARY!
1414

@@ -134,6 +134,10 @@ NOISY INPUTS:
134134

135135
#define NRD_EXPORT
136136

137+
#ifndef NRD_COMPILER_DXC
138+
#define NRD_COMPILER_DXC
139+
#endif
140+
137141
// PlayStation // TODO: register spaces?
138142
#elif( defined( NRD_COMPILER_PSSLC ) || defined( __PSSL__ ) )
139143

@@ -187,6 +191,10 @@ NOISY INPUTS:
187191
#define NRD_EXPORT
188192
#endif
189193

194+
#ifndef NRD_COMPILER_PSSLC
195+
#define NRD_COMPILER_PSSLC
196+
#endif
197+
190198
// Unreal Engine
191199
#elif( defined( NRD_COMPILER_UNREAL_ENGINE ) ) // TODO: is there a predefined macro in UE?
192200

Shaders/Include/REBLUR_Blur.hlsli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ NRD_EXPORT void NRD_CS_MAIN( NRD_CS_MAIN_ARGS )
1414
NRD_CTA_ORDER_DEFAULT;
1515

1616
// Tile-based early out
17-
float isSky = gIn_Tiles[ pixelPos >> 4 ];
17+
float isSky = gIn_Tiles[ pixelPos >> 4 ].x;
1818
if( isSky != 0.0 || any( pixelPos > gRectSizeMinusOne ) )
1919
return;
2020

0 commit comments

Comments
 (0)