diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-24 16:54:26 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-24 16:54:26 -0800 |
| commit | d0c27e80cefa593641f3525ef23e7fc5631b136b (patch) | |
| tree | 2894d04cac14f1403f49d52f8a742440cb8cfbf1 /yum_lighting.cginc | |
| parent | 4885fb42bd42f5dfb7fdc198bd0cc42be7959aaf (diff) | |
Add anisotropic reflections
Diffstat (limited to 'yum_lighting.cginc')
| -rw-r--r-- | yum_lighting.cginc | 9 |
1 files changed, 8 insertions, 1 deletions
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) |
