Game Development Reference
In-Depth Information
Figure 4.14 Phong reflection model.
The diffuse component is the primary reflection of light off the surface. This will
be affected by any directional, point, or spotlights affecting the object. In order to
calculate the diffuse component, you need the normal of the surface as well as a
vector from the surface to the light. But as with the ambient component, the dif-
fuse component is not affected by the position of the camera.
Thefinalcomponentisthe specular component,whichrepresentsshinyhighlights
on the surface. An object with a high degree of specularity, such as a polished
metal object, will have more highlights than something painted in matte black. As
with the diffuse component, the specular component depends on the location of
lights as well as the normal of the surface. But it also depends on the position of
the camera, because highlights will change position based on the view vector.
Overall, the Phong reflection model calculations are not that complex. The model
loops through every light in the scene that affects the surface and performs some
calculations to determine the final color of the surface (see Listing 4.1 ) .
Search WWH ::




Custom Search