• No results found

The rendering equation

2.2 Target implementation technology

2.3.2 The rendering equation

An ideal pinhole camera (Figure 2.5) measures the flux arriving on the image plane at the location p for each pixel, potentially sampled in order to improve image quality or

Image

Plane Pinhole Object

Figure 2.5: Image formation with an ideal pinhole camera. For every pixelpin the image, the radiance arriving at the eye-point e from x in the direction ~ωp must be computed.

Li(e, ~ωp) =Lo(x,−~ωp)

enable additional visual effects. Because the pinhole allows only one ray of light to reach any point on the image plane, it is the incident radiance, Li(p, ~ωp), that is measured.

By the invariance of radiance, this is the same radiance passing through the pinhole, at position e, along the same ray~ωp. The position e is commonly referred to as the camera

location or eye-point. The ray originating at e in the direction ~ωp is called an eye-ray.

Each eye-ray must be intersected with the scene to find the first intersection point,

x, Although the majority of graphics hardware uses rasterization to resolve visibility, ray-casting is now a practical approach, even for interactive applications (Section 2.5). Once the intersection has been found, the invariance of radiance can be used to determine the incident radiance at the eye, and hence on the image plane, in terms of the exitant

Pre-condition: e is the location of the eye (camera)

Pre-condition: Any per-scene or per-image pre-procesing has been performed for each pixel (u, v) of the imagedo

for each sample do image(u, v)←0

// Form the eye-ray (e, ~ωp)

p← sampled location on the image plane of pixel (u, v)

~

ωp ←(e−p)

// Use ray-casting to find the closest intersection in the scene

x←intersect with scene(e, ~ωp)

// ComputeLi(e, ~ωp) based on Lo(x,−~ωp)

image(u, v)←compute exitant radiance(x,−~ωp)

end for

image(u, v)←image(u, v)/(# samples) end for

Post-condition: image = the generated image

Algorithm 2.1: The pixel-driven rendering algorithm, adapted from (Dutr´e et al., 2003). The quality of a generated image depends on the exact implementation of the method compute exitant radiance().

radiance at x back along~ωp.

Li(p, ~ωp) = Li(e, ~ωp) =Lo(x,−ω~p)

Algorithm 2.1 provides a high-level view of this process, deferring for the moment how the exitant radiance, Lo, is computed.

The exitant radiance at x towards the eye, or any other point in the scene viewed from a particular direction, is the sum of the reflected, refracted and locally emitted radiance. The emitted radiance, Le, is computed directly from the description of the

object containing x. For most surfaces, the value is uniformly zero. The amount of light that is reflected and refracted towards the viewer, however is more complicated. It depends on both the light that arrives on the surface, from all directions, and the specific material properties of the surface. When a ray of light lands on an object at a particular point, z, from a particular direction, ~ωi, the energy will either be absorbed, or emitted

from a potentially different point, z0, in a potentially different direction, ~ωo. When

restricted to reflection2 this is known as the Bidirectional Scattering Surface Reflectance Distribution Function (BSSRDF) and has eight dimensions (Nicodemus et al., 1977).

Nicodemus also introduced a simplification of the BSSRDF where reflected light is assumed to be emitted from the same location where it landed (z0 =z). The Bidirectional Reflectance Distribution Function (BRDF) is denoted as

fr(z, ~ωi, ~ωo) =

dLr(z, ~ωo)

Li(z, ~ωi)(ω~i•~n)d~ωi

where ~ωo is towards the viewer, ~ωi is the direction from which the incoming light is

arriving, ~n is the local surface normal at z, Lr is the reflected radiance towards the

viewer, and (ω~i•~n) represents the foreshortening due to the two surfaces not necessarily

being parallel. Although this formulation precludes the representation of some desired visual effects, such as the sub-surface scattering seen in white marble statues, it can be computed without additional expensive pre-computation.

The perfectly specular BRDF, an ideal mirror, reflects the incoming light energy only along the reflected angle and is a special case. The BRDF of a more general surface will reflect some portion of the incoming light to the entire hemisphere of visible directions. Purely diffuse surfaces reflect the light evenly, while glossy surfaces exhibit a behavior between that of ideal specular and diffuse reflectors. Some examples of common BRDFs are illustrated in Figure 2.6. Global illumination algorithms differ in the BRDFs that they efficiently support.

The concepts of incident, reflected and emitted radiance and the BRDF are united in the rendering equation (Kajiya, 1986) using an integral with a domain of the hemisphere,

2Refraction can be analyzed in a symmetric fashion to reflection. For clarity, refraction is not con-

Figure 2.6: Examples of common BRDF classifications. The purely diffuse BRDF reflects light from all directions equally towards the viewer, while the highly specular surface, an ideal mirror, reflects only the light from a single direction. In between, glossy surfaces reflect light from all directions, but weigh those that come near the angle of specular reflection more heavily.

Ω, of incoming radiance at z and shown in Equation 2.1.

Lr(z, ~ωo) =Le(z, ~ωo) +

Z

fr(z, ~ωi, ~ωo)Li(z, ~ωi)(~ωi•~n)d ~ωi (2.1)

There are several interesting characteristics of the rendering equation. The first is that it isrecursive, the light that reflects from z is dependent on the light that arrives atz from other surfaces, but that is in turn dependent on how much light lands on those other surfaces. Every global illumination algorithm based on the rendering equation must find a way to terminate this recursion in order to guarantee that the algorithm will halt. Secondly, the key operation while rendering an image is a continuous integration. In all but the most trivial of scenes, the integral can not be solved analytically. Both of these challenges must be addressed, in an implementation of compute exitant radiance(), before the rendering equation can be used to generate an image.