Figure 1-7-2 Ambient Light
# Diffuse Light
Diffuse light is light that has been scattered through reflection or refraction. For example, transmitting a light through a translucent material diffuses the light. Diffuse lights take on the color of the translucent material that scattered the light.
Figure 1-7-3 Diffuse Light
To implement lighting, you simply set the position and direction of the source light, and also specify appropriate ambient and diffuse lights.
1-7-3 Material Properties
There are three elements that determine the materials of an object. These are ambient light, diffused light, and reflected light.
# Ambient Light
As mentioned earlier, ambient light is the color of the shadow of an object.
# Diffuse Light
Unlike the diffuse light previously mentioned, the color of diffuse light comes from the color of the substance itself. The diffuse light becomes brighter as the incident angle gets closer to a right angle.
# Specular Light
How a substance reflects light affects how shiny the object appears. A substance like chalk reflects light in all directions with equal intensity, so it appears dull. On the other hand, a substance like a mirror reflects light in only a certain direction, so it appears shiny. How shiny or dull a surface appears depends on how that substance reflects light. Shiny surfaces show a shiny spot (specular highlight) that is very bright compared to the surrounded parts because most of the reflected light comes off in a single predominant direction. N64 cannot set these elements, but pseudo-expression is possible.
|Example N64 Functions (Lighting)
Shading is adding shadow to an object by calculating 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:
Figure 1-7-4 Flat Shading
This shading technique calculates the normal vector and the light source of a surface, and applies uniform color to the surface. As a result, objects will appear blocky (like computer graphics).
Figure 1-7-5 Normal Vector and Light Source
|Example N64 Functions (Flat Shading)
# Smooth Shading
The smooth shading technique smoothes 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:
Figure 1-7-6 Smooth Shading
There are many different techniques that you could use to implement smooth shading. One of the most popular is Gouraud shading. Gouraud shading, 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:
Figure 1-7-7 The difference between flat and smooth shading
By providing shading, you can put colors that are reflected from surrounding objects on your shaded object.
|Example N64 Functions (Smooth Shading)