From af979a295727ddb4b9b4764655b9b98a60e75be4 Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 10 Jul 2020 11:31:27 +0200 Subject: [PATCH 1/2] Make sure we don't end up with null normals from normal mapping. --- com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl index 5eb72f7f7ad..dcac7653d09 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl @@ -177,7 +177,7 @@ real3 UnpackNormalAG(real4 packedNormal, real scale = 1.0) { real3 normal; normal.xy = packedNormal.ag * 2.0 - 1.0; - normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy))); + normal.z = max(1.0e-16, sqrt(1.0 - saturate(dot(normal.xy, normal.xy)))); // must scale after reconstruction of normal.z which also // mirrors UnpackNormalRGB(). This does imply normal is not returned From 02a455a2d1e5b6eded3ccad892d01546dd4ce4a9 Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 10 Jul 2020 11:43:42 +0200 Subject: [PATCH 2/2] Updated Changelog. --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 3d491d4abcc..7a60602f93b 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -726,6 +726,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed robustness issue with GetOddNegativeScale() in ray tracing, which was impacting normal mapping (1261160). - Fixed regression where moving face of the probe gizmo was not moving its position anymore. - Fixed XR single-pass macros in tessellation shaders. +- Improved robustness of normal mapping when scale is 0, and mapping is extreme (normals in or below the tangent plane). ### Changed - Improve MIP selection for decals on Transparents