From 88e674850f6eae56ea8cac2d735efad4518f0a14 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 4 Nov 2024 16:28:58 -0800 Subject: Add fog normals Uses iquilez's directional derivative model and a simplified lighting model. Lighting is evaluated at each sample. --- pbr.cginc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pbr.cginc') diff --git a/pbr.cginc b/pbr.cginc index 68e26e9..770db07 100644 --- a/pbr.cginc +++ b/pbr.cginc @@ -105,6 +105,18 @@ float3 BoxProjection ( return direction; } +float4 getIndirectDiffuse(v2f i, float4 vertexLightColor) { + float4 diffuse = vertexLightColor; +#if defined(FORWARD_BASE_PASS) +#if defined(LIGHTMAP_ON) + diffuse.xyz = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv2)); +#else + diffuse.xyz += max(0, BetterSH9(float4(0, 0, 0, 1))); +#endif +#endif + return diffuse; +} + float4 getIndirectDiffuse(v2f i, float4 vertexLightColor, float3 normal) { float4 diffuse = vertexLightColor; #if defined(FORWARD_BASE_PASS) -- cgit v1.2.3