Skip to content

Commit 80a2a3e

Browse files
Antoine Lelievresebastienlagarde
authored andcommitted
Fix volumetric fog nan #2174
1 parent aa1d4ac commit 80a2a3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3030
- VFX : Debug material view were rendering pink for albedo. (case 1290752)
3131
- Fixed NaNs happening when upscaling ray tracing reflections in performance mode (case 1294076).
3232
- Fixed LayeredLit shader compilation issue with metal shader and raytracing
33+
- Fixed nan in reflection probe when volumetric fog filtering is enabled, causing the whole probe to be invalid.
3334

3435
### Changed
3536
- Removed XRSystemTests. The GC verification is now done during playmode tests (case 1285012).

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.compute

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,15 @@ void FilterVolumetricLighting(uint3 dispatchThreadId : SV_DispatchThreadID,
783783

784784
// If this is outside of the image, force the weight to 0
785785
#ifdef VERTICAL_PASS
786-
if (tapCoord.y < 0.0 || tapCoord.y >= _VBufferViewportSize.y) weight = 0;
786+
if (tapCoord.y < 0.0 || tapCoord.y >= _VBufferViewportSize.y)
787787
#else
788-
if (tapCoord.x < 0.0|| tapCoord.x >= _VBufferViewportSize.x) weight = 0;
788+
if (tapCoord.x < 0.0 || tapCoord.x >= _VBufferViewportSize.x)
789789
#endif
790+
{
791+
// To avoid NaNs, we have to override this value
792+
currentValue = 0.0f;
793+
weight = 0.0f;
794+
}
790795

791796
// Accumulate the value and weight
792797
value += currentValue * weight;

0 commit comments

Comments
 (0)