summaryrefslogtreecommitdiffstats
path: root/pbr.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-11-04 16:28:58 -0800
committeryum <yum.food.vr@gmail.com>2024-11-04 16:32:29 -0800
commit88e674850f6eae56ea8cac2d735efad4518f0a14 (patch)
tree20d20a0455b02088d7add36b90500c909fc64f70 /pbr.cginc
parent12e8a5cbd170ddf35c189dea193b2e9ca9245c81 (diff)
Add fog normals
Uses iquilez's directional derivative model and a simplified lighting model. Lighting is evaluated at each sample.
Diffstat (limited to 'pbr.cginc')
-rw-r--r--pbr.cginc12
1 files changed, 12 insertions, 0 deletions
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)