8
52 Chapter 17: Rendering
materials display some degree of both specular
and diffuse reflection.
Left: Specular re flection
Right: Diffuse reflection
The way in which the photons are reflected from a
surface depends primarily on the smoothness of
the surface. R ough surfaces tend to reflect photons
in all directions. These are known as diffuse
surfaces, and this type of reflection is known as
diffusereflection(shownabove).Awallpainted
w ith flat paint is a good example of a diffuse
surface.
The final illumination of the kitchen is determined
by the interaction b e tween the surfaces and the
billions of photons emitted from the light source.
At any given point on a surface, it is possible that
photons have arrived directly from the light source
(direct illumination) or else indirectly through
one or more bounces off other surfaces (indirect
illumination). If you were standing in the kitchen,
a very small number of the photons in the room
would enter your eye and stimulate the rods and
cones of you r retina. This stimulation would, in
effect, form an image that is perceived by your
brain.
In computer graphics we replace the rods and
conesofaretinawiththepixelsofthecomputer
screen. One goal of a global illumination algorithm
is to re-create, as accurately as possible, what
you would see if you were standing in a real
environment. A second goal is to accomplish this
task as quickly as possible, ideally in real time (30
images per second). Currently, no single global
illumination algorithm can accomplish b oth goals.
Ray-Tracing
One of the first global illumination algorithms
developed is known as ray-tracing. The ray-tracing
algorithmrecognizesthatalthoughbillionsof
photons may be traveling about the room, the
photons we primarily care about are the ones that
enter the eye. The algorithm works by t racing
rays backward, from each pixel on the screen into
the 3D model. In this way, we compute only the
information needed to construct the image. To
create an image using ray-tracing, the follow ing
procedure is performed for each pixel on the
computer screen.
1. A ray is traced back from the eye position,
through the pixel on the monitor, until
it intersects with a surface. We know the
reflectivity of the surface f rom the material
description,butwedonotyetknowtheamount
of light reaching that surface.
2. To determine the total illumination, we trace a
ray from the point of intersection to each light
source in the environment (shadow ray). If the
ray to a light source is not blocked by another
object, the light contr ibution from that s ource
is used to calculate the color of the surface.
3. If an intersected surface is shiny or transparent,
we also hav e to determine what is seen in or
through the surface being processed. Steps 1
and2arerepeatedinthereflected(and,inthe
case of transparency, transmitted) direction
until another surface is encountered. The
color at the subsequent intersection point is
calculated and factored into the ori ginal point.
4. If the second surface is also reflective or
transparent, the ray-tracing process repeats,