This repository constains the code for Reoriented Normal Mapping [1], a technique to compute proper blending of tangent space normals via quaternion rotation.
Details regarding the technique and how it compares to other approaches can be found here.
The code is provided in the form of a RenderMonkey project. You can download RenderMonkey here.
float3 t = tex2D(BaseNormal, uv) * float3(2, 2, 2) + float3(-1, -1, 0);
float3 u = tex2D(DetailNormal, uv) * float3(-2, -2, 2) + float3(1, 1, -1);
float3 r = t * dot(t, u) / t.z – u;
[1] Barré-Brisebois, Colin and Hill, Stephen. "Blending in Detail - Reoriented Normal Mapping", 2012, Available Online.