428 10. The Rendering Engine
z the viewing direction vector V = [ Vx Vy Vz ], which extends from the
refl ection point to the virtual camera’s focal point (i.e., the negation of
the camera’s world-space “front” vector);
z the ambient light intensity for the three color channels,
A = [ AR AG AB ];
z the surface normal N = [ Nx Ny Nz ] at the point the light ray impinges
on the surface;
z the surface refl ectance properties, which are
□ the ambient refl ectivity kA,
□ the diff use refl ectivity kD,
□ the specular refl ectivity kS,
□ and a specular “glossiness” exponent α;
z and, for each light source i,
□ the light’s color and intensity Ci = [ CRi CGi CBi ],
□ the direction vector Li from the refl ection point to the light source.
In the Phong model, the intensity I of light refl ected from a point can be ex-
pressed with the following vector equation:
A D( )( ) ,i Si i
i
I= +kk kA∑⎣⎦⎡⎤NL⋅+R V⋅α C
where the sum is taken over all lights i aff ecting the point in question. This can
be broken into three scalar equations, one for each color channel:
( )( ) ,
( )( ) ,
( )( ).
R A R D i S i Ri
i
G A G D i S i Gi
B A B D i S i Bi
I kA k k C
I kA k k C
I kA k k C
α
α
α
= +⎡⎤⎣⎦⋅+ ⋅
= + ⎡⎤⎣⎦⋅+ ⋅
= + ⎡⎤⎣⎦⋅+ ⋅
∑
∑
∑
NL R V
NL R V
NL R V
i
i
Figure 10.23. Ambient, diffuse and specular terms are summed to calculate Phong
refl ection.