Metropolis Light Transport
Samples light paths with a Markov chain that mutates the current path, spending effort proportional to path contribution. Strong on difficult, narrow-light-path scenes and weak on simple ones.
Also known as MLT, PSSMLT
In the family Light transport & global illumination, Monte Carlo light transport
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 | None found | |
| Metal | None found |
How it works
Instead of generating independent random paths, MLT keeps a current valid path from the light to the eye and proposes a small mutation of it. The proposal is accepted with a probability based on the ratio of path contributions, which is the Metropolis-Hastings rule. The resulting chain visits paths with density proportional to their image contribution, so once the chain finds a hard-to-discover bright path (light through a keyhole, a caustic) it stays nearby and explores variations.
The original formulation mutates paths directly with bidirectional mutations, lens and caustic perturbations and so on, each needing its own transition density. A later and far simpler variant, primary-sample-space MLT, mutates the vector of random numbers feeding an ordinary path tracer or BDPT, so any existing integrator becomes a Markov chain sampler.
Output is the histogram of visited pixels, normalized with a separate estimate of total image brightness; mutation strategies and a small amount of independent sampling start the chain.
When to choose it
Reach for it when
- scene lit through a small gap is very noisy
- caustics and nested glass converge slowly
- path tracing struggles when light paths are rare
- pool caustics or lamp in glass full of fireflies
Choose it for scenes where valid light paths occupy a tiny part of path space: lit only through a slightly open door, a lamp inside nested glass, a pool caustic.
Prefer Bidirectional Path Tracing or Vertex Connection and Merging when you want predictable convergence and easy parallelism. Prefer Unidirectional Path Tracing for ordinary scenes: MLT's correlated samples give blotchy, non-uniform noise across the image and complicate animation. Prefer Practical Path Guiding when you want an adaptive sampler without Markov-chain correlation.
Field marks
- Correlated samples give splotchy, non-uniform noise and temporal flicker in animation
- The chain can get stuck in an isolated mode and miss other bright path families
- Per-pixel convergence is uneven, so easy regions can end up noisier than with plain path tracing
- Hard to parallelize across a GPU without independent chains and a careful normalization pass
Presets
Metropolis Light Transport (MLT) — uniform PT missed keyhole (left) vs MCMC Markov-chain exploration (right)
{
"P_DOOR_GAP": 0.24,
"P_MCMC_GAIN": 1.15,
"P_CHAIN_ANIM": 0.85,
"P_SPLIT": 0.48
}Show GLSL (131 lines)
const float P_DOOR_GAP = 0.24; // P Door Slit Width [0.08, 0.45, 0.02]
const float P_MCMC_GAIN = 1.15; // P MCMC Convergence [0.3, 1.6, 0.05]
const float P_CHAIN_ANIM = 0.85; // P Mutation Rate [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P PT / MLT Split [0.0, 1.0, 0.02]
float hash21(vec2 p) {
p = fract(p * vec2(127.1, 311.7));
p += dot(p, p + 34.5);
return fract(p.x * p.y);
}
// Famous Veach "Door Ajar" difficult light-transport benchmark:
// Bright room behind an almost-closed doorway casts a narrow ribbon of light & bounced caustic into dark studio!
vec2 mapDoorRoom(vec3 p, float gap) {
float dFloor = p.y + 0.78;
float dBack = p.z + 1.25;
// Partition wall with narrow vertical doorway slit centered at x = -0.05
float wallZ = abs(p.z + 0.35) - 0.06;
float inSlit = step(abs(p.x + 0.05), gap * 0.5) * step(p.y, 0.62);
float dWall = (inSlit > 0.5) ? 1.0 : max(wallZ, p.y - 0.95);
// Keep outer frame solid around the doorway
float frameL = max(wallZ, -(p.x + 0.05 - gap * 0.5));
float frameR = max(wallZ, (p.x + 0.05 + gap * 0.5));
dWall = min(min(frameL, frameR), max(wallZ, 0.62 - p.y));
dWall = max(wallZ, min(abs(p.x + 0.05) < gap * 0.5 && p.y < 0.62 ? 0.5 : -0.1, 0.5));
// Clean SDF for wall with rectangular aperture
vec2 ap = abs(vec2(p.x + 0.05, p.y + 0.08)) - vec2(gap * 0.5, 0.70);
float dAp = length(max(ap, 0.0)) + min(max(ap.x, ap.y), 0.0);
dWall = max(wallZ, -dAp);
vec2 res = vec2(dFloor, 1.0);
if (dBack < res.x) res = vec2(dBack, 2.0); // bright lit back room
if (dWall < res.x) res = vec2(dWall, 3.0); // partition wall
// Foreground sculptural glass/marble pedestal receiving the difficult doorway bounce light
float dOrb = length(p - vec3(0.42, -0.44, 0.38)) - 0.34;
if (dOrb < res.x) res = vec2(dOrb, 4.0);
float dCube = length(max(abs(p - vec3(-0.46, -0.50, 0.45)) - vec3(0.24, 0.28, 0.24), 0.0));
if (dCube < res.x) res = vec2(dCube, 5.0);
return res;
}
vec3 calcNormal(vec3 p, float gap) {
vec2 e = vec2(0.003, 0.0);
return normalize(vec3(
mapDoorRoom(p + e.xyy, gap).x - mapDoorRoom(p - e.xyy, gap).x,
mapDoorRoom(p + e.yxy, gap).x - mapDoorRoom(p - e.yxy, gap).x,
mapDoorRoom(p + e.yyx, gap).x - mapDoorRoom(p - e.yyx, gap).x
));
}
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 isMLT = screenX >= split;
float gap = clamp(P_DOOR_GAP, 0.06, 0.48);
float mltGain = clamp(P_MCMC_GAIN, 0.25, 1.8);
float animT = iTime * max(P_CHAIN_ANIM, 0.0);
vec3 ro = vec3(0.0, 0.14, 2.08);
vec3 rd = normalize(vec3(uv - vec2(0.0, 0.06), -1.35));
float t = 0.05;
vec2 hit = vec2(10.0, 0.0);
for (int i = 0; i < 64; i++) {
vec2 h = mapDoorRoom(ro + rd * t, gap);
if (h.x < 0.003) { hit = vec2(t, h.y); break; }
t += h.x;
if (t > 8.0) break;
}
vec3 col = vec3(0.015, 0.018, 0.028);
if (hit.y > 0.5) {
vec3 p = ro + rd * hit.x;
vec3 n = calcNormal(p, gap);
if (hit.y > 1.5 && hit.y < 2.5) {
// Bright sun-drenched room visible through the narrow doorway slit
col = vec3(3.2, 2.55, 1.75);
} else {
vec3 alb = vec3(0.56, 0.58, 0.64);
if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.32, 0.36, 0.44);
else if (hit.y > 3.5 && hit.y < 4.5) alb = vec3(0.92, 0.72, 0.48);
else if (hit.y > 4.5) alb = vec3(0.38, 0.72, 0.86);
// Slit portal center at (-0.05, -0.08, -0.35)
vec3 portal = vec3(-0.05, 0.05, -0.35);
vec3 toP = portal - p;
float distP = length(toP);
vec3 dirP = toP / max(distP, 1e-4);
// Directional beam squeezing through narrow doorway gap onto foreground floor & objects
float beamAlign = exp(-pow((p.x + 0.05 - (p.z + 0.35) * 0.28) / max(gap * 0.65 + (p.z + 0.35) * 0.14, 0.05), 2.0));
float inFront = smoothstep(-0.35, -0.15, p.z);
float slitDirect = beamAlign * inFront * max(dot(n, dirP), 0.0) * (1.8 / (0.4 + distP * distP));
// Soft secondary bounce filled by Markov chain local mutations exploring the bright path neighborhood
float bounce = (0.42 / (0.65 + distP * distP)) * (0.35 + 0.65 * max(dot(n, dirP), 0.0)) * inFront;
vec3 converged = alb * (vec3(1.0, 0.84, 0.60) * (slitDirect + bounce * 0.85) + vec3(0.03, 0.04, 0.06));
if (isMLT) {
// Right: MLT locks Markov chains onto the doorway slit -> clean bright shaft & rich indirect glow!
col = converged * mltGain;
// Subtle animated MCMC local mutation sparks dancing inside the discovered light shaft
float spark = exp(-abs(sin(p.x * 22.0 + animT * 3.0) * cos(p.z * 22.0 - animT * 2.4)) * 18.0) * beamAlign * inFront;
col += vec3(0.28, 0.96, 0.92) * spark * 0.22;
} else {
// Left: Naive path tracer rarely hits the narrow gap -> dark, noisy, blotchy fireflies!
vec2 pix = floor(fragCoord * 0.65);
float fr = floor(iTime * 9.0) * 0.11;
float r1 = hash21(pix + vec2(fr * 19.1, 5.7));
float r2 = hash21(pix * 1.31 + vec2(11.3, fr * 29.3));
float hitProb = clamp(gap * 1.4, 0.12, 0.55);
float survived = step(1.0 - hitProb, r1);
float firefly = smoothstep(0.955, 0.998, r2) * 4.8 * (0.25 + slitDirect);
col = converged * (0.14 + 0.95 * survived * r1) + alb * vec3(1.0, 0.85, 0.62) * firefly;
}
}
}
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 |
|---|---|---|---|
| metropolis-light-transport-live | Tesla T4 1920x1080 | 13.2× baseline (moderate) · 0.432 ms / 0.455 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| metropolis-light-transport-live | NVIDIA L4 1920x1080 | 12.2× baseline (moderate) · 0.194 ms / 0.194 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| metropolis-light-transport-live | NVIDIA A100-SXM4-40GB 1920x1080 | 8.19× baseline (moderate) · 0.236 ms / 0.236 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Joint Non-Local Means (JNLM) Path-Tracing Denoiser, Lightcuts, ReSTIR PT and Generalized Resampled Importance Sampling, Vertex Connection and Merging.
Crosses
- Bidirectional Path Tracing: Mutating the random numbers of a BDPT sampler lets the chain reuse its connection strategies.
Sources
- primaryEric Veach, Leonidas J. Guibas (1997). Metropolis light transport. Proceedings of the 24th annual conference on Computer graphics and interactive techniques - SIGGRAPH '97.Verified via crossref · 2026-11-29doi:10.1145/258734.258775
- tutorialMatt Pharr, Wenzel Jakob, Greg Humphreys. Metropolis Light Transport (Physically Based Rendering, 3rd edition). pbr-book.org.Verified via live page · 2026-11-29
- implementationmmp (2015). mmp/pbrt-v3. Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.GitHub API · license BSD-2-Clause · 2026-11-29