From 3e99a65d8ba63265224ea561a45ee4917a490e7a Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 24 Feb 2026 16:30:35 -0800 Subject: Add horizon fading (wired off) --- lighting.cginc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lighting.cginc') 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) -- cgit v1.2.3