SPONSORED LINKS

3.7.4 Shading

You can add three-dimensional shading to your games by calculating the effects of the materials and lighting. N64 implements flat shading and smooth shading (Gouraud shading).

Flat Shading

In flat shading each surface is shaded uniformly by using the same color as illustrated here:

This shading technique calculates the shading based on the normal vector for the surface along the light source and applies uniform color to the surface:

Use the following N64 functions to apply flat shading:

Smooth Shading

The smooth shading technique smooths out the shading to make it appear more realistic. Note that smooth shading affects the inside shading only; it has no effect on the outline of the object, as you can see in this illustration:

There are many different techniques that you could use to implement smooth shading. One of the most popular is the Gouraud method. The Gouraud method, named for its developer, gives a normal vector to each vertex of the surface; in other words, it calculates both the light source and the normal vector for each vertex. In this way, it interpolates calculated light for each vertex to make the shading appear smooth as illustrated here:

By providing shading, you can put colors that are reflected from surrounding objects on your shaded object.

Use the following N64 functions to apply smooth shading: