Last active
March 19, 2023 06:44
-
-
Save selfshadow/8048308 to your computer and use it in GitHub Desktop.
Reoriented Normal Mapping (http://blog.selfshadow.com/publications/blending-in-detail/) for unpacked, normalised vectors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Blending when n1 and n2 are already 'unpacked' and normalised | |
float3 blend_rnm_unpacked(float3 n1, float3 n2) | |
{ | |
float3 t = n1.xyz + float3( 0, 0, 1); | |
float3 u = n2.xyz * float3(-1, -1, 1); | |
float3 r = (t/t.z)*dot(t, u) - u; | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment