Hardware Assisted Lighting
At this time, the use of lighting acceleration via the GPU remains to be widely adopted. Today's games make extensive use of what is referred to as lightmap and vertex lighting. However, that will begin to change as game developers begin to take advantage of the GeForce 256's support for up to 8 real-time light sources.
Lighting comes in a variety of types such as light from the sun, indoor lighting, and spotlights. Even objects such as mirrors and brass doorknobs reflect light. Lighting in a computer generated 3D world is an extremely complex task which involves an understanding of how light is emitted from a light source (flame, light bulb, etc.). Adding multiple light sources, to create a more realistic scene, further adds to the complexity.
As was eluded to earlier, rather than tracing the path of light beams in real-time, today's games typically use lightmaps which are images that change the color of an object making it appear as though a light is shining on it.
As with transformations, lighting calculations are done via matrix manipulation, are more complex and are typically computing the distances and directions between light sources and objects. In the following illustrations, sunlight is added to the second image as a light source to the first image, while flames are added to the third image:
Lighting is an effective way of adding varying degrees of brightness to 3D objects allowing realistic scene detail. Lighting also takes advantage of the natural abilities of the human eye which are actually more sensitive to changes in brightness than it is to changes in color.
Diffuse And Specular Lighting
To further subdivide lighting in 3D graphics, diffuse and specular lighting are used to simplify modeling the physics of light. Diffused lighting is when light hits an object and scatters in all directions equally and does not depend on the position of the viewer. Sunlight shining on the ground is an example of diffused lighting.
On the other hand specular lighting depends on the position of the viewer. It also factors in the direction of light and the orientation of the triangle being rendered. Specular lighting can be used to represent the material an object is made from. For example, the difference in lighting a silk shirt versus a cotton shirt.
Diffuse and Specular Lighting