## Shading

Solving the reflectance function only gives us the reflected light at a single point. We still must shade an entire object. How should we do this? Some possibilities:

- Compute a single reflectance for entire object
- Compute a reflectance for every pixel

A single reflectance per object will look poor, while a reflectance per pixel is expensive. There is a cost to quality balance when shading objects.

There is no limit to shading models. Here are a few:

- Flat shading
- Gouraud shading
- Phong shading
- Anything else you can imagine

These shading models differ in the number of reflectance, shading, and interpolation operations used.

### Flat shading

This model computes one reflectance per polygon using one surface normal. The surface of the polygon is then filled with the resulting color. This model only requires one reflectance calculation and no interpolation (only fill). While it is very fast, it looks very poor on curved surfaces and can look poor even on flat surfaces.

### Gouraud shading

Improving on flat shading requires more calculations. If surface normals are computed per vertex, a distinct reflectance could be computed per vertex. The vertex normals are computed based on model connectivity and point perpendicular to the approximate surface tangent. The reflectance values are computed per vertex and the surface color is linearly interpolated based on the vertex colors. This often looks much better than flat shading on curved surfaces, but still has issues with very sharp reflections (high frequency effects).

### Phong shading

Adding even more normals will make it look better, right? Of course!

We still consider polygon surfaces flat, with normals at the vertices. However, instead of interpolating the reflectance colors, we interpolate the normal values. This results in a smooth field of normals over the polygon surface. Then, for any desired point on the surface, a reflectance color can be generated.

Graphics hardware is very advanced and nearly all graphics today is based on the ideas in Phong shading: evaluating the reflectance as often as needed over the surface. Often, the shading model is complemented with detailed surface data: diffuse, specular, and normal data is loaded as images/texture maps. This allows these values to vary over the surface non-linearly. We will investigate this later.