From d0c27e80cefa593641f3525ef23e7fc5631b136b Mon Sep 17 00:00:00 2001 From: yum Date: Sat, 24 Jan 2026 16:54:26 -0800 Subject: Add anisotropic reflections --- yum_lighting.cginc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'yum_lighting.cginc') diff --git a/yum_lighting.cginc b/yum_lighting.cginc index 7f2d922..a1bef47 100644 --- a/yum_lighting.cginc +++ b/yum_lighting.cginc @@ -166,7 +166,14 @@ float GetLodRoughness(float roughness) { } float3 getIndirectSpecular(v2f i, f2f f, YumPbr pbr, float3 view_dir, float diffuse_luminance) { +#if defined(_ANISOTROPY) + float3 aniso_tangent = cross(view_dir, pbr.binormal); + float3 aniso_normal = -normalize(cross(aniso_tangent, pbr.binormal)); + float3 refl_normal = normalize(lerp(pbr.normal, aniso_normal, _Anisotropy_Strength)); + float3 reflect_dir = reflect(-view_dir, refl_normal); +#else float3 reflect_dir = reflect(-view_dir, pbr.normal); +#endif UnityGIInput data; data.worldPos = f.worldPos; @@ -349,7 +356,7 @@ YumLighting GetYumLighting(v2f i, f2f f, YumPbr pbr) { light.attenuation = getShadowAttenuation(i, f); float3 tangentNormal = mul(f.tbn, pbr.normal); - float3x3 tangentToWorld = float3x3(i.tangent, f.binormal, i.normal); + float3x3 tangentToWorld = float3x3(i.tangent.xyz, f.binormal, i.normal); // Use Bakery-aware irradiance function #if defined(LIGHTMAP_ON) -- cgit v1.2.3