diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index a9c6eff5caf..092c9025966 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -166,6 +166,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where TerrainLit was rendering color lighter than Lit [case 1340751] (https://issuetracker.unity3d.com/product/unity/issues/guid/1340751/) - Fixed Camera rendering when capture action and post processing present. [case 1350313] - Fixed artifacts in Speed Tree 8 billboard LODs due to SpeedTree LOD smoothing/crossfading [case 1348407] +- Fix sporadic NaN when using normal maps with XYZ-encoding [case 1351020](https://issuetracker.unity3d.com/issues/android-urp-vulkan-nan-pixels-and-bloom-post-processing-generates-visual-artifacts) - Support undo of URP Global Settings asset assignation (case 1342987). - Removed unsupported fields from Presets of Light and Camera [case 1335979]. - Fixed an issue where Unlit and ParticlesUnlit shaders did not have HDR color selection for albedo [case 1283767](https://issuetracker.unity3d.com/issues/built-in-unlit-particle-shader-has-hdr-color-selection-for-albedo-urp-unlit-particles-do-not) diff --git a/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl b/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl index fd4555b1761..3553dfc327d 100644 --- a/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl +++ b/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl @@ -196,12 +196,21 @@ float3 NormalizeNormalPerVertex(float3 normalWS) half3 NormalizeNormalPerPixel(half3 normalWS) { +// With XYZ normal map encoding we sporadically sample normals with near-zero-length causing Inf/NaN +#if defined(UNITY_NO_DXT5nm) && defined(_NORMALMAP) + return SafeNormalize(normalWS); +#else return normalize(normalWS); +#endif } float3 NormalizeNormalPerPixel(float3 normalWS) { +#if defined(UNITY_NO_DXT5nm) && defined(_NORMALMAP) + return SafeNormalize(normalWS); +#else return normalize(normalWS); +#endif }