Skip to content

Commit

Permalink
v4.8.1:
Browse files Browse the repository at this point in the history
HIGHLIGHTS:
- bug fixes and improvements

DETAILS:
- REBLUR_SH: fixed mis-normalized weighted sum for "diffSh" and "specSh" in "HistoryFix" pass (the regression appeared after finding a better initial weight for the center pixel)
- REBLUR_SH: minor performance optimization in "Temporal Stabilization" pass
- REBLUR_SH: fixed "touching" of "specSh.w" in "HistoryFix" pass, which is "modified roughness" and must not be processed in any way
  • Loading branch information
dzhdanNV committed May 16, 2024
1 parent 8d3c245 commit 4398316
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Include/NRD.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.
/*
CREDITS:
Developed by:
Dmitry Zhdan (dzhdan@nvidia.com)
Dmitrii Zhdan (dzhdan@nvidia.com)
Tim Cheblokov (ttcheblokov@nvidia.com)
Special thanks:
Expand All @@ -29,8 +29,8 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.

#define NRD_VERSION_MAJOR 4
#define NRD_VERSION_MINOR 8
#define NRD_VERSION_BUILD 0
#define NRD_VERSION_DATE "9 May 2024"
#define NRD_VERSION_BUILD 1
#define NRD_VERSION_DATE "16 May 2024"

#if defined(_MSC_VER)
#define NRD_CALL __fastcall
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NVIDIA REAL-TIME DENOISERS v4.8.0 (NRD)
# NVIDIA REAL-TIME DENOISERS v4.8.1 (NRD)

[![Build NRD SDK](https://github.com/NVIDIAGameWorks/RayTracingDenoiser/actions/workflows/build.yml/badge.svg)](https://github.com/NVIDIAGameWorks/RayTracingDenoiser/actions/workflows/build.yml)

Expand Down
2 changes: 1 addition & 1 deletion Resources/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Versioning rules:

#define VERSION_MAJOR 4
#define VERSION_MINOR 8
#define VERSION_BUILD 0
#define VERSION_BUILD 1

#define VERSION_STRING STR(VERSION_MAJOR.VERSION_MINOR.VERSION_BUILD encoding=NRD_NORMAL_ENCODING.NRD_ROUGHNESS_ENCODING)
2 changes: 1 addition & 1 deletion Shaders/Include/REBLUR_Common_SpecularSpatialFilter.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#ifdef REBLUR_SH
float4 sh = gIn_SpecSh.SampleLevel( gNearestClamp, checkerboardUvScaled, 0 );
sh = Denanify( w, sh );
specSh.xyz += sh.xyz * w; // see TA
specSh.xyz += sh.xyz * w;
#endif
}

Expand Down
12 changes: 10 additions & 2 deletions Shaders/Include/REBLUR_HistoryFix.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
#ifdef REBLUR_PERFORMANCE_MODE
sumd = 1.0 + 1.0 / ( 1.0 + gMaxAccumulatedFrameNum ) - diffNonLinearAccumSpeed;
#endif

diff *= sumd;
#ifdef REBLUR_SH
diffSh *= sumd;
#endif

[unroll]
for( j = -2; j <= 2; j++ )
Expand Down Expand Up @@ -314,7 +318,11 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
#ifdef REBLUR_PERFORMANCE_MODE
sums = 1.0 + 1.0 / ( 1.0 + gMaxAccumulatedFrameNum ) - specNonLinearAccumSpeed;
#endif

spec *= sums;
#ifdef REBLUR_SH
specSh.xyz *= sums;
#endif

[unroll]
for( j = -2; j <= 2; j++ )
Expand Down Expand Up @@ -372,15 +380,15 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
#ifdef REBLUR_SH
float4 sh = gIn_SpecSh[ pos ];
sh = Denanify( w, sh );
specSh.xyz += sh.xyz * w; // see TA
specSh.xyz += sh.xyz * w;
#endif
}
}

sums = STL::Math::PositiveRcp( sums );
spec *= sums;
#ifdef REBLUR_SH
specSh *= sums;
specSh.xyz *= sums;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion Shaders/Include/REBLUR_TemporalAccumulation.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
float4 specShResult = lerp( smbShSpec, vmbShSpec, virtualHistoryAmount );

// ( Optional ) Output modified roughness to assist AA during SG resolve
specShResult.w = roughnessModified; // IMPORTANT: should not be blurred
specShResult.w = roughnessModified; // IMPORTANT: must not be blurred! this is why "specSh.xyz" is used ~everywhere
#endif

float specAccumSpeed = lerp( smbSpecAccumSpeed, vmbSpecAccumSpeed, virtualHistoryAmount );
Expand Down
10 changes: 5 additions & 5 deletions Shaders/Include/REBLUR_TemporalStabilization.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :

#ifdef REBLUR_SH
float4 specSh = s_SpecSh[ smemPos.y ][ smemPos.x ];
float4 specShM1 = specSh;
float4 specShM2 = specSh * specSh;
float3 specShM1 = specSh.xyz;
float3 specShM2 = specSh.xyz * specSh.xyz;
#endif

float2 specMin = NRD_INF;
Expand Down Expand Up @@ -133,7 +133,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
specM2 += s * s;

#ifdef REBLUR_SH
float4 sh = s_SpecSh[ pos.y ][ pos.x ];
float3 sh = s_SpecSh[ pos.y ][ pos.x ].xyz;
specShM1 += sh;
specShM2 += sh * sh;
#endif
Expand Down Expand Up @@ -181,7 +181,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
#ifdef REBLUR_SH
specShM1 *= invSum;
specShM2 *= invSum;
float4 specShSigma = GetStdDev( specShM1, specShM2 );
float3 specShSigma = GetStdDev( specShM1, specShM2 );
#endif

// RCRS
Expand Down Expand Up @@ -407,7 +407,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
specHistory = STL::Color::Clamp( specM1, specSigma * specTemporalAccumulationParams.y, specHistory );
float4 specResult = lerp( spec, specHistory, specHistoryWeight );
#ifdef REBLUR_SH
specShHistory = STL::Color::Clamp( specShM1, specShSigma * specTemporalAccumulationParams.y, specShHistory );
specShHistory.xyz = STL::Color::Clamp( specShM1, specShSigma * specTemporalAccumulationParams.y, specShHistory.xyz );
float4 specShResult = lerp( specSh, specShHistory, specHistoryWeight );

// ( Optional ) Output modified roughness to assist AA during SG resolve
Expand Down

0 comments on commit 4398316

Please sign in to comment.