Skip to content
SpecializedSource checked

Photon Mapping

Simulates global illumination by tracing photons from light sources.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Advanced
Family
Global Illumination
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
2
Code example
Not ready
Visualization
Ready

Overview

Photon Mapping stores light particles where they hit surfaces, then estimates illumination from nearby stored photons.

Core Concepts

rendered imagelight transportlight contributionglobal illuminationscene representationvisibility testpixel output

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(p log n)

Average

O((p + s) log n)

Worst

O((p + s) log n)

Space

O(s)

When to Use

  • Use Photon Mapping when you need to trace photons from lights.
  • Use it for caustics with inputs like scene.
  • Use it when the scene representation and quality target match the rendering tradeoff.
  • Use it when the Global Illumination tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when the cost per pixel or sample is too high for the desired frame rate.
  • Avoid it when the required output is not rendered image with indirect lighting.

What It Does

  • Traces photons from lights
  • Estimates radiance from a photon map

Use Cases

  • Caustics
  • Global illumination
  • Offline rendering

Inputs

  • Scene
  • Lights
  • Photon count

Outputs

  • Rendered image with indirect lighting

Key Formulas (1)

Radiance estimate

radiance approx ∑(photonflux) / (π · searchradius2)
radiance approx sum(photon_flux) / (pi * search_radius^2)

Estimates local illumination from photons found near the shading point.

Pseudocode

  1. 1.Emit photons from light sources
  2. 2.Trace photon bounces through the scene
  3. 3.Store photon hits in a spatial index
  4. 4.Trace camera rays
  5. 5.Estimate lighting from nearby photons

Canonical Example

Input
scene = one triangle, one camera, one light
Output
image pixels showing the visible triangle
Explanation
Photon Mapping: The algorithm converts scene data into visible pixel results.

Implementation Notes

  • Keep the input contract explicit: Scene; Lights; Photon count.
  • Use this step as the implementation spine: Emit photons from light sources.
  • Then preserve the next state change: Trace photon bounces through the scene.
  • Build tiny scenes with known geometry before testing complex materials or lighting.

Common Pitfalls

  • Photon Mapping is especially useful for focused light effects such as caustics.
  • Ignoring coordinate spaces, depth precision, or sampling noise while debugging image artifacts.
  • Returning rendered image with indirect lighting without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show photons scattering from lights and gathering near surfaces.

Photon Mapping mechanism walkthrough step 1 of 5
Step 1 of 5: Emit photons from light sources
photon-map

Notes

Photon Mapping operates in O((p + s) log n) time and O(s) space within the Global Illumination family. Key governing relation: radiance approx sum(photon_flux) / (pi * search_radius^2). Often compared with Path Tracing and Ray Tracing.

Sources (1)

What each reference supports for this entry.

Jensen Photon Mapping

Paper

Original photon mapping paper describing two-pass global illumination with photon maps.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Photon maps are commonly queried with spatial data structures such as k-d trees.

Alternative toPath Tracing

Photon mapping estimates light transport through photon density rather than pure path sampling.

Related Algorithms

Tags

GraphicsGlobal IlluminationLighting