Progressive Photon Mapping
Photon mapping reformulated so the gather radius shrinks over iterations. The result converges to the exact answer with bounded memory and handles extreme specular light transport.
Also known as PPM, SPPM
In the family Light transport & global illumination, Density-estimation 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
Classic photon mapping needs infinite memory to converge. Progressive photon mapping inverts the order. First, rays from the camera find visible points (diffuse hits seen after any specular chain) and store them with a small initial radius. Then, in repeated passes, a fresh batch of photons is traced and discarded; each photon that lands within a visible point's radius adds its flux to that point's running total.
After every pass the radius of each visible point shrinks and its accumulated flux is rescaled by a fixed ratio governed by a parameter alpha, chosen so that variance falls while bias also falls. In the limit both vanish, so the estimate is consistent: unlimited photons effectively contribute, but only one batch exists in memory.
Stochastic PPM extends this so that each pass also redraws the camera ray, which lets distributed effects like depth of field, motion blur and glossy surfaces work. Lookup uses a grid or hash over visible points rather than a tree of photons.
When to choose it
Reach for it when
- caustics from glass or water stay noisy
- lamp inside glass renders almost black
- photon map eats memory and still looks blotchy
- light through a pool surface needs long specular paths
- want a render that keeps refining without bias
Choose it for caustics and scenes with long specular chains (lamp inside glass, light through a pool surface) when you want an image that keeps refining without running out of memory.
Prefer Vertex Connection and Merging when the scene also has plenty of non-specular paths where connections beat merging. Prefer Unidirectional Path Tracing or Bidirectional Path Tracing when you must stay unbiased. Prefer Photon Mapping when a one-shot photon map is acceptable and you only need a quick preview.
Field marks
- Early iterations show large blur and low-frequency bias that fades slowly as the radius shrinks
- The radius reduction rate trades noise against bias; a bad `alpha` leaves visible blur or persistent noise
- Visible points are fixed per iteration, so view changes restart the render
- Hash/grid lookup performance degrades when radii vary widely across the image
Presets
Progressive Photon Mapping (PPM) — wide initial gather radius (left) vs shrinking caustic radius convergence (right)
{
"P_PPM_PASSES": 0.85,
"P_CAUSTIC_INT": 1.25,
"P_RING_SPIN": 0.55,
"P_SPLIT": 0.48
}Show GLSL (112 lines)
const float P_PPM_PASSES = 0.85; // P PPM Pass Progress [0.05, 1.0, 0.02]
const float P_CAUSTIC_INT = 1.25; // P Caustic Energy [0.3, 2.2, 0.05]
const float P_RING_SPIN = 0.55; // P Light Spin [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Wide R / Shrunk R [0.0, 1.0, 0.02]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
// Analytical gold wedding-ring cardioid caustic intensity (classic Henrik Wann Jensen PPM showcase!)
// Sharp cusp cardioid focused inside the ring on the tabletop, convolved by photon gather radius R_i
float evalCardioidCaustic(vec2 xz, float gatherR) {
// Parametric gold ring of radius 0.62 centered at origin, light coming from +X
float energy = 0.0;
// Accumulate 28 photon-hit clusters along the reflective inner ring cardioid cusp
for (int i = 0; i < 28; i++) {
float th = (float(i) / 27.0 - 0.5) * 2.55;
// Exact cardioid caustic curve of a circular mirror under parallel light:
// x = (R/4)*(3*cos(th) - cos(3*th)), z = (R/4)*(3*sin(th) - sin(3*th))
vec2 cPos = vec2(
0.165 * (3.0 * cos(th) - cos(3.0 * th)) - 0.14,
0.165 * (3.0 * sin(th) - sin(3.0 * th))
);
float d2 = dot(xz - cPos, xz - cPos);
float r2 = max(gatherR * gatherR, 0.0005);
// Normalized Epanechnikov/Gaussian photon density kernel K(d / R_i) / R_i^2
energy += exp(-d2 / r2) / (0.14 + gatherR * 12.0);
}
return energy * 0.24;
}
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 isConverged = screenX >= split;
float prog = clamp(P_PPM_PASSES, 0.05, 1.0);
float cGain = clamp(P_CAUSTIC_INT, 0.2, 2.4);
float spin = iTime * max(P_RING_SPIN, 0.0) * 0.42;
vec3 ro = vec3(0.0, 1.35, 1.85);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.46, -1.35));
vec3 bg = mix(vec3(0.022, 0.026, 0.042), vec3(0.062, 0.074, 0.112), smoothstep(-0.5, 0.5, uv.y));
vec3 col = bg;
// Raymarch the polished gold ring (hollow cylinder wall at radius 0.62, height 0.24 resting on table y=0)
float tRing = 1e5;
float t = 0.2;
for (int i = 0; i < 52; i++) {
vec3 p = ro + rd * t;
float r = length(p.xz);
float dWall = abs(r - 0.62) - 0.042;
float dY = abs(p.y - 0.14) - 0.14;
float d = max(dWall, dY);
if (d < 0.0025) { tRing = t; break; }
t += max(d * 0.85, 0.006);
if (t > 6.0) break;
}
float tTable = (rd.y < -0.01) ? (-ro.y / rd.y) : 1e5;
if (tTable < 0.05 || tTable > 10.0) tTable = 1e5;
vec3 lDir = normalize(vec3(cos(spin), 0.52, sin(spin)));
if (tRing < tTable && tRing < 1e4) {
vec3 p = ro + rd * tRing;
vec3 n;
if (abs(p.y - 0.28) < 0.01) n = vec3(0.0, 1.0, 0.0);
else n = normalize(vec3(p.x, 0.0, p.z)) * ((length(p.xz) > 0.62) ? 1.0 : -1.0);
vec3 refl = reflect(rd, n);
float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 64.0);
float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0);
vec3 gold = vec3(0.98, 0.78, 0.34);
col = gold * (0.28 + 0.65 * max(dot(n, lDir), 0.0) + 0.35 * smoothstep(-0.3, 0.6, refl.y))
+ vec3(1.0, 0.96, 0.86) * spec * 1.45 + gold * rim * 0.35;
} else if (tTable < 1e4) {
vec3 p = ro + rd * tTable;
vec2 rotXZ = rot2(-spin) * p.xz;
// Fine grained warm walnut studio tabletop
float grain = 0.5 + 0.5 * sin(p.x * 26.0 + sin(p.z * 8.0) * 1.8);
vec3 wood = mix(vec3(0.16, 0.12, 0.09), vec3(0.28, 0.21, 0.16), grain);
// Soft shadow cast by gold ring onto table
float rDist = abs(length(p.xz - lDir.xz * 0.22) - 0.62);
float ringSh = smoothstep(0.04, 0.14, rDist);
// PPM progressive radius shrinking: R_{i+1} = R_i * sqrt((N + alpha*M)/(N + M))
// Left: early pass 1 with wide biased gather radius R_0 (blurry caustic!)
// Right: converged pass N with tight shrinking radius R_N (razor-sharp cusp caustic!)
float gatherR = isConverged ? mix(0.12, 0.026, prog) : 0.16;
float caustic = evalCardioidCaustic(rotXZ, gatherR) * cGain;
// Subtle spectral gold-amber tint along caustic intensity
vec3 causticCol = mix(vec3(0.98, 0.66, 0.20), vec3(1.0, 0.96, 0.80), clamp(caustic * 0.55, 0.0, 1.0));
col = wood * (0.25 + 0.75 * ringSh) + causticCol * caustic * 1.35;
// Show sample gather-radius diagnostic circle on tabletop for visual clarity!
vec2 probe = p.xz - vec2(isConverged ? 0.22 : -0.22, 0.16);
float probeRing = exp(-abs(length(probe) - gatherR) * 110.0);
col += (isConverged ? vec3(0.22, 0.96, 0.86) : vec3(0.98, 0.36, 0.28)) * probeRing * 0.75;
col = mix(col, bg, 1.0 - exp(-tTable * 0.12));
}
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 |
|---|---|---|---|
| progressive-photon-mapping-live | Tesla T4 1920x1080 | 7.94× baseline (moderate) · 0.261 ms / 0.270 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| progressive-photon-mapping-live | NVIDIA L4 1920x1080 | 6.52× baseline (moderate) · 0.104 ms / 0.106 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| progressive-photon-mapping-live | NVIDIA A100-SXM4-40GB 1920x1080 | 5.34× baseline (light) · 0.154 ms / 0.154 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Vertex Connection and Merging.
Crosses
- Vertex Connection and Merging: VCM reuses this radius-reduction schedule for its merging half.
Sources
- primaryToshiya Hachisuka, Shinji Ogaki, Henrik Wann Jensen (2008). Progressive photon mapping. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/1409060.1409083
- tutorialMatt Pharr, Wenzel Jakob, Greg Humphreys. Stochastic Progressive Photon Mapping (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