
i
i
i
i
i
i
i
i
14.3. Some Basic Shader Programs 373
Figure 14.3. Simulating a smooth sphere using the built-in fixed-functionality
Gouraud shader model (on the left) and Phong’s model (on the right) programmed
as a shader in the GPU.
functionality Gouraud shading model and our own programmable shaders
for Phong shading.
Listing 14.5 shows a shader program pair which emulates a very basic
Gouraud shading algorithm. Although simple, it shows the steps that are
essential in setting up a vertex shader: Transformation, lighting calculation,
surface color interpolation.
Phong’s shading model delivers a much better illusion of smoothing, but
at a price. The surface