From 1e2b08f3e35a60160bed592c545d113a17bd1e79 Mon Sep 17 00:00:00 2001 From: Yaobin Ouyang Date: Wed, 17 Jul 2024 20:43:34 -0700 Subject: [PATCH] [REMIX-3331] Fix NaN in ReSTIR GI Pass See merge request lightspeedrtx/dxvk-remix-nv!902 --- src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang b/src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang index b0a73ff3..81526baa 100644 --- a/src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang +++ b/src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang @@ -185,7 +185,9 @@ void main(uint2 threadIndex : SV_DispatchThreadID, uint2 LocalIndex : SV_GroupTh neeSample.setPortalID(RESTIR_GI_INVALID_INDIRECT_LIGHT_PORTAL_ID); neeSample.position = lightSample.position; neeSample.normal = lightSample.normal; - neeSample.radiance = lightSample.radiance / lightSample.solidAnglePdf; + // TODO: The radiance value is stored in 16bit floats and clamping is needed to avoid NaN issue. + // Need to move clamping to the ReSTIRGI_Reservoir::pack() function. + neeSample.radiance = min(lightSample.radiance / lightSample.solidAnglePdf, float16Max); neeSample.setVirtualFraction(0.0); float wi = RAB_GetGITargetPdfForSurface(neeSample.radiance, neeSample.position, surface);