All Topics  
Photon mapping

 
Photon Mapping

   Email Print
   Bookmark   Link






 

Photon mapping



 
 
In computer graphics
Computer graphics

Computer graphics are graphics created by computers and, more generally, the representation and manipulation of pictorial data by a computer....
, photon mapping is a two-pass global illumination
Global illumination

Global illumination is a general name for a group of algorithms used in 3D computer graphics that are meant to add more realistic lighting to 3D scenes....
 algorithm developed by Henrik Wann Jensen
Henrik Wann Jensen

Henrik Wann Jensen is a Denmark computer graphics researcher. He is best known for developing the photon mapping technique as the subject of his PhD thesis, but has also done important research in simulating subsurface scattering and the sky....
 that solves the rendering equation
Rendering equation

In computer graphics, the rendering equation is an integral equation in which the equilibrium radiance leaving a point is given as the sum of emitted plus reflected radiance under a geometric optics approximation....
. Rays
Ray tracing

In computer graphics, ray tracing is a technique for generating an digital image by tracing the path of light through pixel in an . The technique is capable of producing a very high degree of photorealism; usually higher than that of typical scanline rendering methods, but at a greater computation time....
 from the light source and rays from the camera are traced independently until some termination criterion is met, then they are connected in a second step to produce a radiance
Radiance

Radiance and spectral radiance are radiometry measures that describe the amount of light that passes through or is emitted from a particular area, and falls within a given solid angle in a specified direction....
 value. It is used to realistically simulate the interaction of light
Light

Light, or visible light, is electromagnetic radiation of a wavelength that is Visible spectrum to the human eye , or up to 380?750 nm. In the broader field of physics, light is sometimes used to refer to electromagnetic radiation of all wavelengths, whether visible or not....
 with different objects. Specifically, it is capable of simulating the refraction of light through a transparent substance such as glass or water, diffuse interreflection between illuminated objects, the subsurface scattering
Subsurface scattering

Subsurface scattering is a mechanism of light transport in which light penetrates the surface of a translucent object, is scattering by interacting with the material, and exits the surface at a different point....
 of light in translucent materials, and some of the effects caused by particulate matter such as smoke or water vapor.






Discussion
Ask a question about 'Photon mapping'
Start a new discussion about 'Photon mapping'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computer graphics
Computer graphics

Computer graphics are graphics created by computers and, more generally, the representation and manipulation of pictorial data by a computer....
, photon mapping is a two-pass global illumination
Global illumination

Global illumination is a general name for a group of algorithms used in 3D computer graphics that are meant to add more realistic lighting to 3D scenes....
 algorithm developed by Henrik Wann Jensen
Henrik Wann Jensen

Henrik Wann Jensen is a Denmark computer graphics researcher. He is best known for developing the photon mapping technique as the subject of his PhD thesis, but has also done important research in simulating subsurface scattering and the sky....
 that solves the rendering equation
Rendering equation

In computer graphics, the rendering equation is an integral equation in which the equilibrium radiance leaving a point is given as the sum of emitted plus reflected radiance under a geometric optics approximation....
. Rays
Ray tracing

In computer graphics, ray tracing is a technique for generating an digital image by tracing the path of light through pixel in an . The technique is capable of producing a very high degree of photorealism; usually higher than that of typical scanline rendering methods, but at a greater computation time....
 from the light source and rays from the camera are traced independently until some termination criterion is met, then they are connected in a second step to produce a radiance
Radiance

Radiance and spectral radiance are radiometry measures that describe the amount of light that passes through or is emitted from a particular area, and falls within a given solid angle in a specified direction....
 value. It is used to realistically simulate the interaction of light
Light

Light, or visible light, is electromagnetic radiation of a wavelength that is Visible spectrum to the human eye , or up to 380?750 nm. In the broader field of physics, light is sometimes used to refer to electromagnetic radiation of all wavelengths, whether visible or not....
 with different objects. Specifically, it is capable of simulating the refraction of light through a transparent substance such as glass or water, diffuse interreflection between illuminated objects, the subsurface scattering
Subsurface scattering

Subsurface scattering is a mechanism of light transport in which light penetrates the surface of a translucent object, is scattering by interacting with the material, and exits the surface at a different point....
 of light in translucent materials, and some of the effects caused by particulate matter such as smoke or water vapor. It can also be extended to more accurate simulations of light such as spectral rendering
Spectral rendering

In computer graphics, spectral rendering is where a scene's light transport is modeled with real wavelengths. This process is typically a lot slower than traditional rendering, which renders the scene in its red, green, and blue components and then overlays the images....
.

Unlike Path tracing
Path Tracing

Path tracing is a photorealistic computer graphics rendering technique by James Kajiya when he presented his paper on the rendering equation in the 1980s....
, Bidirectional path tracing and Metropolis light transport
Metropolis light transport

This SIGGRAPH 1997 paper by Eric Veach and Leonidas J. Guibas describes an application of a variant of the Monte Carlo method called the Metropolis-Hastings algorithm to the rendering equation for generating images from detailed physical descriptions of three dimensional scenes....
, Photon Mapping is a "biased" rendering algorithm, which means that averaging many renders using this method does not converge to a correct solution to the Rendering equation
Rendering equation

In computer graphics, the rendering equation is an integral equation in which the equilibrium radiance leaving a point is given as the sum of emitted plus reflected radiance under a geometric optics approximation....
. However, since it is a consistent method, a correct solution can be achieved by increasing the number of photons.

Effects


Caustics


Caustics
The effects of the refraction of light through a transparent medium are called caustics. A caustic
Caustic (optics)

In optics, a caustic is the envelope of light rays Reflection or refraction by a curved surface or object, or the Projection of that envelope of rays on another surface....
 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. For example, as light rays pass through a glass of wine sitting on a table and the liquid it contains, they are refracted
Refraction

Refraction is the change in direction of a wave due to a change in its speed. This is most commonly observed when a wave passes from one optical medium to another....
 and focused on the table the glass is standing on. The wine also changes the pattern and color of the light.

Diffuse interreflection


Diffuse interreflection is apparent when light from one diffuse object is reflected onto another. Photon mapping is particularly adept at handling this effect because the algorithm reflects photons from one surface to another based on that surface's bidirectional reflectance distribution function
Bidirectional reflectance distribution function

The bidirectional reflectance distribution function is a 4-dimensional function that defines how light is reflected at an opaque surface. The function takes an incoming light direction, , and outgoing direction, , both defined with respect to the surface normal , and returns the ratio of reflected radiance exiting along to the irradiance...
 (BRDF), and thus light from one object striking another is a natural result of the method. Diffuse interreflection was first modeled using radiosity
Radiosity

Radiosity is a global illumination algorithm used in 3D computer graphics rendering . Radiosity is an application of the finite element method to solving the rendering equation for scenes with purely diffuse surfaces....
 solutions. Photon mapping differs though in that it separates the light transport from the nature of the geometry in the scene. Color bleed
Color bleeding (computer graphics)

In computer graphics and 3D rendering, color bleeding is the phenomenon in which objects or surfaces are colored by reflection of colored light from nearby surfaces....
 is an example of diffuse interreflection.

Subsurface scattering


Subsurface scattering
Subsurface scattering

Subsurface scattering is a mechanism of light transport in which light penetrates the surface of a translucent object, is scattering by interacting with the material, and exits the surface at a different point....
 is the effect evident when light enters a material and is scattered before being absorbed or reflected in a different direction. Subsurface scattering can accurately be modeled using photon mapping. This was the original way Jensen implemented it; however, the method becomes slow for highly scattering materials, and bidirectional surface scattering reflectance distribution functions (BSSRDFs) are more efficient in these situations.

Usage


Construction of the photon map (1st pass)


With photon mapping, light packets called photons are sent out into the scene from the light sources. Whenever a photon intersects with a surface, the intersection point and incoming direction are stored in a cache called the photon map. Typically, two photon maps are created for a scene: one especially for caustics and a global one for other light. After intersecting the surface, a probability for either reflecting, absorbing, or transmitting/refracting is given by the material. A Monte Carlo method
Monte Carlo method

Monte Carlo methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo methods are often used when computer simulation physics and mathematics systems....
 called Russian roulette is used to choose one of these actions. If the photon is absorbed, no new direction is given, and tracing for that photon ends. If the photon reflects, the surface's BRDF is used to determine a new direction. Finally, if the photon is transmitting, a different function for its direction is given depending upon the nature of the transmission.

Once the photon map is constructed (or during construction), it is typically arranged in a manner that is optimal for the k-nearest neighbor algorithm
K-nearest neighbor algorithm

In pattern recognition, the k-nearest neighbors algorithm is a method for statistical classification objects based on closest training examples in the feature space....
, as photon look-up time depends on the spatial distribution of the photons. Jensen advocates the usage of kd-tree
Kd-tree

In computer science, a kd-tree is a space partitioning data structure for organizing Point s in a k-dimensional Euclidean space. kd-trees are a useful data structure for several applications, such as searches involving a multidimensional search key ....
s. The photon map is then stored on disk or in memory for later usage.

Rendering (2nd pass)


In this step of the algorithm, the photon map created in the first pass is used to estimate the radiance of every pixel of the output image. For each pixel, the scene is ray traced until the closest surface of intersection is found.

At this point, the rendering equation
Rendering equation

In computer graphics, the rendering equation is an integral equation in which the equilibrium radiance leaving a point is given as the sum of emitted plus reflected radiance under a geometric optics approximation....
 is used to calculate the surface radiance leaving the point of intersection in the direction of the ray that struck it. To facilitate efficiency, the equation is decomposed into four separate factors: direct illumination, specular reflection, caustics, and soft indirect illumination.

For an accurate estimate of direct illumination, a ray is traced from the point of intersection to each light source. As long as a ray does not intersect another object, the light source is used to calculate the direct illumination. For an approximate estimate of indirect illumination, the photon map is used to calculate the radiance contribution.

Specular reflection can be, in most cases, calculated using ray tracing procedures (as it handles reflections well).

The contribution to the surface radiance from caustics is calculated using the caustics photon map directly. The number of photons in this map must be sufficiently large, as the map is the only source for caustics information in the scene.

For soft indirect illumination, radiance is calculated using the photon map directly. This contribution, however, does not need to be as accurate as the caustics contribution and thus uses the global photon map.

Calculating radiance using the photon map

In order to calculate surface radiance at an intersection point, one of the cached photon maps is used. The steps are:

  1. Gather the N nearest photons using the nearest neighbor search function on the photon map.
  2. Let S be the sphere that contains these N photons.
  3. For each photon, divide the amount of flux (real photons) that the photon represents by the area of S and multiply by the BRDF applied to that photon.
  4. The sum of those results for each photon represents total surface radiance returned by the surface intersection in the direction of the ray that struck it.


Optimizations


  • To avoid emitting unneeded photons, the initial direction of the outgoing photons is often constrained. Instead of simply sending out photons in random directions, they are sent in the direction of a known object that is a desired photon manipulator to either focus or diffuse the light. There are many other refinements that can be made to the algorithm: for example, choosing the amount of photons to send, and where and in what pattern to send them. It would seem that emitting more photons in a specific direction would cause a higher density of photons to be stored in the photon map around the position where the photons hit, and thus measuring this density would give an inaccurate value for irradiance
    Irradiance

    Irradiance, radiant emittance, and radiant exitance are radiometry terms for the power of electromagnetic radiation at a surface, per unit area....
    . This is true; however, the algorithm used to compute radiance
    Radiance

    Radiance and spectral radiance are radiometry measures that describe the amount of light that passes through or is emitted from a particular area, and falls within a given solid angle in a specified direction....
     does not depend on irradiance estimates.


  • For soft indirect illumination, if the surface is Lambertian, then a technique known as irradiance caching may be used to interpolate values from previous calculations.


  • To avoid unnecessary collision testing in direct illumination, shadow photons can be used. During the photon mapping process, when a photon strikes a surface, in addition to the usual operations performed, a shadow photon is emitted in the same direction the original photon came from that goes all the way through the object. The next object it collides with causes a shadow photon to be stored in the photon map. Then during the direct illumination calculation, instead of sending out a ray from the surface to the light that tests collisions with objects, the photon map is queried for shadow photons. If none are present, then the object has a clear line of sight to the light source and additional calculations can be avoided.


  • To optimize image quality, particularly of caustics, Jensen recommends use of a cone filter. Essentially, the filter gives weight to photons' contributions to radiance depending on how far they are from ray-surface intersections. This can produce sharper images.


Variations


  • In the 1st pass of photon mapping, an alternative to using Russian roulette to determine direction is to give each photon an "energy" attribute. Each time the photon collides with an object, this attribute is also stored in the photon map. The energy is subsequently then lowered. Once the energy of the photon is below a certain pre-determined threshold, the photon stops reflecting.


  • Although photon mapping was designed to work primarily with ray tracers, it can also be extended for use with scanline renderers
    Scanline rendering

    Scanline rendering is an algorithm for Hidden surface determination#Visible surface determination, in 3D computer graphics,that works on a row-by-row basis rather than a polygon-by-polygon or pixel-by-pixel basis....
    .


External links


  • ISBN 1-56881-147-0
  • from [Worcester Polytechnic Institute]