---
id: "relief-mapping"
title: "Relief mapping"
domain: "materials"
stage: "material"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2005
inputs: [texture, normals, uv-atlas]
outputs: [texture, normals]
style: "both"
dynamic: "both"
cost: "medium"
authority: "Policarpo et al., 2005"
url: "https://texelatlas.vercel.app/t/relief-mapping/"
sources_verified_at: "2026-11-29"
---
# Relief mapping (Policarpo et al., 2005)

> Per-pixel ray-height-field intersection using a linear search followed by a binary search, for robust parallax with correct self-occlusion on arbitrary polygonal surfaces, using only height and normal textures.

## Reach for it when

- flat texture lacks depth and parallax on surfaces
- bump maps fail at steep viewing angles
- brick wall should look truly 3d without geometry
- parallax effect with correct self occlusion

## How it works

Policarpo, Oliveira and Comba intersect the view ray with a tangent-space heightfield by first stepping along the ray in uniform increments (linear search) until the ray first passes below the surface, then refining that interval by binary search for a handful of iterations. This hybrid guarantees a hit within the bracket and sharpens it quickly. The result gives exact-looking self-occlusion, and the recovered position can feed shadow tests, depth writing and silhouette tricks. Unlike the earlier 2000 relief texture mapping, which pre-warped texture images in a 3D warping pass, this version evaluates entirely in the fragment shader on any polygon with tangent frames and needs no pre-warp.

## When to use it

Choose it when parallax occlusion's single-interval interpolation breaks and you want robust hit finding at moderate cost. Prefer [Relaxed cone step mapping](https://texelatlas.vercel.app/t/relaxed-cone-step-mapping.md) when thin features are missed by linear search or you need a precomputed cone map. Prefer [Parallax occlusion mapping](https://texelatlas.vercel.app/t/parallax-occlusion-mapping.md) for cheaper per-pixel results with fewer iterations.

## Cost

medium — A linear search of 8-32 height fetches plus 5-8 binary refinements per pixel.
Measured GPU Weight: 4.63× baseline (light) — 0.1522 ms median / 0.1601 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 3.79× baseline (light) — 0.0602 ms median (2.53× faster on L4).
Ampere A100 scaling: 2.94× baseline (light) — 0.0847 ms median (1.8× faster on A100).

## Failure modes

- Thin features narrower than the linear step are skipped, so thin walls or spikes vanish
- Binary search can lock onto the wrong crossing when the ray enters and exits the height field several times
- Silhouette remains flat
- Large cost at grazing angles; needs adaptive step count

## Dataflow

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

## Presets

### Relief mapping: linear search only (left) vs linear + binary refinement (right) (glsl-fragment; rendered 2026-11-29)

```json
{
  "DEPTH": 0.16,
  "LINEAR_STEPS": 10,
  "BINARY_STEPS": 7
}
```

```glsl
// Relief mapping: linear search along the view ray through a brick heightfield, then binary-search refinement.
// Left: 10 linear steps only (stair-stepping at grazing angles). Right: same 10 steps + 7 binary refinements.
const float DEPTH = 0.16;
const int LINEAR_STEPS = 10;
const int BINARY_STEPS = 7;

float hgt(vec2 uv) {
  float row = floor(uv.y / 0.5);
  vec2 c = vec2(fract((uv.x + 0.5 * mod(row, 2.0)) / 1.0), fract(uv.y / 0.5));
  float e = min(min(c.x, 1.0 - c.x), min(c.y, 1.0 - c.y) * 0.5);
  return smoothstep(0.02, 0.07, e);
}
vec3 brick(vec2 uv) {
  float row = floor(uv.y / 0.5); float id = floor(uv.x + 0.5 * mod(row, 2.0));
  float r = fract(sin(dot(vec2(id, row), vec2(12.9898, 78.233))) * 43758.5453);
  return mix(vec3(0.5, 0.18, 0.12), vec3(0.7, 0.35, 0.2), r);
}
vec3 shadeAt(vec2 uv, float t) {
  float e = 0.01; float h = hgt(uv);
  vec3 n = normalize(vec3(-(hgt(uv + vec2(e, 0.0)) - h) / e * 0.12, 1.0, -(hgt(uv + vec2(0.0, e)) - h) / e * 0.12));
  vec3 c = mix(vec3(0.35), brick(uv), h) * (0.2 + 0.9 * max(dot(n, normalize(vec3(0.4, 0.8, 0.4))), 0.0)) * mix(0.45, 1.0, h);
  return mix(vec3(0.7, 0.78, 0.88), c, exp(-t * 0.03));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  vec3 ro = vec3(0.0, 1.0, 0.0), rd = normalize(vec3(uv.x, uv.y - 0.32, -1.0));
  vec3 col = mix(vec3(0.7, 0.78, 0.88), vec3(0.35, 0.55, 0.85), clamp(rd.y * 3.0, 0.0, 1.0));
  if (rd.y < -0.001) {
    float t = -ro.y / rd.y; vec2 p0 = (ro + rd * t).xz * 0.9;
    vec2 dxz = rd.xz / (-rd.y) * DEPTH * 0.9;
    float lo = 0.0, hi = 1.0; float step0 = 1.0 / float(LINEAR_STEPS);
    for (int i = 1; i <= LINEAR_STEPS; i++) {
      float d = float(i) * step0;
      if (d >= 1.0 - hgt(p0 + dxz * d)) { hi = d; lo = d - step0; break; }
      lo = d; hi = 1.0;
    }
    float dsel = hi;
    if (fragCoord.x > 0.5 * iResolution.x) {
      for (int i = 0; i < BINARY_STEPS; i++) {
        float m = 0.5 * (lo + hi);
        if (m >= 1.0 - hgt(p0 + dxz * m)) hi = m; else lo = m;
      }
      dsel = hi;
    }
    col = shadeAt(p0 + dxz * dsel, t);
  }
  if (abs(fragCoord.x - 0.5 * iResolution.x) < 1.0) col = vec3(1.0);
  fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);
}

```

Attribution: written for this index

## Lineage

- extended by [Parallax occlusion mapping](https://texelatlas.vercel.app/t/parallax-occlusion-mapping.md)
- extended by [Relaxed cone step mapping](https://texelatlas.vercel.app/t/relaxed-cone-step-mapping.md)

## Sources

1. [primary] Fábio Policarpo, Manuel M. Oliveira, João L. D. Comba (2005) Real-time relief mapping on arbitrary polygonal surfaces. Proceedings of the 2005 symposium on Interactive 3D graphics and games. https://doi.org/10.1145/1053427.1053453 (verified via crossref on 2026-11-29)
2. [primary] Manuel M. Oliveira, Gary Bishop, David McAllister (2000) Relief texture mapping. Proceedings of the 27th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '00. https://doi.org/10.1145/344779.344947 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Relief mapping." https://texelatlas.vercel.app/t/relief-mapping/ (accessed 2026-12-01).
