{
 "id": "progressive-photon-mapping",
 "title": "Progressive Photon Mapping",
 "aliases": [
  "PPM",
  "SPPM"
 ],
 "domain": "gi",
 "subdomain": "Density-estimation light transport",
 "stage": "lighting",
 "realtime": "interactive",
 "platforms": [
  "cpu",
  "cuda",
  "desktop-gpu"
 ],
 "year_introduced": 2008,
 "inputs": [
  "mesh",
  "material-params"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "static",
 "summary": "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.",
 "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.\n\nAfter 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.\n\n**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_use": "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.\n\nPrefer [vertex-connection-and-merging](vertex-connection-and-merging) when the scene also has plenty of non-specular paths where connections beat merging. Prefer [path-tracing](path-tracing) or [bidirectional-path-tracing](bidirectional-path-tracing) when you must stay unbiased. Prefer [photon-mapping](photon-mapping) when a one-shot photon map is acceptable and you only need a quick preview.",
 "cost": {
  "class": "offline",
  "notes": "One light-tracing pass per iteration plus a grid lookup per photon hit; memory is proportional to the number of visible points (pixels), not photons."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/1409060.1409083",
   "type": "paper",
   "title": "Progressive photon mapping",
   "authors": [
    "Toshiya Hachisuka",
    "Shinji Ogaki",
    "Henrik Wann Jensen"
   ],
   "year": 2008,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/1409060.1409083",
   "ids": {
    "doi": "10.1145/1409060.1409083"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1409060.1409083",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1409060.1409083",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1409060.1409083",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1409060.1409083",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1409060.1409083",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "hachisuka2008progressive"
  },
  {
   "role": "tutorial",
   "key": "url:https://pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping",
   "type": "tutorial",
   "title": "Stochastic Progressive Photon Mapping (Physically Based Rendering, 3rd edition)",
   "authors": [
    "Matt Pharr",
    "Wenzel Jakob",
    "Greg Humphreys"
   ],
   "year": null,
   "venue": "pbr-book.org",
   "url": "https://pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260728205317/https://www.pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping",
     "timestamp": "20260728205317"
    },
    "page_title": "Stochastic Progressive Photon Mapping",
    "host": "pbr-book.org",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Stochastic_Progressive_Photon_Mapping → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0.95,
   "__bib": "pharrstochastic"
  },
  {
   "role": "implementation",
   "key": "gh:mmp/pbrt-v3",
   "type": "code",
   "title": "mmp/pbrt-v3",
   "description": "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.",
   "authors": [
    "mmp"
   ],
   "year": 2015,
   "venue": "GitHub",
   "url": "https://github.com/mmp/pbrt-v3",
   "ids": {
    "repo": "mmp/pbrt-v3"
   },
   "license": "BSD-2-Clause",
   "extra": {
    "stars": 5094,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2023-09-03T11:38:00Z",
    "language": "C++",
    "homepage": "http://pbrt.org",
    "license_name": "BSD 2-Clause \"Simplified\" License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mmp/pbrt-v3",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "mmp2015pbrt"
  }
 ],
 "presets": [
  {
   "id": "progressive-photon-mapping-live",
   "title": "Progressive Photon Mapping (PPM) — wide initial gather radius (left) vs shrinking caustic radius convergence (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_PPM_PASSES": 0.85,
    "P_CAUSTIC_INT": 1.25,
    "P_RING_SPIN": 0.55,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_PPM_PASSES = 0.85; // P PPM Pass Progress [0.05, 1.0, 0.02]\nconst float P_CAUSTIC_INT = 1.25; // P Caustic Energy [0.3, 2.2, 0.05]\nconst float P_RING_SPIN = 0.55; // P Light Spin [0.0, 2.2, 0.05]\nconst float P_SPLIT = 0.48; // P Wide R / Shrunk R [0.0, 1.0, 0.02]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\n// Analytical gold wedding-ring cardioid caustic intensity (classic Henrik Wann Jensen PPM showcase!)\n// Sharp cusp cardioid focused inside the ring on the tabletop, convolved by photon gather radius R_i\nfloat evalCardioidCaustic(vec2 xz, float gatherR) {\n  // Parametric gold ring of radius 0.62 centered at origin, light coming from +X\n  float energy = 0.0;\n  // Accumulate 28 photon-hit clusters along the reflective inner ring cardioid cusp\n  for (int i = 0; i < 28; i++) {\n    float th = (float(i) / 27.0 - 0.5) * 2.55;\n    // Exact cardioid caustic curve of a circular mirror under parallel light:\n    // x = (R/4)*(3*cos(th) - cos(3*th)), z = (R/4)*(3*sin(th) - sin(3*th))\n    vec2 cPos = vec2(\n      0.165 * (3.0 * cos(th) - cos(3.0 * th)) - 0.14,\n      0.165 * (3.0 * sin(th) - sin(3.0 * th))\n    );\n    float d2 = dot(xz - cPos, xz - cPos);\n    float r2 = max(gatherR * gatherR, 0.0005);\n    // Normalized Epanechnikov/Gaussian photon density kernel K(d / R_i) / R_i^2\n    energy += exp(-d2 / r2) / (0.14 + gatherR * 12.0);\n  }\n  return energy * 0.24;\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool isConverged = screenX >= split;\n  float prog = clamp(P_PPM_PASSES, 0.05, 1.0);\n  float cGain = clamp(P_CAUSTIC_INT, 0.2, 2.4);\n  float spin = iTime * max(P_RING_SPIN, 0.0) * 0.42;\n\n  vec3 ro = vec3(0.0, 1.35, 1.85);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.46, -1.35));\n  vec3 bg = mix(vec3(0.022, 0.026, 0.042), vec3(0.062, 0.074, 0.112), smoothstep(-0.5, 0.5, uv.y));\n  vec3 col = bg;\n\n  // Raymarch the polished gold ring (hollow cylinder wall at radius 0.62, height 0.24 resting on table y=0)\n  float tRing = 1e5;\n  float t = 0.2;\n  for (int i = 0; i < 52; i++) {\n    vec3 p = ro + rd * t;\n    float r = length(p.xz);\n    float dWall = abs(r - 0.62) - 0.042;\n    float dY = abs(p.y - 0.14) - 0.14;\n    float d = max(dWall, dY);\n    if (d < 0.0025) { tRing = t; break; }\n    t += max(d * 0.85, 0.006);\n    if (t > 6.0) break;\n  }\n\n  float tTable = (rd.y < -0.01) ? (-ro.y / rd.y) : 1e5;\n  if (tTable < 0.05 || tTable > 10.0) tTable = 1e5;\n\n  vec3 lDir = normalize(vec3(cos(spin), 0.52, sin(spin)));\n\n  if (tRing < tTable && tRing < 1e4) {\n    vec3 p = ro + rd * tRing;\n    vec3 n;\n    if (abs(p.y - 0.28) < 0.01) n = vec3(0.0, 1.0, 0.0);\n    else n = normalize(vec3(p.x, 0.0, p.z)) * ((length(p.xz) > 0.62) ? 1.0 : -1.0);\n    vec3 refl = reflect(rd, n);\n    float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 64.0);\n    float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0);\n    vec3 gold = vec3(0.98, 0.78, 0.34);\n    col = gold * (0.28 + 0.65 * max(dot(n, lDir), 0.0) + 0.35 * smoothstep(-0.3, 0.6, refl.y))\n        + vec3(1.0, 0.96, 0.86) * spec * 1.45 + gold * rim * 0.35;\n  } else if (tTable < 1e4) {\n    vec3 p = ro + rd * tTable;\n    vec2 rotXZ = rot2(-spin) * p.xz;\n\n    // Fine grained warm walnut studio tabletop\n    float grain = 0.5 + 0.5 * sin(p.x * 26.0 + sin(p.z * 8.0) * 1.8);\n    vec3 wood = mix(vec3(0.16, 0.12, 0.09), vec3(0.28, 0.21, 0.16), grain);\n    // Soft shadow cast by gold ring onto table\n    float rDist = abs(length(p.xz - lDir.xz * 0.22) - 0.62);\n    float ringSh = smoothstep(0.04, 0.14, rDist);\n\n    // PPM progressive radius shrinking: R_{i+1} = R_i * sqrt((N + alpha*M)/(N + M))\n    // Left: early pass 1 with wide biased gather radius R_0 (blurry caustic!)\n    // Right: converged pass N with tight shrinking radius R_N (razor-sharp cusp caustic!)\n    float gatherR = isConverged ? mix(0.12, 0.026, prog) : 0.16;\n    float caustic = evalCardioidCaustic(rotXZ, gatherR) * cGain;\n\n    // Subtle spectral gold-amber tint along caustic intensity\n    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));\n    col = wood * (0.25 + 0.75 * ringSh) + causticCol * caustic * 1.35;\n\n    // Show sample gather-radius diagnostic circle on tabletop for visual clarity!\n    vec2 probe = p.xz - vec2(isConverged ? 0.22 : -0.22, 0.16);\n    float probeRing = exp(-abs(length(probe) - gatherR) * 110.0);\n    col += (isConverged ? vec3(0.22, 0.96, 0.86) : vec3(0.98, 0.36, 0.28)) * probeRing * 0.75;\n\n    col = mix(col, bg, 1.0 - exp(-tTable * 0.12));\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "progressive-photon-mapping",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T20:35:55.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4796,
      "std": 0.1777,
      "min": 0.1778,
      "max": 0.9798
     },
     "image": "/specimens/progressive-photon-mapping-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "photon-mapping",
  "vertex-connection-and-merging",
  "path-tracing"
 ],
 "extends": [
  "photon-mapping"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "vertex-connection-and-merging",
   "why": "VCM reuses this radius-reduction schedule for its merging half."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/gi/progressive-photon-mapping.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Hachisuka et al., 2008",
 "url": "https://texelatlas.vercel.app/t/progressive-photon-mapping/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 7.94,
  "tier": "moderate",
  "p50_ms": 0.2611,
  "p95_ms": 0.2697,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "progressive-photon-mapping-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 6.52,
   "tier": "moderate",
   "p50_ms": 0.1037,
   "p95_ms": 0.1057,
   "speedup_x": 2.52,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 5.34,
   "tier": "light",
   "p50_ms": 0.1539,
   "p95_ms": 0.1543,
   "speedup_x": 1.7,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}