Skip to content

Commit

Permalink
v4.6.0
Browse files Browse the repository at this point in the history
HIGHLIGHTS:

- REBLUR: exposed previously hard-coded parameter "minBlurRadius"
- NRD: no algorithmic changes

DETAILS:

- REBLUR: exposed "minBlurRadius", which is used in the converged state
- REBLUR: "blurRadius" renamed to "maxBlurRadius"
- REBLUR: code cleanup
- SIGMA: code cleanup
- NRD INTEGRATION: updated to the latest NRI
- slightly updated docs
- updated deps
  • Loading branch information
dzhdanNV committed Mar 20, 2024
1 parent 670d13b commit dae3b33
Show file tree
Hide file tree
Showing 23 changed files with 74 additions and 71 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ set (NRD_NORMAL_ENCODING "2" CACHE STRING "Normal encoding variant (0-4, matches
set (NRD_ROUGHNESS_ENCODING "1" CACHE STRING "Roughness encoding variant (0-2, matches nrd::RoughnessEncoding)")

# Generate PDB for Release builds
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
if (MSVC)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
endif ()

# Create project
file (READ "Include/NRD.h" ver_h)
Expand Down
2 changes: 1 addition & 1 deletion External/MathLib
2 changes: 1 addition & 1 deletion External/ShaderMake
4 changes: 2 additions & 2 deletions Include/NRD.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#include <cstddef>

#define NRD_VERSION_MAJOR 4
#define NRD_VERSION_MINOR 5
#define NRD_VERSION_MINOR 6
#define NRD_VERSION_BUILD 0
#define NRD_VERSION_DATE "20 February 2024"
#define NRD_VERSION_DATE "19 March 2024"

#if defined(_MSC_VER)
#define NRD_CALL __fastcall
Expand Down
4 changes: 3 additions & 1 deletion 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 4
#define NRD_DESCS_VERSION_MINOR 5
#define NRD_DESCS_VERSION_MINOR 6

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 @@ -168,6 +168,8 @@ namespace nrd
/*
IMPORTANT: IN_MV, IN_NORMAL_ROUGHNESS, IN_VIEWZ are used by any denoiser
These denoisers DON'T use:
SIGMA_SHADOW - IN_VIEWZ
SIGMA_SHADOW_TRANSLUCENCY - IN_VIEWZ
REFERENCE - IN_MV, IN_NORMAL_ROUGHNESS, IN_VIEWZ
SPECULAR_DELTA_MV - IN_NORMAL_ROUGHNESS, IN_VIEWZ
*/
Expand Down
15 changes: 9 additions & 6 deletions Include/NRDSettings.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_SETTINGS_VERSION_MAJOR 4
#define NRD_SETTINGS_VERSION_MINOR 5
#define NRD_SETTINGS_VERSION_MINOR 6

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

Expand Down Expand Up @@ -203,15 +203,18 @@ namespace nrd
// [0; 3] - number of reconstructed frames after history reset (less than "maxFastAccumulatedFrameNum")
uint32_t historyFixFrameNum = 3;

// (pixels) - pre-accumulation spatial reuse pass blur radius (0 = disabled, recommended in case of probabilistic sampling)
// (pixels) - pre-accumulation spatial reuse pass blur radius (0 = disabled, must be used in case of badly defined signals and probabilistic sampling)
float diffusePrepassBlurRadius = 30.0f;
float specularPrepassBlurRadius = 50.0f;

// (pixels) - base denoising radius (30 is a baseline for 1440p)
float blurRadius = 15.0f;
// (pixels) - min denoising radius (for converged state)
float minBlurRadius = 1.0f;

// (pixels) - max denoising radius (gets reduced over time, 30 is a baseline for 1440p)
float maxBlurRadius = 15.0f;

// (normalized %) - base fraction of diffuse or specular lobe angle used to drive normal based rejection
float lobeAngleFraction = 0.15f;
float lobeAngleFraction = 0.2f;

// (normalized %) - base fraction of center roughness used to drive roughness based rejection
float roughnessFraction = 0.15f;
Expand Down Expand Up @@ -249,7 +252,7 @@ namespace nrd
// worsening the situation. Despite that it's a problem of sampling, the denoiser needs to
// handle it somehow on its side too. Diffuse pre-pass can be just disabled, but for specular
// it's still needed to find optimal hit distance for tracking. This boolean allow to use
// specular pre-pass for tracking purposes only
// specular pre-pass for tracking purposes only (use with care)
bool usePrepassOnlyForSpecularMotionEstimation = false;
};

Expand Down
4 changes: 2 additions & 2 deletions Integration/NRDIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#include <map>

#define NRD_INTEGRATION_MAJOR 1
#define NRD_INTEGRATION_MINOR 10
#define NRD_INTEGRATION_DATE "26 December 2023"
#define NRD_INTEGRATION_MINOR 11
#define NRD_INTEGRATION_DATE "19 March 2024"
#define NRD_INTEGRATION 1

#define NRD_INTEGRATION_DEBUG_LOGGING 0
Expand Down
20 changes: 10 additions & 10 deletions Integration/NRDIntegration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.

#include "NRDIntegration.h"

static_assert(NRD_VERSION_MAJOR >= 4 && NRD_VERSION_MINOR >= 4, "Unsupported NRD version!");
static_assert(NRI_VERSION_MAJOR >= 1 && NRI_VERSION_MINOR >= 118, "Unsupported NRI version!");
static_assert(NRD_VERSION_MAJOR >= 4 && NRD_VERSION_MINOR >= 5, "Unsupported NRD version!");
static_assert(NRI_VERSION_MAJOR >= 1 && NRI_VERSION_MINOR >= 125, "Unsupported NRI version!");

#ifdef _WIN32
#define alloca _alloca
Expand Down Expand Up @@ -520,7 +520,7 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor
if (isStateChanged || isStorageBarrier)
transitions[transitionBarriers.textureNum++] = nri::TextureBarrierFromState(*nrdTexture->state, {nextAccess, nextLayout}, 0, 1);

uint64_t resource = m_NRI->GetTextureNativeObject(*nrdTexture->state->texture, 0);
uint64_t resource = m_NRI->GetTextureNativeObject(*nrdTexture->state->texture);
uint64_t key = NRD_CreateDescriptorKey(resource, isStorage);
const auto& entry = m_CachedDescriptors.find(key);

Expand Down Expand Up @@ -551,7 +551,7 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor
for (uint32_t i = 0; i < descriptorSetNum; i++)
{
if (!samplersAreInSeparateSet || i != descriptorSetSamplersIndex)
NRD_INTEGRATION_ABORT_ON_FAILURE(m_NRI->AllocateDescriptorSets(descriptorPool, *pipelineLayout, i, &descriptorSets[i], 1, nri::ALL_NODES, 0));
NRD_INTEGRATION_ABORT_ON_FAILURE(m_NRI->AllocateDescriptorSets(descriptorPool, *pipelineLayout, i, &descriptorSets[i], 1, 0));
}

// Updating constants
Expand All @@ -569,7 +569,7 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor
m_NRI->UnmapBuffer(*m_ConstantBuffer);
}

m_NRI->UpdateDynamicConstantBuffers(*descriptorSets[0], nri::ALL_NODES, 0, 1, &m_ConstantBufferView);
m_NRI->UpdateDynamicConstantBuffers(*descriptorSets[0], 0, 1, &m_ConstantBufferView);

dynamicConstantBufferOffset = m_ConstantBufferOffset;
m_ConstantBufferOffset += m_ConstantBufferViewSize;
Expand All @@ -582,17 +582,17 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor
nri::DescriptorSet*& descriptorSetSamplers = m_DescriptorSetSamplers[m_DescriptorPoolIndex];
if (!descriptorSetSamplers)
{
NRD_INTEGRATION_ABORT_ON_FAILURE(m_NRI->AllocateDescriptorSets(descriptorPool, *pipelineLayout, descriptorSetSamplersIndex, &descriptorSetSamplers, 1, nri::ALL_NODES, 0));
m_NRI->UpdateDescriptorRanges(*descriptorSetSamplers, nri::ALL_NODES, 0, 1, &samplersDescriptorRange);
NRD_INTEGRATION_ABORT_ON_FAILURE(m_NRI->AllocateDescriptorSets(descriptorPool, *pipelineLayout, descriptorSetSamplersIndex, &descriptorSetSamplers, 1, 0));
m_NRI->UpdateDescriptorRanges(*descriptorSetSamplers, 0, 1, &samplersDescriptorRange);
}

descriptorSets[descriptorSetSamplersIndex] = descriptorSetSamplers;
}
else
m_NRI->UpdateDescriptorRanges(*descriptorSets[descriptorSetSamplersIndex], nri::ALL_NODES, 0, 1, &samplersDescriptorRange);
m_NRI->UpdateDescriptorRanges(*descriptorSets[descriptorSetSamplersIndex], 0, 1, &samplersDescriptorRange);

// Updating resources
m_NRI->UpdateDescriptorRanges(*descriptorSets[descriptorSetResourcesIndex], nri::ALL_NODES, instanceDesc.samplersSpaceIndex == instanceDesc.resourcesSpaceIndex ? 1 : 0, pipelineDesc.resourceRangesNum, resourceRanges);
m_NRI->UpdateDescriptorRanges(*descriptorSets[descriptorSetResourcesIndex], instanceDesc.samplersSpaceIndex == instanceDesc.resourcesSpaceIndex ? 1 : 0, pipelineDesc.resourceRangesNum, resourceRanges);

// Rendering
m_NRI->CmdBarrier(commandBuffer, transitionBarriers);
Expand All @@ -604,7 +604,7 @@ void NrdIntegration::Dispatch(nri::CommandBuffer& commandBuffer, nri::Descriptor
for (uint32_t i = 0; i < descriptorSetNum; i++)
m_NRI->CmdSetDescriptorSet(commandBuffer, i, *descriptorSets[i], i == 0 ? &dynamicConstantBufferOffset : nullptr);

m_NRI->CmdDispatch(commandBuffer, dispatchDesc.gridWidth, dispatchDesc.gridHeight, 1);
m_NRI->CmdDispatch(commandBuffer, {dispatchDesc.gridWidth, dispatchDesc.gridHeight, 1});

// Debug logging
#if( NRD_INTEGRATION_DEBUG_LOGGING == 1 )
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NVIDIA REAL-TIME DENOISERS v4.5.0 (NRD)
# NVIDIA REAL-TIME DENOISERS v4.6.0 (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 Expand Up @@ -190,6 +190,7 @@ NRD sample is a good start to familiarize yourself with input requirements and b
- `hitDistanceReconstructionMode` must be set to something other than `OFF`, but bear in mind that the search area is limited to 3x3 or 5x5. In other words, it's the application's responsibility to guarantee a valid sample in this area. It can be achieved by clamping probabilities and using Bayer-like dithering (see the sample for more details)
- Pre-pass must be enabled (i.e. `diffusePrepassBlurRadius` and `specularPrepassBlurRadius` must be set to 20-70 pixels) to compensate entropy increase, since radiance in valid samples is divided by probability to compensate 0 values in some neighbors
- Probabilistic sampling for 2nd+ bounces is absolutely acceptable
- in case of many paths per pixel `hitT` for specular must be "averaged" by `NRD_FrontEnd_SpecHitDistAveraging_*` functions from `NRD.hlsli`

See `NRDDescs.h` for more details and descriptions of other inputs and outputs.

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

#define VERSION_MAJOR 4
#define VERSION_MINOR 5
#define VERSION_MINOR 6
#define VERSION_BUILD 0

#define VERSION_STRING STR(VERSION_MAJOR.VERSION_MINOR.VERSION_BUILD encoding=NRD_NORMAL_ENCODING.NRD_ROUGHNESS_ENCODING)
4 changes: 2 additions & 2 deletions Shaders/Include/Common.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
//==================================================================================================================

// Switches ( default 1 )
#define NRD_USE_TILE_CHECK 1
#define NRD_USE_TILE_CHECK 1 // significantly improves performance by skipping computations in "empty" regions
#define NRD_USE_HIGH_PARALLAX_CURVATURE 1
#define NRD_USE_DENANIFICATION 1 // needed only if inputs have NAN / INF outside of viewport or denoising range range
#define NRD_USE_DENANIFICATION 1 // needed only if inputs have NAN / INF outside of viewport or denoising range

// Switches ( default 0 )
#define NRD_USE_QUADRATIC_DISTRIBUTION 0
Expand Down
3 changes: 2 additions & 1 deletion Shaders/Include/NRD.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.
*/

// NRD v4.4
// NRD v4.6

//=================================================================================================================================
// INPUT PARAMETERS
Expand Down Expand Up @@ -618,6 +618,7 @@ float NRD_FrontEnd_SpecHitDistAveraging_Begin( )

void NRD_FrontEnd_SpecHitDistAveraging_Add( inout float accumulatedSpecHitDist, float hitDist )
{
// TODO: for high roughness it can be blended to average
accumulatedSpecHitDist = min( accumulatedSpecHitDist, hitDist == 0.0 ? NRD_INF : hitDist );
}

Expand Down
5 changes: 2 additions & 3 deletions Shaders/Include/REBLUR_Common_DiffuseSpatialFilter.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
float diffNonLinearAccumSpeed = 1.0 / ( 1.0 + REBLUR_SAMPLES_PER_FRAME * ( 1.0 - boost ) * data1.x );

// Blur radius - main
float blurRadius = gBlurRadius * ( 1.0 + 2.0 * boost ) / 3.0;
float blurRadius = gMaxBlurRadius * ( 1.0 + 2.0 * boost ) / 3.0;
blurRadius *= hitDistFactor;

// Blur radius - addition to avoid underblurring
blurRadius += 1.0;
blurRadius += gMinBlurRadius;

// Blur radius - scaling
blurRadius *= radiusScale;
blurRadius *= float( gBlurRadius != 0 );
#endif

// Weights
Expand Down
12 changes: 2 additions & 10 deletions Shaders/Include/REBLUR_Common_SpecularSpatialFilter.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
float hitDistFactorAdditionallyRelaxedByRoughness = lerp( 1.0, hitDistFactorRelaxedByError, roughness );

// Blur radius - main
float blurRadius = smc * gBlurRadius * ( 1.0 + 2.0 * boost ) / 3.0;
float blurRadius = smc * gMaxBlurRadius * ( 1.0 + 2.0 * boost ) / 3.0;
blurRadius *= lerp( hitDistFactorRelaxedByError, hitDistFactorAdditionallyRelaxedByRoughness, specNonLinearAccumSpeed );
blurRadius = min( blurRadius, minBlurRadius );

// Blur radius - addition to avoid underblurring
blurRadius += smc; // TODO: a source of contact detail loss
blurRadius += gMinBlurRadius * smc; // TODO: a source of contact detail loss

// Blur radius - scaling
blurRadius *= radiusScale;
blurRadius *= float( gBlurRadius != 0 );
#endif

// Weights
Expand Down Expand Up @@ -187,13 +186,6 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
// Decrease weight for samples that most likely are very close to reflection contact which should not be blurred
float t = hs / ( d + hitDist );
w *= lerp( saturate( t ), 1.0, STL::Math::LinearStep( 0.5, 1.0, roughness ) );

// Adjust blur radius "on the fly" if taps have short hit distances
#if( REBLUR_USE_ADJUSTED_ON_THE_FLY_BLUR_RADIUS_IN_PRE_BLUR == 1 )
float hitDistFactorAtSample = GetHitDistFactor( hs * NoD, frustumSize );
float blurRadiusScale = lerp( hitDistFactorAtSample, 1.0, NoD );
blurRadius *= lerp( 1.0, blurRadiusScale, n / ( 1.0 + n ) );
#endif
#endif
w *= lerp( minHitDistWeight, 1.0, ComputeExponentialWeight( ExtractHitDist( s ), hitDistanceWeightParams.x, hitDistanceWeightParams.y ) );
w *= GetGaussianWeight( offset.z );
Expand Down
9 changes: 4 additions & 5 deletions Shaders/Include/REBLUR_Config.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#define REBLUR_USE_SCREEN_SPACE_SAMPLING 0
#define REBLUR_USE_ANTILAG_NOT_INVOKING_HISTORY_FIX 0
#define REBLUR_USE_DECOMPRESSED_HIT_DIST_IN_RECONSTRUCTION 0 // compression helps to preserve "lobe important" values
#define REBLUR_USE_ADJUSTED_ON_THE_FLY_BLUR_RADIUS_IN_PRE_BLUR 0 // TODO: verify that not needed and delete...

#ifdef REBLUR_OCCLUSION
#undef REBLUR_USE_ANTIFIREFLY
Expand Down Expand Up @@ -70,7 +69,6 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.

#define REBLUR_VIRTUAL_MOTION_PREV_PREV_WEIGHT_ITERATION_NUM 2
#define REBLUR_COLOR_CLAMPING_SIGMA_SCALE 2.0 // using smaller values leads to bias if camera rotates slowly due to reprojection instabilities
#define REBLUR_HISTORY_FIX_BUMPED_ROUGHNESS 0.08
#define REBLUR_FIREFLY_SUPPRESSOR_MAX_RELATIVE_INTENSITY float2( 10.0, 1.1 )
#define REBLUR_FIREFLY_SUPPRESSOR_RADIUS_SCALE 0.1
#define REBLUR_ANTI_FIREFLY_FILTER_RADIUS 4 // pixels
Expand Down Expand Up @@ -125,15 +123,16 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
NRD_CONSTANT( float, gDenoisingRange ) \
NRD_CONSTANT( float, gPlaneDistSensitivity ) \
NRD_CONSTANT( float, gFramerateScale ) \
NRD_CONSTANT( float, gBlurRadius ) \
NRD_CONSTANT( float, gMinBlurRadius ) \
NRD_CONSTANT( float, gMaxBlurRadius ) \
NRD_CONSTANT( float, gDiffPrepassBlurRadius ) \
NRD_CONSTANT( float, gSpecPrepassBlurRadius ) \
NRD_CONSTANT( float, gMaxAccumulatedFrameNum ) \
NRD_CONSTANT( float, gMaxFastAccumulatedFrameNum ) \
NRD_CONSTANT( float, gAntiFirefly ) \
NRD_CONSTANT( float, gLobeAngleFraction ) \
NRD_CONSTANT( float, gRoughnessFraction ) \
NRD_CONSTANT( float, gResponsiveAccumulationRoughnessThreshold ) \
NRD_CONSTANT( float, gDiffPrepassBlurRadius ) \
NRD_CONSTANT( float, gSpecPrepassBlurRadius ) \
NRD_CONSTANT( float, gHistoryFixFrameNum ) \
NRD_CONSTANT( float, gMinRectDimMulUnproject ) \
NRD_CONSTANT( float, gUsePrepassNotOnlyForSpecularMotionEstimation ) \
Expand Down
3 changes: 0 additions & 3 deletions Shaders/Include/REBLUR_HistoryFix.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,6 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
w *= 1.0 + UnpackData1( gIn_Data1[ pos ] ).z;
#endif

// TODO: ideally "diffuseness at hit" needed...
// TODO: for roughness closer to REBLUR_HISTORY_FIX_BUMPED_ROUGHNESS "saturate( hitDistNormAtCenter - ExtractHitDist( s ) )" could be used.
// It allows bleeding of background to foreground, but not vice versa ( doesn't suit for 0 roughness )
REBLUR_TYPE s = gIn_Spec[ pos ];
s = Denanify( w, s );

Expand Down
4 changes: 2 additions & 2 deletions 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 :
REBLUR_TYPE specHistory = lerp( smbSpecHistory, vmbSpecHistory, virtualHistoryAmount );

// Anti-firefly suppressor
float specAntifireflyFactor = specAccumSpeed * gBlurRadius * REBLUR_FIREFLY_SUPPRESSOR_RADIUS_SCALE * smc;
float specAntifireflyFactor = specAccumSpeed * ( gMinBlurRadius + gMaxBlurRadius ) * REBLUR_FIREFLY_SUPPRESSOR_RADIUS_SCALE * smc;
specAntifireflyFactor /= 1.0 + specAntifireflyFactor;

float specHitDistResult = ExtractHitDist( specResult );
Expand Down Expand Up @@ -806,7 +806,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
#endif

// Anti-firefly suppressor
float diffAntifireflyFactor = diffAccumSpeed * gBlurRadius * REBLUR_FIREFLY_SUPPRESSOR_RADIUS_SCALE;
float diffAntifireflyFactor = diffAccumSpeed * ( gMinBlurRadius + gMaxBlurRadius ) * REBLUR_FIREFLY_SUPPRESSOR_RADIUS_SCALE;
diffAntifireflyFactor /= 1.0 + diffAntifireflyFactor;

float diffHitDistResult = ExtractHitDist( diffResult );
Expand Down
4 changes: 2 additions & 2 deletions Shaders/Include/REBLUR_TemporalStabilization.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
float diffLumaClamped = clamp( diffLuma, diffMin.x, diffMax.x );

[flatten]
if( gBlurRadius != 0 )
if( gMaxBlurRadius != 0 )
{
diff = ChangeLuma( diff, diffLumaClamped );
diff.w = clamp( diff.w, diffMin.y, diffMax.y );
Expand All @@ -189,7 +189,7 @@ NRD_EXPORT void NRD_CS_MAIN( int2 threadPos : SV_GroupThreadId, int2 pixelPos :
float specLumaClamped = clamp( specLuma, specMin.x, specMax.x );

[flatten]
if( gBlurRadius != 0 )
if( gMaxBlurRadius != 0 )
{
spec = ChangeLuma( spec, specLumaClamped );
spec.w = clamp( spec.w, specMin.y, specMax.y );
Expand Down
Loading

0 comments on commit dae3b33

Please sign in to comment.