Game Development Reference
In-Depth Information
Just as with specular lighting, we must prevent the dot product from
going negative by clamping it to zero. This prevents objects from being lit
from behind.
It's very instructive to see how diffuse surfaces are implemented in the
framework of the rendering equation.
Diffuse reflection models light that is scattered completely randomly, and
any given outgoing direction is equally likely, no matter what the incoming
light direction. Thus, the BRDF for a perfectly diffuse surface is a constant.
Note the similarity of Equation (10.12) with the contents of the integral
from the rendering equation,
L in ( x ,
ω in ,λ)f( x ,
ω in ,
ω out ,λ)(−
ω in n ).
The first factor is the incident light color. The material color m diff is
the constant value of the BRDF, which comes next. Finally, we have the
Lambert factor.
10.6.4 The Ambient and Emmissive Components
Specular and diffuse lighting both account for light rays that travel directly
from the light source to the surface of the object, “bounce” one time, and
then arrive in the eye. However, in the real world, light often bounces off
one or more intermediate objects before hitting an object and reflecting to
the eye. When you open the refrigerator door in the middle of the night,
the entire kitchen will get just a bit brighter, even though the refrigerator
door blocks most of the direct light.
To model light that is reflected more than one time before it enters the
eye, we can use a very crude approximation known as “ambient light.” The
ambient portion of the lighting equation depends only on the properties of
the material and an ambient lighting value, which is often a global value
used for the entire scene. None of the light sources are involved in the com-
putation. (In fact, a light source is not even necessary.) Equation (10.13)
is used to compute the ambient component:
Ambient contribution to
the lighting equation
c amb = g amb m amb .
(10.13)
The factor m amb is the material's “ambient color.” This is almost always
the same as the diffuse color (which is often defined using a texture map).
The other factor, g amb , is the ambient light value. We use the notation g for
Search WWH ::




Custom Search