From 1a37514a3ebd88638bd989df8634f5a9edf1acca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20=C4=90=E1=BB=A9c=20Long?= Date: Sun, 10 May 2020 16:00:47 +0700 Subject: [PATCH] URP Shadergraph Fog Node should return fog intensity as density --- com.unity.render-pipelines.universal/CHANGELOG.md | 1 + .../ShaderLibrary/ShaderGraphFunctions.hlsl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 35931ced6e1..b25a5d0b555 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - 2D shaders now use half-precision floats whenever precise results are not necessary. - Removed the ETC1_EXTERNAL_ALPHA variant from Shader Graph Sprite shaders. - Eliminated GC allocations caused by the 2D Renderer. +- Made the density output of Fog Node to be more consistent with how URP mix fog color. This output can be used to mix material color with fog color by using a Lerp Node to lerp between material color and fog color. ### Fixed - Fixed a performance problem with ShaderPreprocessor with large amount of active shader variants in the project diff --git a/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl b/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl index f4df7d028b0..5280743339d 100644 --- a/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl +++ b/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl @@ -57,7 +57,7 @@ float3 shadergraph_LWReflectionProbe(float3 viewDir, float3 normalOS, float lod) void shadergraph_LWFog(float3 position, out float4 color, out float density) { color = unity_FogColor; - density = ComputeFogFactor(TransformObjectToHClip(position).z); + density = ComputeFogIntensity(ComputeFogFactor(TransformObjectToHClip(position).z)); } // This function assumes the bitangent flip is encoded in tangentWS.w