### Smooth Versus Flat Shading

(Note: Drag your mouse on

the sphere to rotate it.)

(Note: Drag your mouse on

the sphere to rotate it.)

The choice of normal vectors can affect the appearance of a surface. The demo shows a sphere approximated as a polyhedron, divided by lines of longitude into "slices" and by lines of latitude into "stacks." (The approximation is pretty bad when the number of slices or stacks is small.) The sphere can be displayed with "Smooth" shading or with "Flat" shading. When you switch beteen "Smooth" and "Flat", the only thing that changes is the normal vectors. The underlying geometry changes only when you change the number of slices or stacks. Watch the outline of the shape as you change from Smooth to Flat to see that the geometry doesn't change.

For Flat shading, all the normal vectors for a face are perpendicular to that face, making it look flat and giving the sphere a faceted appearance, with abrupt changes in lighting along each edge. For Smooth shading, the normal vectors are not perpendicular to the face; instead, the are chosen to be perpendicular to the smooth surface of the sphere that is being approximated. This makes the normal vectors on the two sides of an edge agree, so there is no abrupt change along the edge.

Smooth shading only works well when the polyhedron is a good approximation for the sphere. To see the best approximation, increase the number of slices and stacks to maximum. Try using both smooth and flat shading. Even with the maximum values, flat shading makes the sphere look like it is made of flat facets.

You should also try setting the number of slices
and stacks to be very small. In that case, smooth
shading will make the object look *wrong*, though
you might have trouble putting your finger on exactly
what is wrong. The problem is that the normal
vectors are trying to make a geometrically sharp
edge look smooth.

Note that this demo uses some specular color, so that you can see the light glinting off the facets! Set the shading to be Flat, and watch how the highlights change as you use your mouse to rotate the sphere.

By the way, you can get some interesting looking objects if you set the number of slices to be very small and the number of stacks to be very large, or vice versa. Try it!