SMOOTH SHADING
In contrast to flat shading with smooth shading the color changes from pixel to pixel. It assumes that the surfaces are curved and uses interpolation techniques to calculate the values of pixels between the vertices of the polygons.
Types of smooth shading include:
Gouraud shading
Phong shading
Gouraud shading
1. Determine the normal at each polygon vertex
2. Apply an illumination model to each vertex to calculate the vertex intensity
3. Interpolate the vertex intensities using bilinear interpolation over the surface polygon
Data structures
Sometimes vertex normals can be computed directly (e.g. height field with uniform mesh)
• More generally, need data structure for mesh
• Key: which polygons meet at each vertex
Advantages
Polygons, more complex than triangles, can also have different colors specified for each vertex. In these instances, the underlying logic for shading can become more intricate.
Problems
Even the smoothness introduced by Gouraud shading may not prevent the appearance of the shading differences between adjacent polygons.
Gouraud shading is more CPU intensive and can become a problem when rendering real time environments with many polygons.
T-Junctions with adjoining polygons can sometimes result in visual anomalies. In general, T-Junctions should be avoided.
Phong shading
Phong shading is similar to Gouraud shading, except that the Normal’s are interpolated. Thus, the specular highlights are computed much more precisely than in the Gouraud shading model:
a. Compute a normal N for each vertex of the polygon.
b. From bilinear interpolation compute a normal, Ni for each pixel. (This must be renormalized each time)
c. From Ni compute an intensity Ii for each pixel of the polygon.
d. Paint pixel to shade corresponding to light.