The Photon-Mapping Algorithm s Two-Pass Method

[ LiB ]

The Photon-Mapping Algorithm's Two-Pass Method

The photon-mapping algorithm is conducted in two passes. The two passes are as follows :

  • Photon tracing: You build the photon map structure that captures the light as it arrives at surfaces in the scene. This is done by tracing rays from the light sources to each surface.

  • Photon rendering: You render the scene using the information stored in the photon map to generate the final image. In other words, you tell the program to capture light as it leaves each surface in the scene.

The first pass traces photons from the light sources as they intersect objects in the scene. Depending on the type of object encountered , the photon might not be stored. The camera isn't taken into account when scattering photons from the light sources. The second pass uses backward ray tracing with the photon map to render the reflected radiance of each point in the field of view of the camera projected on the image plane. The camera is used in the second pass to record the reflected light from each surface in the scene. This way, the process is a simple and efficient way to mix ray tracing (the old fundamental concepts) with photon mapping. Ideally, photon mapping is a much closer relative to ray tracing as apposed to radiosity. Figure 11.1 shows an example of the two-pass method.

Figure 11.1. The two-pass method ren ders images by scatter ing photons in the scene and then render ing the scene using the scattered photons.

graphic/11fig01.gif


The major step in implementing photon mapping is to break each section into its component form. Let's take a look at what you need to do in order to implement the algorithm:

  1. Release the photons from the light sources in the scene.

  2. Process the photons at the points of intersection.

  3. Store the photons in the photon map based on a conditional state.

  4. Render the scene using the photon map.

The sections that follow describe these steps in further detail.

Tracing the Photon: The First Pass of the Algorithm

Photon tracing involves tracing individual photons from each light source as they intersect with objects in the scene. As intersections are encountered, the photon map is constructed . Photons are created from light sources, as they are in the real world. A variety of light sources can be utilized for scattering photons, including point lights, directional lights, and area lights. But for the sake of simplicity, this example uses only diffuse point lights because they are very easy to implement.

When energy is released from a light source, trillions of small energy particles (photons) are emitted to nearby objects. As the light source emits pho-tons, each photon carries a small amount of energy from the light source. The wattage (or power) of the light source is divided among the number of emitted photons. The old concept of giving a light source a wattage value isn't used anymore as previously seen in the ray-tracing applications. As pho-tons move into different regions in space they transfer energy into these areas, making the areas brighter. See Figure 11.2.

Figure 11.2. Photon scattering is a more realistic simulation of light because it closely imitates nature as it distributes light from its source.

graphic/11fig02.gif


You must simulate this concept by shooting photons from the light sources, scattering them, and tracking their movements. The simulation method is almost the same as forward ray tracing or light tracing. Note that photons accumulate energy, whereas rays just calculate the radiance. By calculating the amount of flux in the scene, you can simulate a more global effect. Photons that leave the light sources and intersect objects in the scene are called global photons. Because of photons being stored globally it would make sense to call the photon map the global photon map . Ray tracing is incomplete in the way it calculates lighting because it doesn't take other lighting effects such as indirect illumination into account when calculating the radiance. Because you are simulating natural light, you must tell the application how many photons to scatter in the scene. You must also scale down each photon's power emitted from each light source accordingly .

[ LiB ]


Focus On Photon Mapping
Focus On Photon Mapping (Premier Press Game Development)
ISBN: 1592000088
EAN: 2147483647
Year: 2005
Pages: 128
Authors: Marlon John

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net