# Photon Mapping in a Nutshell

So, Photon Mapping: What is it, and how does it work?

First, lets look at the basic physics of Light that lay as a foundation to the physical rendering techniques we are exploring. The Optics subfield Radiometry is the physics of measuring electromagnetic radiation, including visible light that we are concerned with:

Flux is radiant energy per unit time, or radiant power, denoted by . It’s the amount of energy flowing across a surface over time and is expressed in terms of watt:

Irradiance is the amount of incident radiant power that hits a surface per unit surface area:

Radiance is the amount of light from within some solid angle : The Bidirectional Reflectance Distribution Function (BRDF), , is a function describing how light is reflected as some surface point x. It returns the ratio of reflected radiance along from the incident radiance from : The Rendering Equation is our last piece of the puzzle. Intuitively, this equation describes how much light some surface point will receive and reflect in the eye direction. One particularly useful form of the equation is the hemispherical formulation:

where is integration over the hemisphere above point . ## Photon Mapping

Lets go on and look at the Photon Mapping algorithm! The algorithm is done in two stages: the photon tracing simulates the emission of photons and how they bounce in the scene, and (2) the photon gathering is the process of calculating a radiance estimate in some point with help of photons in the neighborhood of .

### Photon Emission

In this step, a number of photons is emitted from each light, the direction and intensity dependent on the light source itself and the total number of photons that are emitted. Furthermore, a method of storing the photons that are bounced in the scene is needed. This data structure is called the photon map and is typically a Point Hash-Grid or a KD-Tree.

If we have photons that should be emitted. The probability, , that a photon is emitted at some emitter, , is proportional to the relative power of :

where is the radiant flux of of emitter averaged over all frequencies.

The power, , of the emitted photon, , is:

The photon is put at position and is sent along the ray:

## Photon Tracing

Each photon, , is emitted from some light source along . The photon will now be traced through the scene and bounce, , times. At each surface a copy of the photon is stored in the photon map. It will then either scatter or be absorbed, using the principle of Russian Roulette.

If the photon in scattered, a new direction is calculated with importance sampling with respect to the surface BRDF.

## Photon Gathering

Consider we are looking at a point from the (eye) direction . The goal of the photon gathering is to use the photons stored in the photon map to calculate an radiance estimate at ; we want to approximate the rendering equation at . The radiance can be estimated with the following radiance estimate:

The photon map is used to find the photons in the neighborhood of . One way to do this is to always look at a constant neighborhood, for instance a sphere, and see how many photons we found. Another, better, way is to iterate outwards until we find photons. The photons that are found are used for the radiance estimate.

## References

http://www.cs.dartmouth.edu/~wjarosz/publications/dissertation/chapter2.pdf

http://web.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/photon_mapping/PhotonMapping.html

http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function

http://graphics.cs.williams.edu/courses/cs371/f12/files/4-PhotonMap.pdf

//Philip & Axel