summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-02-24 16:30:35 -0800
committeryum <yum.food.vr@gmail.com>2026-02-24 16:30:35 -0800
commit3e99a65d8ba63265224ea561a45ee4917a490e7a (patch)
tree97d20d0f77f2afa90d684852e804e478f1073aee
parent155a8ceecfe64773eb21ba55a2ac286d52589141 (diff)
Add horizon fading (wired off)
-rwxr-xr-xlighting.cginc14
1 files changed, 14 insertions, 0 deletions
diff --git a/lighting.cginc b/lighting.cginc
index 9a66703..8a60e66 100755
--- a/lighting.cginc
+++ b/lighting.cginc
@@ -243,6 +243,20 @@ void GetLighting(v2f i, Pbr pbr, out LightData data) {
#endif
data.indirect.specular *= spec_ao;
#endif
+
+ // Didn't see a big difference in testbed, so commented out.
+ // Bent normals get us most of what we want.
+#if 0
+ // Horizon fading
+ // https://marmosetco.tumblr.com/post/81245981087
+ // The goal is to attenuate anything which points into the mesh.
+ // TODO expose fade strength as a parameter.
+ float horizon_fade_str = 1.3;
+ float horizon_fade = saturate(1.0f + horizon_fade_str * dot(pbr.normal, -reflect_dir));
+ horizon_fade *= horizon_fade;
+ data.indirect.specular *= horizon_fade;
+#endif
+
#if defined(_CLEARCOAT)
data.indirect.specular_cc = getIndirectSpecular(i, saturate(sqrt(pbr.cc_roughness)), view_dir, dir_cc);
#if defined(_CLEARCOAT_MASK)