diff options
| author | yum <yum.food.vr@gmail.com> | 2026-07-20 16:35:51 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-07-20 16:35:51 -0700 |
| commit | da12f242c6d8da930aa3c2e90fd21a637cd1f195 (patch) | |
| tree | eaf266606ad6bffed657f2a7f2b5953fb199f23f /math.cginc | |
| parent | 2808677625ebec6d9342363ba97af00a9c11bfcd (diff) | |
Add glitter normal map override option
Diffstat (limited to 'math.cginc')
| -rwxr-xr-x | math.cginc | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -334,4 +334,12 @@ float3 srgb_to_linear(float3 srgb_color) { return lerp(lo, hi, step(0.04045f, srgb_color)); } +float3x3 tbn_from_normal_tangent(float3 normal, float4 tangent) { + float3 n = normal; + float3 t = tangent.xyz; + t = normalize(t - n * dot(n, t)); // Gram-Schmidt to avoid skew + float3 b = normalize(cross(n, t)) * tangent.w; + return float3x3(t, b, n); +} + #endif // __MATH_INC |
