Game Development Reference

In-Depth Information

Determining Cap Necessity

The near-clip volume is bounded by the planes connecting the near rectangle to

the world-space light position
L
. The four world-space normal directions

N
for

the near-clip volume are given by

(

′

′

)

(

′

)

=−

RR

×

LLL

,

,

−

L

R
,

N

(

)

i

i

i

−

1mod4

x

y

z

w

i

′

where each

R
is the world-space vertex of the near rectangle given by

i

′
=

RWR
,
W
is the transformation from camera space to world space, and the

values of

i

i

R
are given by Equation (10.17). The corresponding world-space

planes

K
bounding the near-clip volume are given by

1

()()()

′

K

=

NNN NR

,

,

,

−

⋅

.

i

i

x

i

y

i

z

i

i

N

i

The near-clip volume is closed by adding a fifth plane that is coincident with the

near plane and has a normal pointing toward the light source. For a light source

lying in front on the near plane, the fifth plane
K
is given by

(

)

−

1T

K

=

W

0, 0,

−

1,

−

n

.

4

For an object that is bounded by a sphere having center
C
and radius
r
, we do not

need to render a capped shadow volume if

⋅<−

C

r

for any
i
.

K

i

Exercises for Chapter 10

(

)

1.

Use a technique similar to that described in Section 9.1 to derive the

3, 3

′

entry of a projection matrix based on the matrix

M
given by Equation

(10.10) that offsets depth values at a camera-space depth
P
by a small

amount
δ
.

infinite

2.

Write a program that renders a stencil shadow for a triangle mesh illuminat-

ed by a single point light source. Assume that the triangle mesh is specified

such that each of
n
triangles indexes three entries in an array of
m
vertices.

The program should precalculate an edge list, determine the edges belonging

to the model's silhouette with respect to the light source, and render the ex-

truded silhouette edges using the stencil buffer operations described in Sec-

tion 10.3.6.

Search Nedrilad ::

Custom Search