Skip to content

Commit fd3e454

Browse files
alelievrEvergreen
authored andcommitted
Try to blind fix the NaN issue in fog
Fix NaN issue in volumetric fog reprojection
1 parent 36123c3 commit fd3e454

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ void FillVolumetricLightingBuffer(LightLoopContext context, uint featureFlags,
700700
// TODO: dynamic lights (which update their position, rotation, cookie or shadow at runtime)
701701
// do not support reprojection and should neither read nor write to the history buffer.
702702
// This will cause them to alias, but it is the only way to prevent ghosting.
703-
_VBufferFeedback[voxelCoord] = normalizedBlendValue * float4(GetCurrentExposureMultiplier().xxx, 1);
703+
_VBufferFeedback[voxelCoord] = clamp(normalizedBlendValue * float4(GetCurrentExposureMultiplier().xxx, 1), 0, HALF_MAX);
704704

705705
float4 linearizedBlendValue = normalizedBlendValue * dt;
706706
float4 blendValue = DelinearizeRGBD(linearizedBlendValue);
@@ -759,7 +759,7 @@ void FillVolumetricLightingBuffer(LightLoopContext context, uint featureFlags,
759759
// This means storing the tone mapped radiance and transmittance instead of optical depth.
760760
// See "A Fresh Look at Generalized Sampling", p. 51.
761761
// TODO: re-enable tone mapping after implementing pre-exposure.
762-
_VBufferLighting[voxelCoord] = LinearizeRGBD(float4(/*FastTonemap*/(totalRadiance), opticalDepth)) * float4(GetCurrentExposureMultiplier().xxx, 1);
762+
_VBufferLighting[voxelCoord] = max(0, LinearizeRGBD(float4(/*FastTonemap*/(totalRadiance), opticalDepth)) * float4(GetCurrentExposureMultiplier().xxx, 1));
763763

764764
// Compute the optical depth up to the end of the interval.
765765
opticalDepth += 0.5 * blendValue.a;

0 commit comments

Comments
 (0)