Graphics Reference
In-Depth Information
Lambert's cosine rule for idealized diffuse reflection has two key characteris-
tics: (1) The reflected intensity is independent of view angle and (2) it depends
only on the cosine of the angle between the incoming light direction
and the
normal at a point on the surface. To gain an intuitive understanding of these
phenomena, find a matte surface such as a clean chalkboard or a painted wall
without any sheen, and point a bright light at the surface. Now pick a bright
spot on the illuminated area and look at it from a variety of locations through
a tube with a diameter so tiny that all you see is a uniformly lit “dot” (simu-
lating what a radiometer would detect). Note that as you move your point of
view, the dot's apparent brightness will remain constant, while it would vary
if you performed this same experiment with a shiny surface. Varying the angle
of incidence of the light source, however, will cause the reflected brightness to
vary with the cosine of the angle. If you are curious about the math behind this
rule, consult Section 7.10.6.
6.2.3 “Lighting” versus “Shading” in Fixed-Function
Rendering
The Lambert equation presented above, and the more complete equation presented
in Section 1.13.1, are examples of functions that compute the amount of light
energy that is reflected from a given surface point P toward the specified camera
position.
A lighting equation, like the Lambert equation, is an algorithmic represen-
tation of the way a surface's material reflects light. From a theoretical point of
view, a renderer processes a given visible surface by “loading” the lighting equa-
tion for its material, and “executing” it for points on that surface. (Interestingly,
in programmable-pipeline hardware, this abstraction isn't too far from the truth!)
For which surface points should the equation be executed? A reasonable approach
is to perform the calculation once for each pixel covered by the surface's ren-
dered image, executing the equation for a representative surface point for each
such pixel. Offline rendering systems use an approach like this, but that strategy is
too computationally expensive for real-time rendering systems running on today's
commodity hardware. The approach taken by many such systems—including
fixed-function pipelines such as WPF's, as well as programmable pipelines—is
to compute the lighting only at key points on the surface, and to use lower-cost
shading rules 2 to determine values for surface points lying between the key points.
Figure 6.18: Flat-shaded render-
ing of a dolphin mesh model,
with three triangles highlighted
to demonstrate the concept of the
key vertex.
For example, let's examine the simplest shading technique, known as flat
shading or constant shading, in which one vertex of each triangle is selected
as the key vertex for that triangle. The lighting equation is executed to compute
the illumination value for that vertex, and the entire triangle is filled with a copy of
that value. An example rendered image using flat shading is shown in Figure 6.18,
in which we've highlighted three triangles and the key vertex that was the deter-
minant for each.
Flat shading may be appropriate for pyramids, but as Figure 6.18 shows,
when the triangular mesh is approximating a curved surface a more sophisticated
2. As discussed in Section 27.5.3, this classic use of the term “shading” to refer to efficient
determination of lighting at interior points conflicts with modern uses of the terms
“shading” and “shader.”
 
 
 
Search WWH ::




Custom Search