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 hit the glass that are refracted (bent according to the index of refraction) by the glass and focussed 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 colour.
With photon mapping (most often used in conjunction with ray tracing) light packets (photons) are sent out into the scene from the light source (reverse ray tracing) and whenever they intersect with a surface, the 3d coordinate of the intersection is stored in the cache (also called the photon map) as well as the incoming direction and the energy of the photon. 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 pre-defined number of bounces, in order to save time.
Also to save time, the direction of the outgoing rays is often constrained. Instead of simply sending out photons in random directions (a waste of time), we send them in the direction of a known object that we wish to use as a photon-manipulator to either focus or diffuse the light.
This is generally a pre-process 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 more common equation (eg. Whitted and Hall etc.)
There are many refinements that can be made to the algorithm, like deciding where to send the photons, how many to send and in what pattern.
This method can result in extremely realistic images if implemented correctly.
The pioneer of this method is Henrik Wann Jensen. [1]