Chapter 5. Lighting
This chapter shows you how to illuminate the objects in your scenes with light sources. We start by building a simplified version of a commonly used lighting model. Then, we gradually add functionality to the basic model to make it more useful in common situations. This chapter has the following five sections:
“Lighting and Lighting Models” explains the importance of lighting and introduces the concept of a lighting model.
“Implementing the Basic Per-Vertex Lighting Model” presents a simplified version of the lighting model used in OpenGL and Direct3D. This section also goes through a step-by-step implementation of this lighting model in a vertex program.
“Per-Fragment Lighting” describes the differences between per-vertex and ...
Get The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.