From 3fae7bb2cee76430a99cd1077619e73a5209e89d Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Fri, 9 Aug 2024 11:16:33 +0000 Subject: [PATCH] [Port] [2022.3] [Vulkan][URP] Fix linear fog rendering artifacts on Adreno GPUs with Vulkan Jira: https://jira.unity3d.com/browse/UUM-61728 Read the Comments to Reviewers section. --- .../ShaderLibrary/ShaderVariablesFunctions.hlsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl index be0c362ebf3..7bd0c8d9895 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl @@ -393,7 +393,8 @@ half3 MixFogColor(half3 fragColor, half3 fogColor, half fogFactor) { #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) half fogIntensity = ComputeFogIntensity(fogFactor); - fragColor = lerp(fogColor, fragColor, fogIntensity); + // Workaround for UUM-61728: using a manual lerp to avoid rendering artifacts on some GPUs when Vulkan is used + fragColor = fragColor * fogIntensity + fogColor * (half(1.0) - fogIntensity); #endif return fragColor; }