Skip to content

Instantly share code, notes, and snippets.

@selfshadow
Last active March 19, 2023 06:44
Show Gist options
  • Save selfshadow/8048308 to your computer and use it in GitHub Desktop.
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
// 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