Real-Time Shading

This part provides details of those algorithms that are well suited to graphics hardware. These algorithms may be used to good effect on any programmable shading system, whether hand-coded multipass OpenGL, low-level ver tex or fragment shaders, or a real shading lan guage.
Texture shading [72, 77, 114] is a real-time shading implementation technique that precomputes a complex lighting model (or part of a complex lighting model) and stores it into one or more texture maps. The realtime implementation then consists only of per-vertex texture parameter calculations, one or more texture lookups, and possibly a small amount of post-texture arithmetic to combine multiple texture lookups.
For example, any complex function c= f(s, t) that returns a color from any two real parameters can be encoded into a two-dimensional texture map, assuming the error due to sampling, quantization, and interpolation can be tolerated. With a small additional amount of arithmetic (supported via compositing or fragment shader operations in practice), a small number of texture look-ups can often be combined into complete and surprisingly sophisticated lighting models. For instance, if a four-dimensional function g(s, t, u, v) can be decomposed into a product g 1 (s, t) g 2 (u, ?), only two two-dimensional texture lookups and a multiply are needed to evaluate it. We will use the term texture shading loosely to refer to any...