Normal mapping with MikkTSpace
Normal mapping stores perturbed normals in a texture to fake fine detail; MikkTSpace is the standard tangent-basis definition that makes bakers and renderers agree. It is what glTF, Blender, Unity and Substance assume.
In the family Materials, BRDFs & texturing, bump and normal mapping
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Official add-on | import { computeMikkTSpaceTangents } from 'three/addons/utils/BufferGeometryUtils.js' docs |
| Babylon.js 9.38.0 | Built in | glTF 2.0 MikkTSpace vertex tangents + screen-space cotangent_frame fallback in bumpFragmentMainFunctions.fx docs |
| Godot 4.7 | Built in | SurfaceTool.generate_tangents() and mesh importers compute MikkTSpace tangents (mikktspace.h) docs |
| Unity | Built in | Default tangent space for imported meshes and Lit/Shader Graph docs Unity uses the MikkTSpace convention; HDRP shaders use the surface-gradient form. |
| Unreal 5.7 | Built in | Interchange / Static Mesh Import > Use MikkTSpace (use_mikk_t_space = true by default) docs |
| Blender 5.2 | Built in | Shader Editor > Add > Vector > Normal Map, Space = Tangent Space docs Tangent space follows MikkTSpace. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
A tangent-space normal map encodes a unit normal per texel in a frame (tangent, bitangent, normal). At render time the shader fetches the texel, decodes it (n = 2c - 1), rebuilds the frame from interpolated vertex tangent and normal, and transforms to world space. Baking and rendering must use the same frame or the shading shows seams, which is why Mikkelsen defined MikkTSpace: a per-vertex tangent computed from the triangle's UV gradients, with a specific rule for splitting vertices at UV mirrors and for orthogonalisation. The tangent's w component stores handedness. In the fragment shader the bitangent is rebuilt as the cross product of normal and tangent scaled by that sign, and the frame is not re-orthogonalised per pixel; this is what makes baker and renderer match. Normal textures are stored linearly (not sRGB) and often as two-channel BC5.
When to choose it
Reach for it when
- baked normal map looks wrong in another engine
- lighting seams across uv islands
- tangent space mismatch between baker and renderer
- add surface detail to low poly without more triangles
Choose it as the default for authored detail on UV-mapped meshes. Prefer Surface gradient based bump mapping framework for layered or non-UV sources, and Parallax occlusion mapping or Relief mapping when parallax and self-occlusion matter at grazing angles. Pair with Toksvig normal-map filtering to stop minified normal maps shimmering.
Field marks
- Tangent mismatch between baker and renderer causes stretched or inverted lighting and visible seams along UV borders
- Mirrored UVs without correct handedness flip lighting
- Normal maps flatten under minification, making surfaces glossier unless filtered (toksvig-mipmapping)
- Flat silhouettes: normal mapping adds no geometry, so edges and shadows stay smooth
Presets
Tangent-space normal mapping on a sphere: geometric (left) vs mapped (right)
{
"STRENGTH": 2.2
}Show GLSL (31 lines)
// Tangent-space normal mapping with a per-pixel TBN frame built from the sphere's (longitude, latitude)
// parametrisation. Left half: geometric normals. Right half: dimple normal map perturbs the shading normal.
const float STRENGTH = 2.2;
const vec2 CELLS = vec2(16.0, 8.0);
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 ro = vec3(0.0, 0.0, 4.0), rd = normalize(vec3(uv, -2.6));
vec3 col = vec3(0.05) + 0.05 * uv.y;
float b = dot(ro, rd); float h = b * b - dot(ro, ro) + 0.81;
if (h > 0.0) {
vec3 p = ro + rd * (-b - sqrt(h)); vec3 n = normalize(p);
float lon = atan(n.x, n.z), lat = asin(clamp(n.y, -1.0, 1.0));
if (fragCoord.x > 0.5 * iResolution.x) {
vec2 g = vec2(lon / 6.2832, lat / 3.14159) * CELLS * 6.2832;
// height = cos(u) * cos(v); analytic derivatives w.r.t. u and v
vec2 dh = vec2(-sin(g.x) * cos(g.y), -cos(g.x) * sin(g.y));
vec3 nts = normalize(vec3(-dh * STRENGTH * 0.25, 1.0));
vec3 T = vec3(cos(lon), 0.0, -sin(lon));
vec3 B = cross(n, T);
n = normalize(T * nts.x + B * nts.y + n * nts.z);
}
vec3 l = normalize(vec3(0.6, 0.5, 0.7)), v = -rd, hv = normalize(l + v);
float nl = max(dot(n, l), 0.0);
col = vec3(0.55, 0.38, 0.3) * (nl + 0.08) + vec3(0.8) * pow(max(dot(n, hv), 0.0), 40.0) * nl;
}
if (abs(fragCoord.x - 0.5 * iResolution.x) < 1.0) col = vec3(1.0);
col = col / (1.0 + col * 0.6);
fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);
}
Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| normal-mapping-mikktspace-specimen | Tesla T4 1920x1080 | 2.18× baseline (light) · 0.072 ms / 0.075 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| normal-mapping-mikktspace-specimen | NVIDIA L4 1920x1080 | 1.77× baseline (feather) · 0.028 ms / 0.028 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| normal-mapping-mikktspace-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 1.25× baseline (feather) · 0.036 ms / 0.036 ms · 2.0× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Sources
- implementationmmikk (2020). mmikk/MikkTSpace. A common standard for tangent space used in baking tools to produce normal maps.GitHub API · no license declared · 2026-11-29