From d24a5d839bad7ae0a9a6525f7c4d30fa0877e073 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 20 Jan 2026 22:07:45 -0800 Subject: Introduce f2f, general purpose shared container for fragment shader --- 2ner.cginc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '2ner.cginc') diff --git a/2ner.cginc b/2ner.cginc index 714930f..5439556 100644 --- a/2ner.cginc +++ b/2ner.cginc @@ -286,12 +286,15 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace i.normal *= facing ? 1 : -1; i.normal = UnityObjectToWorldNormal(i.normal); - i.tangent = mul(unity_ObjectToWorld, i.tangent); + i.tangent = UnityObjectToWorldNormal(i.tangent); // Not necessarily normalized after interpolation i.normal = normalize(i.normal); i.tangent = normalize(i.tangent); + f2f f = (f2f) 0; + f.binormal = cross(i.tangent, i.normal); + #if defined(_RAYMARCHED_FOG) { // Many fields are overspecified as .rgb or .xyz. This is because thry's @@ -520,7 +523,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace #endif #if defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS) || defined(OUTLINE_PASS) || defined(EXTRA_STENCIL_COLOR_PASS) - YumLighting l = GetYumLighting(i, pbr); + YumLighting l = GetYumLighting(i, f, pbr); #if defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS) applyMatcapsAndRimLighting(i, pbr, l); -- cgit v1.2.3