Ωi
fr(P,Θi,Θo)Li(P,Θi)cos(θi)dωi. (2.207) Although not explicitly shown, the terms in this integral, specifically Lo, Li, Le, and fr, are wavelength-dependent. In later chapters, it is shown that human vision encodes color as a triplet of values, and therefore renderers can be optimized with little harm to sample three color bands, rather than many separate wavelengths.
This does reduce the repertoire of visual phenomena that can be rendered, though.
For instance, dispersion that occurs due to a wavelength-dependent index of re-fraction can only be modeled within a spectral renderer.
Evaluation of (2.207) is difficult in practice for several reasons. The quan-tity computed also appears as a factor under the integral. This makes (2.207) a Fredholm integral of the second kind, a type of equation that needs to be solved numerically for all but the simplest integration domains.
However, in practice, the domain of integration is over a hemisphere placed over point P which is visible by a good part of the scene. Thus, numerical inte-gration involves sampling the environment to compute the factor Li(P,Θi) for a large set of directionsΘiand then multiplying by the BRDF fr.
Since most of the environment contributes some quantity of light to the reflec-tion in point P, rendering algorithms that compute the light interacreflec-tion between a point in the scene with every other point in the scene are called global illumina-tion algorithms. Global illuminaillumina-tion soluillumina-tions differ in the way that the rendering equation is approximated, where each affords a different trade-off between ren-dering accuracy and computational cost [370, 895, 1043].
Common techniques include Monte Carlo sampling [271], ray tracing [370, 1042,1102,1242], radiosity [380,1046], and photon mapping [549]. None of these techniques currently run in real time, perhaps with the exception of ray tracing, which is on the brink of achieving interactive rates [875, 876, 1192, 1193].
2.10.1 Ray Tracing
The ray-tracing algorithm simulates the flux of light by recursively tracing rays through an environment [1242]. A view point and view plane with associated parameters is specified within the 3D environment that is to be rendered. This
serves to specify what will be visible in the image, much like holding a photo camera in a real environment determines the composition of a photograph.
Rather than start at the light sources and follow the path that photons take through the scene until they hit the view plane, the process is usually reversed and light is traced backwards from the view point through the view plane into the scene. This optimization helps reduce the number of rays that needs to be traced, as there is no guarantee that any ray started at a light source will ever reach the view plane.
When a ray hits a surface at a point P, called the intersection point, the ren-dering equation can be evaluated by sampling the environment with further (sec-ondary) rays. This sampling is potentially costly, as most of the environment would have to be sampled to determine which parts of the scene illuminated the intersection point.
To reduce the cost of sampling the environment, it is noted that some parts of the scene contribute more to the illumination of a point than others. In particular, nearby light sources that are directly visible from P are likely to contribute the bulk of illumination. Similarly, unless the material is Lambertian, light arriving from the reflected direction is more likely to contribute than that from other direc-tions. By splitting the integral in (2.207) into separate components, an efficient approximate solution can be found:
Lo(P,Θo) = Le(P,Θo) (2.208)
In this equation, the first term signifies the light emitted from point P, as before. The second term samples all the light sources directly. In it, v(P,PS) is the visibility term which equals 1 if there is a direct line of sight between P and the sample point PSon the light source. The visibility term is 0 otherwise.
In (2.208), the third term samples a small set of directions centered around the reflected direction to account for specular and possibly glossy reflection. All other light directions are not sampled, but are approximated with a constant, the fourth term in (2.208). This last term is named the ambient term. It should also be noted that the BRDF is split into a specular and diffuse component ( frspecand frdiff) for the sake of convenience.
2.10. Application: Image Synthesis 99
Figure 2.59. Diffuse inter-reflection between the rocks creates an intense orange glow; Bryce Canyon, Southern Utah. (Image courtesy of the National Park Service (http://www.nps.gov/archive/brca/photogalleryarchive.htm).)
2.10.2 Radiosity
While ray tracing is able to produce serviceable images in many applications, the approximations are such that many light paths are not sampled. For instance, light reflected from a Lambertian surface incident upon a second Lambertian surface, i.e., diffuse inter-reflection, is not accounted for. Instead, in ray tracing this com-ponent is approximated with a single constant, the fourth term in (2.208). An example of diffuse inter-reflection in nature is shown in Figure 2.59.
Under the assumption that an environment consists of Lambertian surfaces, BRDFs for all surfaces are simplified to be constant:
fr(P) =ρd(P)
π . (2.209)
The rendering equation 2.207 then simplifies to become the radiosity equation [200]:
L(P) = Le(P) (2.210)
+ρd(P) π
all P
L
P cos(Θi)cos(Θo) P− P 2 v
P,P dA,
where the integration is over differential surface areas dA. To make the solution to this equation tractable, the scene is usually subdivided into small patches Ai, where the energy associated with each patch is assumed to be constant. For a patch i this yields the following equation:
Li= Le,i+ρd,i In this equation, r is the distance between the patches i and j andδi jgives the mutual visibility between the delta areas of the patches i and j. This equation can be rewritten as Here, the form factor fi→ jis the fraction of power leaving patch i that arrives at patch j. Form factors depend solely on the geometry of the environment, i.e., the size and the shape of the elements and their orientations relative to each other.
Therefore, the radiosity method is inherently view independent. It is normally used as a preprocessing step to compute the diffuse light distribution over a scene and is followed by a rendering step that produces the final image (or sequence of images).