---
id: "normal-mapping-mikktspace"
title: "Normal mapping with MikkTSpace"
domain: "materials"
stage: "material"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot, blender]
year_introduced: 2008
inputs: [normals, texture, mesh, uv-atlas]
outputs: [normals]
style: "both"
dynamic: "both"
cost: "cheap"
authority: "Mikkelsen"
url: "https://texelatlas.vercel.app/t/normal-mapping-mikktspace/"
sources_verified_at: "2026-11-29"
---
# Normal mapping with MikkTSpace (Mikkelsen)

> 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.

## 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

## 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 use it

Choose it as the default for authored detail on UV-mapped meshes. Prefer [Surface gradient based bump mapping framework](https://texelatlas.vercel.app/t/surface-gradient-bump-mapping.md) for layered or non-UV sources, and [Parallax occlusion mapping](https://texelatlas.vercel.app/t/parallax-occlusion-mapping.md) or [Relief mapping](https://texelatlas.vercel.app/t/relief-mapping.md) when parallax and self-occlusion matter at grazing angles. Pair with [Toksvig normal-map filtering](https://texelatlas.vercel.app/t/toksvig-mipmapping.md) to stop minified normal maps shimmering.

## Cost

cheap — One texture fetch and a 3x3 transform per pixel.
Measured GPU Weight: 2.18× baseline (light) — 0.0716 ms median / 0.0752 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 1.77× baseline (feather) — 0.0281 ms median (2.55× faster on L4).
Ampere A100 scaling: 1.25× baseline (feather) — 0.0359 ms median (1.99× faster on A100).

## Failure modes

- 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

## Engine support

- babylonjs: builtin — `glTF 2.0 MikkTSpace vertex tangents + screen-space cotangent_frame fallback in bumpFragmentMainFunctions.fx` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Meshes/mesh.vertexData.ts, checked 2026-12-01)
- blender: builtin — `Shader Editor > Add > Vector > Normal Map, Space = Tangent Space` (evidence: https://docs.blender.org/manual/en/5.2/render/shader_nodes/displacement/normal_map.html, checked 2026-12-01) — Tangent space follows MikkTSpace.
- godot: builtin — `SurfaceTool.generate_tangents() and mesh importers compute MikkTSpace tangents (mikktspace.h)` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/scene/resources/surface_tool.cpp, checked 2026-12-01)
- threejs: official — `import { computeMikkTSpaceTangents } from 'three/addons/utils/BufferGeometryUtils.js'` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/utils/BufferGeometryUtils.js, checked 2026-12-01)
- unity: builtin — `Default tangent space for imported meshes and Lit/Shader Graph` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesFunctions.hlsl, checked 2026-12-01) — Unity uses the MikkTSpace convention; HDRP shaders use the surface-gradient form.
- unreal: builtin — `Interchange / Static Mesh Import > Use MikkTSpace (use_mikk_t_space = true by default)` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/python-api/class/InterchangeGenericCommonMeshesProperties, checked 2026-12-01)

## Dataflow

- Inputs: normals, texture, mesh, uv-atlas
- Outputs: normals
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot, blender

## Presets

### Tangent-space normal mapping on a sphere: geometric (left) vs mapped (right) (glsl-fragment; rendered 2026-11-29)

```json
{
  "STRENGTH": 2.2
}
```

```glsl
// 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

## Lineage

- extends [High-to-low-poly normal map baking](https://texelatlas.vercel.app/t/normal-map-baking.md)
- extended by [Reoriented normal map blending (detail normals)](https://texelatlas.vercel.app/t/reoriented-normal-mapping.md)

## Sources

1. [primary] Morten S. Mikkelsen MikkTSpace. mikktspace.com. http://www.mikktspace.com/ (verified via http on 2026-11-29)
2. [implementation] mmikk (2020) mmikk/MikkTSpace. https://github.com/mmikk/MikkTSpace (verified via github on 2026-11-29)

## Cite this entry

Texel. "Normal mapping with MikkTSpace." https://texelatlas.vercel.app/t/normal-mapping-mikktspace/ (accessed 2026-12-01).
