diff options
| author | yum <yum.food.vr@gmail.com> | 2025-11-11 16:20:14 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-11-11 16:20:14 -0800 |
| commit | fb48528cbb1881ff8ac96a1cd05c2c7aa326b203 (patch) | |
| tree | 8f48bd00c00c0b26e49bbfa84de74509a6032ace /math.cginc | |
| parent | 5cbad6aa884ee4c77f6af65cdfceac987f54a227 (diff) | |
add detail map feature
Diffstat (limited to 'math.cginc')
| -rw-r--r-- | math.cginc | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -89,5 +89,15 @@ float3 round_hex(float3 hex_coord) { return rounded; } +// Reoriented normal mapping +// https://blog.selfshadow.com/publications/blending-in-detail/ +// Inputs are in tangent space. +float3 blendNormalsHill12(float3 n0, float3 n1) { + n0.z += 1.0; + n1.xy = -n1.xy; + + return normalize(n0 * dot(n0, n1) - n1 * n0.z); +} + #endif // __MATH_INC |
