In computer graphics, photon mapping is a global illumination algorithm based on ray tracing used to realistically simulate the interaction of light with different objects. Specifically, it is capable of simulating the refraction of light through a transparent substance, such as glass or water, diffuse interreflections between illuminated objects, and some of the effects caused by particulate matter such as smoke or water vapor. It was developed by Henrik Wann Jensen.
In the context of the refraction of light through a transparent medium, the desired effects are called caustics. A caustic is a pattern of light that is focused on a surface after having had the original path of light rays bent by an intermediate surface. An example is a glass of wine on a table. As light rays pass through the glass and the liquid, they are refracted and focused on the table the glass is standing on. The wine in the glass also produces interesting effects, changing the pattern of light as well as its color.
With photon mapping, light packets (photons) are sent out into the scene from the light source. Whenever a photon intersects with a surface, the intersection point, incoming direction, and energy of the photon are stored in a cache called the photon map. As each photon is bounced or refracted by intermediate surfaces, the energy gets absorbed until no more is left. We can then stop tracing the path of the photon. Often we stop tracing the path after a predefined number of bounces in order to save time.
Another technique is to send out groups of photons instead of individual photons. In this case, each group of photons always has the same energy, thus the photon map need not store energy. When a group intersects with a surface, it is either completely transmitted or completely absorbed. This is a Monte Carlo method called Russian roulette.
To avoid emitting unneeded photons, the direction of the outgoing rays is often constrained. Instead of simply sending out photons in random directions, they are sent in the direction of a known object that we wish to use as a photon manipulator to either focus or diffuse the light. There are many other refinements that can be made to the algorithm like deciding how many photons to send, and where and in what pattern to send them.
Photon mapping is generally a preprocess and is carried out before the main rendering of the image. Often the photon map is stored on disk for later use. Once the actual rendering is started, every intersection of an object by a ray is tested to see if it is within a certain range of one or more stored photons and if so, the energy of the photons is added to the energy calculated using a standard illumination equation. The slowest part of the algorithm is searching the photon map for the nearest photons to the point being illuminated.
- Realistic Image Synthesis Using Photon Mapping ISBN 1568811470
- Photon mapping introduction from Worcester Polytechnic Institute