Graphics Reference
In-Depth Information
shading technique is clearly needed. In the next section, we describe a popular
real-time shading technique designed to address the problem of rendering curved
surfaces.
6.3 Curved-Surface Representation
and Rendering
Survey the room around you and you'll find that most objects have some curved
surfaces or rounded edges. A purely faceted polyhedron like our simple pyramid
is quite rare in the “real world.” Thus, in most cases, a triangular mesh in a 3D
scene is not being used to represent an object exactly, but rather is being used to
approximate an object.
For example, we can approximate a circular cone using a many-sided pyramid.
With just 16 faces, flat shading produces a fairly good approximation of a cone
(as seen in Figure 6.19), but it doesn't really “fool the eye” into accepting it as a
curved surface.
Figure 6.19: Flat-shaded render-
ing of a cone with 16 sides.
Increasing the number of facets (e.g., to 64 sides, as shown in Figure 6.20)
does help improve the result, but the approximation is still apparent. Attempting to
solve the problemmerely by increasing the mesh's resolution is not only expensive
(in terms of storage/processing costs) but also ineffective: If the camera's position
is moved toward the mesh, at some point the faceting will become apparent.
Figure 6.20: Flat-shaded render-
ing of a cone with 64 sides,
reducing (but not eliminating) the
obvious faceting.
Inline Exercise 6.7: You might want to visit the “Modeling Curved Surfaces”
module of the laboratory to see the effect of changes in the facet count when
flat shading is in effect. You can zoom in/out by dragging the mouse (when
the cursor is within the viewport) while holding down the right mouse button.
Note how increasing the number of facets can only fool the eye at a distance—
zooming in exposes the fraud easily. Note also that motion of the object makes
the approximation even more obvious, especially at the bottom edge.
6.3.1 Interpolated Shading (Gouraud)
The task of finding an efficient way to produce acceptable images of curved sur-
faces from low-resolution mesh approximations was particularly urgent in the
early days of computer graphics, when computer memory was measured in kilo-
bytes and processors were many orders of magnitude less powerful than they are
today. Per-vertex lighting with flat shading was widely used, but there was an
obvious need for a shading technique that would fool the eye and allow the ren-
dered image to approximate the curved surface represented by the mesh, even for
a low-resolution mesh, at minimal processor and memory cost. In the early 1970s,
University of Utah Ph.D. student Henri Gouraud refined a shading technique based
on interpolation of intensity values at mesh vertices, using algorithms like those
described in the opening sections of Chapter 9. To appreciate the difference in
quality between flat shading and Gouraud shading, compare the two renderings of
the Utah teapot in Figures 6.21 and 6.22.
Let's first examine Gouraud interpolation in two dimensions. In Figure 6.23,
the curved 2D surface is shown in yellow, the approximation mesh of 2D
line segments in black, and the vertices in green. At each vertex, the lighting
model (in this case, diffuse Lambert illumination) has computed a color for that
Figure 6.21: Flat-shaded render-
ing of the classic “Utah” teapot
model.
Figure
6.22:
Gouraud-shaded
rendering
of
the
same
teapot
model.
 
 
 
 
Search WWH ::




Custom Search