diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index b807e81c3aa..d29b7633109 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -166,6 +166,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issue with RAS build fail when LOD was missing a renderer - Fixed an issue where sometime a docked lookdev could be rendered at zero size and break. - Fixed an issue where runtime debug window UI would leak game objects. +- Fixed NaNs when denoising pixels where the dot product between normal and view direction is near zero (case 1329624). ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DenoisingUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DenoisingUtils.hlsl index f9acfbac2b9..14fac1340f9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DenoisingUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/DenoisingUtils.hlsl @@ -1,12 +1,13 @@ #define MAX_REPROJECTION_DISTANCE 0.1 #define MAX_PIXEL_TOLERANCE 4 +#define PROJECTION_EPSILON 0.000001 float ComputeMaxReprojectionWorldRadius(float3 positionWS, float3 normalWS, float pixelSpreadAngleTangent, float maxDistance, float pixelTolerance) { const float3 viewWS = GetWorldSpaceNormalizeViewDir(positionWS); float parallelPixelFootPrint = pixelSpreadAngleTangent * length(positionWS); - float realPixelFootPrint = parallelPixelFootPrint / abs(dot(normalWS, viewWS)); + float realPixelFootPrint = parallelPixelFootPrint / max(abs(dot(normalWS, viewWS)), PROJECTION_EPSILON); return max(maxDistance, realPixelFootPrint * pixelTolerance); }