Graphics Reference
In-Depth Information
The global ambient light level is defined by I
a
, whereas the incident light due to a light source
is defined by I
i
and gives rise to a diffuse and specular component.
We can now start to derive an equation that sums these three components together. The
ambient term is k
a
I
a
and the diffuse term is k
d
I
i
n
L
. All that we need now is to compute
the specular term, which is viewer-dependent as it simulates the reflection of the light source
observed in shiny surfaces.
·
L
n
R
α
θ
θ
V
P
Figure 10.3.
Figure 10.3 shows the geometry used to compute the specular component. At a point P on the
surface, photons are arriving from the light source L with direction
L
.As
n
is the surface
normal at P, for a perfect reflector the angle of reflection will equal the angle of incidence,
and the reflected photons will have direction
R
. If the viewer happens to be looking back along
vector
R
, a bright spot is observed. However, say the viewer is offset by an angle , and the
surface is not a perfect reflector, some light will be seen when looking back along
V
. Phong
[Phong, 1975] proposed that this specular highlight could be controlled by cos , which gives
a bell-shaped distribution of light intensity around
V
. But if the vectors associated with this
model are unit vectors, then
−
cos
=
R
·
V
Phong also suggested that different levels of shininess could be simulated by raising cos to
some power n:
cos
n
V
n
=
R
·
where n is a parameter controlling the level of shininess. For example, when n
(or some
very high value), a mirror surface is created, and as n is reduced, the size of the specular
highlight increases.
Adding this specular term to the ambient and diffuse terms produces
=
V
n
I
=
k
a
I
a
+
I
i
k
d
n
·
L
+
k
s
R
·
(10.1)