Triplanar mapping
Texturing without UVs: sample a texture along the three world axes and blend by the surface normal. The standard fix for terrain cliffs, procedural meshes and anything where UV stretching is unavoidable.
In the family Materials, BRDFs & texturing, texture projection
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Built in | import { triplanarTexture } from 'three/tsl' docs TSL / WebGPURenderer. |
| Babylon.js 9.38.0 | Official add-on | new BABYLON.TriPlanarMaterial('m', scene) from @babylonjs/materials docs Also TriPlanarBlock in Node Material. |
| Godot 4.7 | Built in | BaseMaterial3D.uv1_triplanar = true docs |
| Unity | Built in | Shader Graph > Triplanar Node docs Shader Graph node, URP and HDRP. |
| Unreal 5.7 | Built in | Material function WorldAlignedTexture (Texturing material functions) docs |
| Blender 5.2 | Built in | Image Texture node > Projection = Box (with Blend) docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Project the world position onto the three axis-aligned planes (yz, xz, xy) to form three UV sets and fetch the texture three times. Blend weights come from the absolute normal raised to a sharpness power and renormalised, w = |n|^k / sum |n|^k, so each projection dominates where it faces the surface. Normal maps need care: each projection's tangent-space normal has to be swizzled into world space (the whiteout or reoriented normal blend methods handle this properly) before blending. Vertex or splat-weighted material masks can pick different textures per layer. Because there are no UVs, the technique works on SDF-meshed, voxel and heightfield terrain, and the cost is three fetches per texture rather than one.
When to choose it
Reach for it when
- textures stretch on cliffs and steep terrain
- procedural meshes have no uvs
- need to texture rocks without unwrapping
- uv stretching ruins terrain slopes
Choose it for terrain, rocks, procedurally generated meshes and any mesh without good UVs. Prefer UV mapping with an atlas when UVs exist and detail must be authored. Use Histogram-preserving blending (stochastic texturing) or Hex-tiling on top to break repetition visible on large triplanar surfaces. Use Surface gradient based bump mapping framework to blend normals robustly.
Field marks
- Visible blending seams and doubled detail where two projections overlap on 45-degree slopes
- Naive normal blending produces wrong lighting; swizzle or use reoriented normal mapping
- Texture repeats visibly over large areas without anti-tiling
- Texture scale follows world space, so scaled objects show stretched or varying texel density
Presets
Planar projection (left) vs triplanar projection (right)
{
"SCALE": 3,
"SHARPNESS": 4
}Show GLSL (32 lines)
// Texturing without UVs. Left sphere: a single planar projection along z stretches the texture toward the
// silhouette. Right sphere: triplanar projection blends three axis-aligned lookups by |normal|^4.
const float SCALE = 3.0;
const float SHARPNESS = 4.0;
vec3 tex(vec2 uv) {
vec2 f = fract(uv);
vec3 c = mix(vec3(0.9, 0.55, 0.2), vec3(0.2, 0.3, 0.55), mod(floor(uv.x) + floor(uv.y), 2.0));
return mix(c, vec3(1.0), smoothstep(0.03, 0.0, abs(length(f - 0.5) - 0.3)));
}
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.3));
vec3 col = vec3(0.08) + 0.06 * uv.y;
mat3 rot = mat3(0.87, 0.0, -0.5, 0.0, 1.0, 0.0, 0.5, 0.0, 0.87);
for (int i = 0; i < 2; i++) {
vec3 c = vec3(i == 0 ? -0.5 : 0.5, 0.0, 0.0);
vec3 oc = ro - c; float b = dot(oc, rd); float h = b * b - dot(oc, oc) + 0.46 * 0.46;
if (h < 0.0) continue;
vec3 n = normalize(ro + rd * (-b - sqrt(h)) - c);
vec3 q = rot * n * 0.46;
vec3 alb;
if (i == 0) alb = tex(q.xy * SCALE * 2.2);
else {
vec3 w = pow(abs(rot * n), vec3(SHARPNESS)); w /= w.x + w.y + w.z;
alb = tex(q.yz * SCALE * 2.2) * w.x + tex(q.zx * SCALE * 2.2) * w.y + tex(q.xy * SCALE * 2.2) * w.z;
}
col = alb * (0.2 + 0.9 * max(dot(n, normalize(vec3(0.5, 0.6, 0.7))), 0.0));
}
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 |
|---|---|---|---|
| triplanar-mapping-specimen | Tesla T4 1920x1080 | 1.29× baseline (feather) · 0.042 ms / 0.044 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| triplanar-mapping-specimen | NVIDIA L4 1920x1080 | 1.19× baseline (feather) · 0.019 ms / 0.019 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| triplanar-mapping-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 1.03× baseline (feather) · 0.030 ms / 0.030 ms · 1.4× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Hex-tiling: Hex-tiling breaks the repetition of each triplanar projection.
Sources
- primaryRyan Geiss. Generating Complex Procedural Terrains Using the GPU. developer.nvidia.com.Verified via live page · 2026-11-29