diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index dad4210a8a2..ed81781bab2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -39,6 +39,7 @@ The version number for this package has increased due to a version update of a r - Fixed the stripping not working the terrain alphatest feature required for terrain holes (case 1205902). - Fixing exceptions in the console when putting the SSGI in low quality mode (render graph). - Fixed NullRef Exception when decals are in the scene, no asset is set and HDRP wizard is run. +- Fixed nan when a decal affects normals. ### Changed - Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl index 2ec0165034d..af6e087cf2a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl @@ -8,7 +8,7 @@ void ApplyDecalToSurfaceData(DecalSurfaceData decalSurfaceData, float3 vtxNormal // Always test the normal as we can have decompression artifact if (decalSurfaceData.normalWS.w < 1.0) { - surfaceData.normalWS.xyz = normalize(surfaceData.normalWS.xyz * decalSurfaceData.normalWS.w + decalSurfaceData.normalWS.xyz); + surfaceData.normalWS.xyz = SafeNormalize(surfaceData.normalWS.xyz * decalSurfaceData.normalWS.w + decalSurfaceData.normalWS.xyz); } #ifdef DECALS_4RT // only smoothness in 3RT mode