MCIS 625: Computer Graphics
Winter 2004

WEEK 10

Instructor: Dr. Michael Laszlo


Assignment

  1. Please review my slide set on slide set on shading.
  2. Optional reading assignment: Chapter 12 and Sections 14.1, 14.2, 14.3, and 14.7 of Foley et al.
  3. There is no additional assignment this week.

Shading Methods
Polygon rendering methods are important due to the generality of polygonal mesh modeling. The surface of any solid object can be represented by a polygonal mesh. If the mesh is sufficiently fine, the polygons sufficiently small, the representation can be made as accurate as desired. Thus the polygonal mesh representation scheme is very general, and it is desirable to employ realistic rendering methods when rendering such meshes.

The simplest polygon rendering method, called flat shading, calculates a single intensity value for each surface polygon, based on the orientation of the polygon and on the position and intensity of the light sources in the scene. The mathematics for computing intensity values is straightforward, and given in Section 14-5. Unfortunately, the intensity of light varies across curved surfaces, and across the surface of a single polygon, flat shading fails to capture this variation in brightness. Thus a curved surface that is represented by a mesh of polygons appears as a mesh of flat facets, under flat shading. This is realistic only if the solid's surface is in fact faceted, such as the surface of a box or a cut diamond. The advantage of flat shading is that it is very fast—only one normal vector per polygon need be computed.

Even curved surfaces such as spheres and donuts can be represented by polygonal meshes and faithfully rendered, if an appropriate rendering method is used. Gouraud shading and Phong shading are two such methods. In both methods, interpolation across surface polygons is used to capture variation in light intensity and reflection. Where two polygons meet along an edge, the intensity values for the two adjacent polygons match, so the edge is not seen (except in silhouette). Each polygon appears to be a curved surface that meets adjacent polygons seemlessly.

Gouraud and Phong shading differ with respect to what each interpolates. Gouraud shading computes intensity values at a polygon's vertices and interpolates these intensity values across the polygon interior. The light intensity at each point of the polygon's surface is a factor in that point's displayed color.

In contrast, Phong shading computes a normal vector at each of the polygon's vertices, then interpolates the normal vector across the polygon interior. At each point of the polygon's surface, Phong shading uses the normal vector at that point to compute an intensity value. Phong shading is more realistic than Gouraud shading, but it is also more expensive computationally.

You can see the difference between smooth shading and flat shading by viewing a curved elevation grid within VRML. Here is a curved elevation grid with smooth shading, and here is the same grid with flat shading. The difference is achieved by the setting of the ElevationGrid node's creaseAngle field (setting it to 0.0 forces flat shading).


[ Home | Course | Syllabus ]