Game Development Reference
In-Depth Information
rendered for that light source. This by itself helps game engines run faster, but an
even more aggressive optimization for point lights is described in Section 10.4.7.
7.2.4 Spot Light Sources
A spot light is similar to a point light but has a preferred direction of radiation.
The intensity of a spot light is attenuated over distance in the same way that it is
for a point light and is also attenuated by another factor called the spot light
effect.
Suppose that a spot light source has been placed at a point P and has a spot
direction R . The intensity of light reaching a point in space Q is given by
{
}
p
max
−⋅
RL
, 0
,
(7.4)
=
0
2
kkdkd
++
c
l
q
where is the color of the light; d is the distance between the light source and
Q ; k , k , and k are the attenuation constants; and L is the unit length direction
pointing from Q toward the light source:
PQ
PQ .
(7.5)
L
=
The exponent p controls how concentrated the spot light is. As shown in Figure
7.1, a large value of p corresponds to a highly focused spot light having a sharp
falloff, whereas a smaller value of p corresponds to a less concentrated beam.
The spot light is most intense when
RL and gradually falls off as the angle
=−
between R and
L increases. No radiation from a spot light reaches a point for
which the angle between R and
L is greater than 90 degrees.
Figure 7.1. The spot light exponent p in Equation (7.4) controls how concentrated the
beam of a spot light is. From left to right, the spot light exponents used to illuminate the
ground are 2, 10, 50, and 100.