Game Development Reference

In-Depth Information

Chapter 7 Summary

Point Light Source Attenuation

The intensity
of a point light source at a distance
d
from its position is given by

1

=

,

0

kkdkd

++

2

c

l

q

where
is the color of the light, and the constants
k
,
k
, and
k
control the at-

tenuation.

Spot Light Source Attenuation

The intensity
of a spot light source at a point
Q
lying at a distance
d
from the

light's position is given by

p

{

}

max

−⋅

RL

, 0

=

,

0

2

kkdkd

++

c

l

q

where
is the color of the light;
k
,
k
, and
k
are the attenuation constants;
R
is

the direction in which the spot light is pointing;
L
is the unit vector pointing from

Q
to the light position; and the exponent
p
controls the rate at which the intensity

falls off as the angle between
R
and

L
increases.

−

Ambient and Diffuse Lighting

The ambient and diffuse contribution to the illumination color calculated at a

point
Q
on a surface is given by the expression

n

NL

{

}

=+

max

⋅

, 0

,

diffuse

i

i

i

=

1

where
is the surface's diffuse reflection color,
N
is the normal vector to the

surface,
L
is the unit vector pointing from
Q
toward the
i
-th light,
is the inten-

sity of the
i
-th light at the point
Q
, and
represents the ambient light color.

Specular Lighting

The specular contribution to the illumination color calculated at a point
Q
on a

surface is given by the expression

Search Nedrilad ::

Custom Search