Reoriented normal map blending (detail normals)
A correct way to layer a detail normal map onto a base normal map: it rotates the detail normal into the frame of the base so slopes combine as real orientations rather than averaged offsets.
Also known as RNM, reoriented normal blending
In the family Materials, BRDFs & texturing, normal mapping
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | BaseMaterial3D.detail_normal blends normals with linear mix(...) rather than Reoriented Normal Mapping. |
| Unity | Built in | Shader Graph > Normal Blend node > Mode = Reoriented docs |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Blending two tangent-space normals by adding xy and renormalising treats them as height gradients and flattens detail where the base is steep. Reoriented blending instead rotates the detail normal by the rotation that carries the +Z axis to the base normal. With t = base(2,2,2)+(-1,-1,0) and u = detail(-2,-2,2)+(1,1,-1), the result is r = t * dot(t,u) / t.z - u, then normalised. That is the shortest-arc rotation applied to the detail vector in closed form: no trigonometry or matrix building, just a dot product and a divide. Cheaper approximations include UDN (add the detail xy to the base) and the whiteout blend (add xy, multiply z), which keep strong detail but are not exact. RNM is the reference that others are compared to; the cost difference matters only on weak hardware.
When to choose it
Reach for it when
- detail normal map flattens the base normal map
- blending two normal maps looks wrong on slopes
- combining triplanar or decal normals correctly
- micro detail normals lose strength on curved areas
- choose between udn whiteout and correct normal blend
Use it whenever a detail or micro normal map is layered on top of a macro normal map, or when decals and triplanar projections combine tangent-space normals. Prefer Surface gradient based bump mapping framework for a framework that blends many bump or normal sources in one place with consistent semantics. Prefer plain UDN or whiteout when ALU is critical. Use Normal distribution filtering for specular antialiasing or Toksvig normal-map filtering for how those normal maps are filtered and minified.
Field marks
- Uses the +Z-up unpacked convention; passing already-biased [0,1] values or OpenGL/DirectX Y-flipped maps gives wrong slopes
- Division by t.z blows up when the base normal is nearly horizontal, unless clamped
- Blending must happen before the TBN transform; blending in world space reintroduces the error
- Not associative: blending in a different order across layers changes the result slightly
- Mip-averaged detail normals shorten in length, so the blend underestimates detail at distance without length-aware filtering
Presets
Reoriented Normal Mapping (RNM) — linear/UDN normal blend flattening (left) vs quaternion RNM rotation (right)
{
"P_MACRO_STEEP": 1,
"P_DETAIL_STR": 0.85,
"P_LIGHT_SPIN": 0.65,
"P_SPLIT": 0.48
}Show GLSL (88 lines)
const float P_MACRO_STEEP = 1.0; // P Base Slope Steep [0.2, 1.5, 0.05]
const float P_DETAIL_STR = 0.85; // P Detail Strength [0.1, 1.5, 0.05]
const float P_LIGHT_SPIN = 0.65; // P Light Orbit [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Linear / RNM Split [0.0, 1.0, 0.02]
// Base macro normal map: bold embossed circular domes & deep fluted ridges (very steep base slopes!)
vec3 evalBaseNormal(vec2 uv, float steep) {
vec2 p = uv * 3.2;
vec2 cell = fract(p) - 0.5;
float r = length(cell);
// Steep spherical bump + wave ridges
vec2 grad = vec2(0.0);
if (r < 0.38) {
grad += (cell / max(r, 1e-4)) * smoothstep(0.38, 0.05, r) * 2.4;
}
grad += vec2(cos(uv.x * 14.0), sin(uv.y * 14.0)) * 0.85;
grad *= steep;
return normalize(vec3(-grad.x, -grad.y, 1.0));
}
// High-frequency detail normal map: crisp micro-hexagonal scales / embossed fabric studs
vec3 evalDetailNormal(vec2 uv, float str) {
vec2 q = uv * 34.0;
vec2 f = fract(q) - 0.5;
float r = length(f);
vec2 dg = (r < 0.38) ? (f / max(r, 1e-4)) * smoothstep(0.38, 0.08, r) * 1.65 : vec2(0.0);
dg += vec2(cos(q.x * 3.14159), sin(q.y * 3.14159)) * 0.45;
dg *= str;
return normalize(vec3(-dg.x, -dg.y, 1.0));
}
// Reoriented Normal Mapping (Barre-Brisebois & Hill 2012): shortest-arc quaternion rotation of n2 onto n1!
vec3 blendRNM(vec3 n1, vec3 n2) {
vec3 t = n1 + vec3(0.0, 0.0, 1.0);
vec3 u = n2 * vec3(-1.0, -1.0, 1.0);
return normalize(t * (dot(t, u) / max(t.z, 1e-4)) - u);
}
// Naive linear normal blending (washes out detail when base normal tilts steeply away from +Z!)
vec3 blendLinear(vec3 n1, vec3 n2) {
return normalize(n1 + n2);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isRNM = screenX >= split;
float steep = clamp(P_MACRO_STEEP, 0.15, 1.6);
float detStr = clamp(P_DETAIL_STR, 0.05, 1.6);
float spin = iTime * max(P_LIGHT_SPIN, 0.0);
vec3 nBase = evalBaseNormal(uv, steep);
vec3 nDet = evalDetailNormal(uv, detStr);
vec3 n = isRNM ? blendRNM(nBase, nDet) : blendLinear(nBase, nDet);
// Orbiting grazing studio key light + cool fill light so slope-normal differences pop unmistakably!
vec3 l1 = normalize(vec3(cos(spin * 0.75) * 0.85, sin(spin * 0.75) * 0.85, 0.42));
vec3 l2 = normalize(vec3(-0.65, 0.55, 0.65));
vec3 v = vec3(0.0, 0.0, 1.0);
float diff1 = max(dot(n, l1), 0.0);
float diff2 = max(dot(n, l2), 0.0);
float spec1 = pow(max(dot(n, normalize(l1 + v)), 0.0), 48.0);
float spec2 = pow(max(dot(n, normalize(l2 + v)), 0.0), 28.0);
// Anodized copper-slate ceramic shader
vec3 alb = mix(vec3(0.18, 0.24, 0.34), vec3(0.84, 0.46, 0.26), smoothstep(0.4, 0.95, nBase.z));
vec3 col = alb * (0.16 + 0.95 * diff1 + 0.30 * diff2)
+ vec3(1.0, 0.90, 0.78) * spec1 * 0.88
+ vec3(0.32, 0.74, 1.0) * spec2 * 0.35;
// Subtle normal-map diagnostic strip along bottom edge
float screenY = fragCoord.y / max(iResolution.y, 1.0);
if (screenY < 0.12) {
col = mix(col, n * 0.5 + 0.5, smoothstep(0.12, 0.11, screenY) * 0.92);
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| reoriented-normal-mapping-live | Tesla T4 1920x1080 | 4.14× baseline (light) · 0.136 ms / 0.139 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| reoriented-normal-mapping-live | NVIDIA L4 1920x1080 | 3.36× baseline (light) · 0.053 ms / 0.054 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| reoriented-normal-mapping-live | NVIDIA A100-SXM4-40GB 1920x1080 | 2.50× baseline (light) · 0.072 ms / 0.072 ms · 1.9× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Crosses
- Triplanar mapping: The three projected tangent-space normals are combined with reoriented blending instead of a linear mix.
- Deferred and projected decals: Decal normals are layered over the stored surface normal using the same rotation.
Sources
- primaryColin Barre-Brisebois, Stephen Hill. Blending in Detail. blog.selfshadow.com.Verified via live page · 2026-11-29