diff options
| author | yum <yum.food.vr@gmail.com> | 2024-07-20 02:13:12 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-07-20 02:13:20 -0700 |
| commit | 68ca46b15f6a7185a03060070d24b350102fafe6 (patch) | |
| tree | 8bcac9d0acb0075e149e43dcf8c7531105aad46f | |
| parent | 6c1e463a846292a55cf10db772741cea657f298f (diff) | |
Normalize normals
| -rw-r--r-- | tooner_lighting.cginc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 650e66e..d067ce6 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -802,6 +802,7 @@ float4 effect(inout v2f i) const float3 view_dir = normalize(_WorldSpaceCameraPos - i.worldPos); // Not necessarily normalized after interpolation. i.normal = normalize(i.normal); + i.tangent.xyz = normalize(i.tangent.xyz); #if defined(_TROCHOID) { @@ -882,7 +883,8 @@ float4 effect(inout v2f i) applyOverlayNormal(raw_normal, ov, i, iddx, iddy); float3 binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w); - float3 normal = normalize( + // normalize is not necessary; result is already normalized + float3 normal = float3( raw_normal.x * i.tangent + raw_normal.y * binormal + raw_normal.z * i.normal |
