Ray-Traced Prism Displacement Mapping
Ray-traces height-map displacement directly on coarse base triangles without tessellation by bounding each displaced triangle inside a curved-side triangular prism, intersecting its bilinear faces, and marching or subdividing against a min-max height hierarchy.
Also known as PDM, tessellation-free displacement ray tracing, prism displacement mapping, direct displacement ray tracing
In the family Materials, BRDFs & texturing, displacement & micro-geometry
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | Not applicable | Core W3C WebGPU has no hardware ray-tracing acceleration structures yet. |
| Metal | None found |
How it works
Traditional displacement mapping subdivides base meshes into millions of micro-triangles, blowing up BVH build time and GPU memory. Ray-traced prism displacement mapping keeps only the coarse base mesh in the acceleration structure (with AABBs inflated by the displacement bounds) and resolves fine relief lazily inside a custom ray-intersection routine.
Each base triangle (pA, pB, pC) is extruded along its smooth vertex normals (nA, nB, nC) between its minimum and maximum height offsets, forming a watertight triangular prism bounded by two flat endcap triangles and three bilinear patch side faces. When a ray enters a leaf prism's AABB, the intersector computes exact entry and exit distances [tMin, tMax] against the two cap triangles and three bilinear side patches (e.g. via Reshetov's closed-form ray-bilinear test). Because vertex normals are shared across adjacent base triangles, neighboring prisms meet seamlessly along identical bilinear surfaces.
Within [tMin, tMax], the ray maps continuously into local barycentric (u, v) and height h coordinates inside the prism—forming a curved trajectory in texture space—and searches for the first crossing of the scalar height field using either hierarchical min-max mipmap / RMIP traversal or adaptive ray marching followed by secant/binary refinement, computing exact displaced shading normals via finite differences or micro-triangle reconstruction.
When to choose it
Reach for it when
- parallax occlusion mapping breaks at curved edges and silhouettes
- need exact displaced micro-geometry without tessellating millions of triangles
- avoid self-intersection cracks when ray tracing heightmaps on meshes
- render sharp displaced brick or stone silhouettes in a path tracer
- intersect heightfield shells directly inside triangular prisms
Choose it in GPU or CPU ray and path tracers when you need true displaced silhouettes, accurate self-shadowing, and crisp micro-geometry over large surfaces without pre-tessellating millions of triangles into a heavy BVH.
Prefer Parallax occlusion mapping or Relaxed cone step mapping in rasterized pipelines where only screen-space depth perturbation is needed. Prefer Normal mapping with MikkTSpace when silhouettes do not need to change. Prefer Nanite virtualized geometry when rasterizing pre-authored high-poly triangle meshes.
Field marks
- Step-marching variants can miss thin spikes or ridges if the step size is too coarse relative to height-map frequency, whereas hierarchical min-max or RMIP bounds avoid missed intersections
- Strongly diverging vertex normals on concave creases can cause adjacent prisms to self-intersect or invert, producing cracks unless displacement scale is bounded by local curvature
- Grazing rays spend many traversal iterations inside long shallow prisms, increasing ray-tracing thread divergence on GPUs
- Requires watertight continuous vertex normals and consistent UV seams across base triangles to avoid gaps along UV chart boundaries
Presets
Ray-Traced Prism Displacement — flat normal-mapped base shell (left) vs ray-traced prism micro-displacement (right)
{
"P_DISP_HEIGHT": 0.16,
"P_PATTERN_FREQ": 6,
"P_ROT_SPEED": 0.52,
"P_SPLIT": 0.48
}Show GLSL (120 lines)
const float P_DISP_HEIGHT = 0.16; // P Prism Shell Height [0.04, 0.26, 0.01]
const float P_PATTERN_FREQ = 6.0; // P Brick Tile Freq [3.0, 10.0, 0.5]
const float P_ROT_SPEED = 0.52; // P Orbit Speed [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P NormalMap / PrismRT [0.0, 1.0, 0.02]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
// Deep carved stone ashlar masonry heightfield h(u, v) in [0, 1]
float masonryHeight(vec2 uv, float freq) {
vec2 g = uv * vec2(freq * 2.0, freq);
float row = floor(g.y);
g.x += mod(row, 2.0) * 0.5;
vec2 f = fract(g);
vec2 dEdge = min(f, 1.0 - f);
float mortar = smoothstep(0.06, 0.14, min(dEdge.x, dEdge.y * 1.4));
// Subtle chisel bevel & per-stone elevation variance
float stoneVar = 0.78 + 0.22 * sin(row * 3.7 + floor(g.x) * 5.3);
float relief = 0.08 * sin(uv.x * 24.0) * cos(uv.y * 24.0);
return clamp(mortar * stoneVar + relief * mortar, 0.0, 1.0);
}
// Base coarse curved stone pillar cylinder (radius R0 = 0.50, height H = 1.45)
// Extruded prism shell spans [R0, R0 + dispH]
float mapDisplacedPillar(vec3 p, float dispH, float freq) {
float r = length(p.xz);
float ang = atan(p.z, p.x) / 6.2831853 + 0.5;
float h = masonryHeight(vec2(ang * 2.0, p.y * 0.85 + 0.5), freq);
float dCyl = r - (0.48 + h * dispH);
float dCap = abs(p.y) - 0.74;
return max(dCyl, dCap) * 0.65;
}
float mapBasePillar(vec3 p, float dispH) {
float r = length(p.xz);
return max(r - (0.48 + dispH * 0.5), abs(p.y) - 0.74);
}
vec3 calcDispNormal(vec3 p, float dispH, float freq) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapDisplacedPillar(p + e.xyy, dispH, freq) - mapDisplacedPillar(p - e.xyy, dispH, freq),
mapDisplacedPillar(p + e.yxy, dispH, freq) - mapDisplacedPillar(p - e.yxy, dispH, freq),
mapDisplacedPillar(p + e.yyx, dispH, freq) - mapDisplacedPillar(p - e.yyx, dispH, freq)
));
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isPrismRT = screenX >= split;
float dispH = clamp(P_DISP_HEIGHT, 0.02, 0.30);
float freq = clamp(P_PATTERN_FREQ, 2.5, 12.0);
float spin = iTime * max(P_ROT_SPEED, 0.0) * 0.45;
vec3 ro = vec3(0.0, 0.12, 2.25);
vec3 rd = normalize(vec3(uv - vec2(0.0, 0.02), -1.52));
ro.xz = rot2(spin) * ro.xz;
rd.xz = rot2(spin) * rd.xz;
vec3 col = mix(vec3(0.022, 0.028, 0.048), vec3(0.062, 0.078, 0.124), smoothstep(-0.55, 0.55, uv.y));
vec3 lDir = normalize(vec3(0.68, 0.58, 0.48));
float t = 0.0;
bool hit = false;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
float d = isPrismRT ? mapDisplacedPillar(p, dispH, freq) : mapBasePillar(p, dispH);
if (d < 0.002) { hit = true; break; }
t += d;
if (t > 5.0) break;
}
if (hit) {
vec3 p = ro + rd * t;
float ang = atan(p.z, p.x) / 6.2831853 + 0.5;
vec2 mUV = vec2(ang * 2.0, p.y * 0.85 + 0.5);
float hC = masonryHeight(mUV, freq);
vec3 n;
float shadow = 1.0;
if (isPrismRT) {
n = calcDispNormal(p, dispH, freq);
// True ray-traced prism self-shadowing across deep mortar crevices!
float ts = 0.02;
for (int s = 0; s < 16; s++) {
float ds = mapDisplacedPillar(p + lDir * ts, dispH, freq);
if (ds < 0.002) { shadow = 0.22; break; }
ts += max(ds, 0.015);
}
} else {
// Left: flat silhouette cylinder with perturbed normal map only (no silhouette displacement, no self-occlusion!)
vec3 baseN = normalize(vec3(p.x, 0.0, p.z));
vec3 tang = normalize(vec3(-p.z, 0.0, p.x));
vec3 bitang = vec3(0.0, 1.0, 0.0);
float e = 0.004;
float dU = (masonryHeight(mUV + vec2(e, 0.0), freq) - hC) / e;
float dV = (masonryHeight(mUV + vec2(0.0, e), freq) - hC) / e;
n = normalize(baseN - (tang * dU + bitang * dV) * dispH * 0.45);
}
float diff = max(dot(n, lDir), 0.0) * shadow;
float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 28.0) * shadow;
vec3 stone = mix(vec3(0.24, 0.22, 0.20), vec3(0.76, 0.68, 0.58), smoothstep(0.15, 0.85, hC));
col = stone * (0.20 + 0.92 * diff) + vec3(1.0, 0.95, 0.88) * spec * 0.28;
// Highlight crisp displaced silhouette boundary on right
float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.2);
col += (isPrismRT ? vec3(0.24, 0.82, 0.98) : vec3(0.92, 0.34, 0.26)) * rim * 0.28;
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| ray-traced-prism-displacement-mapping-live | Tesla T4 1920x1080 | 21.6× baseline (heavy) · 0.712 ms / 0.745 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| ray-traced-prism-displacement-mapping-live | NVIDIA L4 1920x1080 | 17.1× baseline (moderate) · 0.271 ms / 0.277 ms · 2.6× faster on L4 | opengl-timer-query · Cross-architecture validation |
| ray-traced-prism-displacement-mapping-live | NVIDIA A100-SXM4-40GB 1920x1080 | 12.9× baseline (moderate) · 0.370 ms / 0.382 ms · 1.9× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites GJK and EPA convex collision detection, Sphere Tracing, Möller–Trumbore ray-triangle intersection, Relief mapping, Hierarchical-Z occlusion culling.
Crosses
- Unidirectional Path Tracing: Provides true displaced silhouettes and self-shadowing inside a path tracer without exploding scene triangle counts.
- SAH BVH construction: Stores each base triangle's inflated prism AABB as a custom primitive inside a standard BVH.
Sources
- primaryTheo Thonat, Francois Beaune, Xin Sun, Nathan Carr, Tamy Boubekeur (2021). Tessellation-free displacement mapping for ray tracing. ACM Transactions on Graphics.Verified via crossref · 2026-11-30doi:10.1145/3478513.3480535
- primaryTheo Thonat, Iliyan Georgiev, François Beaune, Tamy Boubekeur (2023). RMIP: Displacement ray tracing via inversion and oblong bounding. SIGGRAPH Asia 2023 Conference Papers.Verified via doi.org · 2026-11-30doi:10.1145/3610548.3618182
- secondaryBrian Smits, Peter Shirley, Michael M. Stark (2000). Direct Ray Tracing of Displacement Mapped Triangles. Eurographics.Verified via crossref · 2026-11-30doi:10.1007/978-3-7091-6303-0_28
- secondarySerban D. Porumbescu, Brian Budge, Louis Feng, Kenneth I. Joy (2005). Shell maps. ACM Transactions on Graphics.Verified via crossref · 2026-11-30doi:10.1145/1073204.1073239
- secondaryAlexander Reshetov (2019). Cool Patches: A Geometric Approach to Ray/Bilinear Patch Intersections. Ray Tracing Gems.Verified via crossref · 2026-11-30doi:10.1007/978-1-4842-4427-2_8
- implementationpissang (2026). pissang/mutracer. WebGPU physically based path tracerGitHub API · license MIT · 2026-11-30