From 12da92ff5055748dbcfdb165310a7f83a84c2228 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 23 Feb 2026 23:14:14 -0800 Subject: Adjust how bent normal strength is applied --- filamented.cginc | 0 lighting.cginc | 11 ++++++++--- pbr.cginc | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-) mode change 100755 => 100644 filamented.cginc diff --git a/filamented.cginc b/filamented.cginc old mode 100755 new mode 100644 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); diff --git a/pbr.cginc b/pbr.cginc index 5e19089..be67501 100755 --- a/pbr.cginc +++ b/pbr.cginc @@ -215,8 +215,9 @@ Pbr getPbr(v2f i) { pbr.normal = normalize(mul(normal_tangent, pbr.tbn)); #if defined(_BENT_NORMALS) - float3 bent_ts = UnpackNormal(_Bent_Normals_Map.Sample(aniso4_trilinear_repeat_s, uv_parallax * _Bent_Normals_Map_ST.xy + _Bent_Normals_Map_ST.zw)); - bent_ts.xy *= _Bent_Normals_Strength; + float3 bent_ts = UnpackNormal(_Bent_Normals_Map.Sample( + aniso4_trilinear_repeat_s, uv_parallax * _Bent_Normals_Map_ST.xy + + _Bent_Normals_Map_ST.zw)); pbr.bent_normal = normalize(mul(bent_ts, pbr.tbn)); #endif -- cgit v1.2.3