From 921859b0f2e82e10db30bf916f2bd15f0dee895b Mon Sep 17 00:00:00 2001 From: Jonas Sideravicius Date: Mon, 15 Nov 2021 15:39:02 +0200 Subject: [PATCH 1/3] making some halfs to floats to avoid light banding on TBDRs --- com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl | 2 +- .../Shaders/LitForwardPass.hlsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl index 7c0c747371e..4bd4ac34eb7 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl @@ -1324,7 +1324,7 @@ bool HasFlag(uint bitfield, uint flag) // Normalize that account for vectors with zero length real3 SafeNormalize(float3 inVec) { - real dp3 = max(REAL_MIN, dot(inVec, inVec)); + float dp3 = max(REAL_MIN, dot(inVec, inVec)); return inVec * rsqrt(dp3); } diff --git a/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl b/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl index b018d7a0a4c..64925a535cf 100644 --- a/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl +++ b/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl @@ -33,7 +33,7 @@ struct Varyings float3 positionWS : TEXCOORD1; #endif - half3 normalWS : TEXCOORD2; + float3 normalWS : TEXCOORD2; #if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR) half4 tangentWS : TEXCOORD3; // xyz: tangent, w: sign #endif From 96cc328c1c8b2a517cf09115efa2370bed9b4b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sideravi=C4=8Dius?= Date: Tue, 30 Nov 2021 18:12:38 +0200 Subject: [PATCH 2/3] Update com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl Co-authored-by: Felipe Lira --- com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl index 4bd4ac34eb7..3c911280c76 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl @@ -1324,7 +1324,7 @@ bool HasFlag(uint bitfield, uint flag) // Normalize that account for vectors with zero length real3 SafeNormalize(float3 inVec) { - float dp3 = max(REAL_MIN, dot(inVec, inVec)); + float dp3 = max(FLT_MIN, dot(inVec, inVec)); return inVec * rsqrt(dp3); } From 8f2af879ae93dfeacded5a372f130009db0f4297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sideravi=C4=8Dius?= Date: Tue, 30 Nov 2021 18:17:16 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- com.unity.render-pipelines.universal/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index d988de57180..4ba76cc92c2 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed disabled debug lighting modes on Vulkan and OpenGL following a shader compiler fix. [case 1334240] - Fixed an issue in where the Convert Renderering Settings would cause a freeze. [case 1353885](https://issuetracker.unity3d.com/issues/urp-builtin-to-urp-render-pipeline-converter-freezes-the-editor-when-converting-rendering-settings) - Fixed incorrect behavior of Reflections with Smoothness lighting debug mode. [case 1374181] +- Fixed light banding artifacts on some mobile platforms. [case 1375791](https://issuetracker.unity3d.com/issues/mobile-urp-banding-like-artifacts-are-visible-when-smooth-material-is-lit-by-light) ## [13.1.0] - 2021-09-24 ### Added