浏览代码

Fix NaNs arising from division by 0

/main
Evgenii Golubev 7 年前
当前提交
df21d121
共有 1 个文件被更改,包括 12 次插入8 次删除
  1. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/Resources/VolumetricLighting.compute

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/Resources/VolumetricLighting.compute


#else
);
#endif
#if (SUPPORT_ASYMMETRY == 0)
lighting.radianceComplete = lighting.radianceNoPhase;
#endif
#if ENABLE_REPROJECTION
// Reproject the history at 'centerWS'.
float2 reprojPosNDC = ComputeNormalizedDeviceCoordinates(centerWS, _PrevViewProjMatrix);

// to prevent ghosting.
_VBufferLightingFeedback[uint3(posInput.positionSS, slice)] = float4(blendedRadiance, dt);
#if SUPPORT_ASYMMETRY
// TODO: how to ensure we do not divide by 0?
float3 phaseCurrFrame = lighting.radianceComplete / lighting.radianceNoPhase;
// Use max() to prevent division by 0.
float3 phaseCurrFrame = lighting.radianceComplete * rcp(max(lighting.radianceNoPhase, FLT_MIN));
#else
#endif // SUPPORT_ASYMMETRY
#else // ENABLE_REPROJECTION
#if SUPPORT_ASYMMETRY
#else // SUPPORT_ASYMMETRY
float3 blendedRadiance = lighting.radianceNoPhase;
#endif // SUPPORT_ASYMMETRY
#endif // ENABLE_REPROJECTION
// Compute the transmittance from the camera to 't0'.

正在加载...
取消
保存