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

> Per-pixel ray march through a height map in tangent space to shift texture coordinates and produce parallax and self-occlusion on flat polygons. Cheaper than real displacement, convincing on bricks and cobblestones.

## Reach for it when

- flat bricks or cobblestones look like a painted wall
- normal maps lack depth and parallax
- want self-occlusion on surfaces without extra geometry
- floors need depth shift when camera moves

## How it works

Tatarchuk's method casts the view ray into the tangent-space heightfield beneath the polygon. Starting at the entry point it steps along the ray in a fixed or adaptive number of linear samples (more at grazing angles), comparing the ray height to the sampled height. At the first crossing it linearly interpolates between the last two samples to refine the intersection, then uses the resulting UV for all subsequent texture lookups (albedo, normal, roughness). Optionally a second march toward the light yields soft self-shadowing. LOD blends the effect off with distance, reducing sample counts and eventually falling back to plain normal mapping. It is a purely fragment-shader technique.

## When to use it

Choose it for floors, walls and rocky ground where parallax and self-occlusion add credibility from a modest viewing range. Prefer [Relief mapping](https://texelatlas.vercel.app/t/relief-mapping.md) or [Relaxed cone step mapping](https://texelatlas.vercel.app/t/relaxed-cone-step-mapping.md) for more accurate, artifact-free intersections or steeper heights. Prefer real tessellation or [Nanite virtualized geometry](https://texelatlas.vercel.app/t/nanite-virtualized-geometry.md) when silhouettes must be displaced. Prefer [Normal mapping with MikkTSpace](https://texelatlas.vercel.app/t/normal-mapping-mikktspace.md) when height is subtle.

## Cost

medium — Several height-map fetches per pixel (often 8-32); scales with sample count and screen coverage.
Measured GPU Weight: 3.55× baseline (light) — 0.1168 ms median / 0.1233 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 2.67× baseline (light) — 0.0425 ms median (2.75× faster on L4).
Ampere A100 scaling: 2.24× baseline (light) — 0.0644 ms median (1.81× faster on A100).

## Failure modes

- Stair-stepping and swimming at grazing angles when the sample count is too low
- Silhouettes and polygon edges stay flat, so the illusion breaks at object borders
- Texture distortion and layered sampling artefacts on steep height with few samples
- Does not interact with depth buffer unless depth is written, so intersections with other geometry look wrong

## Engine support

- babylonjs: builtin — `material.useParallax = true; material.useParallaxOcclusion = true` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.pure.ts, checked 2026-12-01)
- godot: builtin — `BaseMaterial3D.heightmap_enabled = true (heightmap_deep_parallax for deep parallax)` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/BaseMaterial3D.xml, checked 2026-12-01)
- threejs: official — `examples/webgpu_parallax_uv.html` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/webgpu_parallax_uv.html, checked 2026-12-01) — Official TSL example; not a material option.
- unity: builtin — `HDRP Lit > Surface Inputs > Height Map > Displacement Mode = Pixel; Shader Graph POM node` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.shadergraph/Documentation~/Parallax-Occlusion-Mapping-Node.md, checked 2026-12-01) — Shader Graph POM node and HDRP Lit pixel displacement; URP Lit has simple parallax.
- unreal: builtin — `Material Parallax Occlusion Mapping expression (ParallaxOcclusionMapping)` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/contact-shadows-in-unreal-engine, checked 2026-12-01)

## Dataflow

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

## Presets

### Brick heightfield: flat lookup (left) vs parallax occlusion mapping (right) (glsl-fragment; rendered 2026-11-29)

```json
{
  "DEPTH": 0.16,
  "LAYERS": 24
}
```

```glsl
// Parallax occlusion mapping on a brick heightfield seen at grazing angle.
// Left: flat texture lookup (no parallax). Right: layered height-field ray march in uv space, with linear
// interpolation between the last two layers.
const float DEPTH = 0.16;
const int LAYERS = 24;

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 alb = mix(vec3(0.35), brick(uv), h);
  vec3 c = alb * (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;
    if (fragCoord.x < 0.5 * iResolution.x) col = shadeAt(p0, t);
    else {
      vec2 dxz = rd.xz / (-rd.y) * DEPTH * 0.9;
      float dPrev = 0.0, hPrev = 1.0 - hgt(p0), dCur = 0.0; vec2 uvh = p0;
      for (int i = 1; i <= LAYERS; i++) {
        float d = float(i) / float(LAYERS);
        vec2 q = p0 + dxz * d; float sd = 1.0 - hgt(q);
        if (d >= sd) {
          float a0 = d - sd, a1 = hPrev - dPrev;
          float w = a0 / max(a0 - (dPrev - hPrev) , 1e-4);
          float dd = mix(d, dPrev, clamp(w, 0.0, 1.0)); uvh = p0 + dxz * dd; break;
        }
        dPrev = d; hPrev = sd; uvh = q;
      }
      col = shadeAt(uvh, 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

- extends [Relief mapping](https://texelatlas.vercel.app/t/relief-mapping.md)
- extended by [Ray-Traced Prism Displacement Mapping](https://texelatlas.vercel.app/t/ray-traced-prism-displacement-mapping.md)

## Sources

1. [primary] Natalya Tatarchuk (2006) Dynamic parallax occlusion mapping with approximate soft shadows. Proceedings of the 2006 symposium on Interactive 3D graphics and games  - SI3D '06. https://doi.org/10.1145/1111411.1111423 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Parallax occlusion mapping." https://texelatlas.vercel.app/t/parallax-occlusion-mapping/ (accessed 2026-12-01).
