summaryrefslogtreecommitdiffstats
path: root/lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-02-23 23:14:14 -0800
committeryum <yum.food.vr@gmail.com>2026-02-23 23:14:14 -0800
commit12da92ff5055748dbcfdb165310a7f83a84c2228 (patch)
tree8214ebe0bb6a8326844ebdc4bcefc01a0e67b815 /lighting.cginc
parentede8bbae3496315e5ef821d4c00cf04022a3d453 (diff)
Adjust how bent normal strength is applied
Diffstat (limited to 'lighting.cginc')
-rwxr-xr-xlighting.cginc11
1 files changed, 8 insertions, 3 deletions
diff --git a/lighting.cginc b/lighting.cginc
index e56bb37..2ae7d0d 100755
--- a/lighting.cginc
+++ b/lighting.cginc
@@ -243,11 +243,16 @@ void GetLighting(v2f i, Pbr pbr, out LightData data) {
ao_vis = pbr.ao;
#endif
#if defined(_BENT_NORMALS)
- float3 spec_ao_bent = pbr.bent_normal;
+ float3 spec_ao_normal = pbr.bent_normal;
#else
- float3 spec_ao_bent = pbr.normal;
+ float3 spec_ao_normal = pbr.normal;
#endif
- data.indirect.specular *= computeSpecularAO(data.common.NoV, ao_vis, pbr.roughness, spec_ao_bent, -data.indirect.dir);
+ //float NoV_geom = saturate(dot(i.normal, data.common.V));
+ float spec_ao = computeSpecularAO(data.common.NoV, ao_vis, pbr.roughness, spec_ao_normal, -data.indirect.dir);
+#if defined(_BENT_NORMALS)
+ spec_ao = saturate(lerp(1.0, spec_ao, _Bent_Normals_Strength));
+#endif
+ data.indirect.specular *= spec_ao;
#endif
#if defined(_CLEARCOAT)
data.indirect.specular_cc = getIndirectSpecular(i, saturate(sqrt(pbr.cc_roughness)), view_dir, dir_cc);