Game Development Reference

In-Depth Information

Exercises for Chapter 9

1.

Suppose that the distance to the near plane is

n

=

1

, and the distance to the

far plane is

=

100

for a particular view frustum. Calculate by what value

f

(

)

the

3,3 entry of the projection matrix should be multiplied in order to off-

set a model centered at a depth of

z

=−

20

toward the camera by a distance

of 0.2.

2.

Calculate the least distance
d
by which the model in Exercise 1 can be offset

toward the camera if a 16-bit depth buffer is used.

3.

Write a program that applies a decal to a surface. Assume that the decal is

described by its center
P
, a normal direction
N
, a tangent direction
T
, its

width
w
, and its height
h
. The program should construct a decal object by

clipping an arbitrary triangle mesh to the planes bounding the decal and

should then calculate texture coordinates for each vertex in the decal object.

4.

Implement a particle system for which each particle is rendered as a textured

quad centered at the particle's position. Each particle should be described by

its position
P
in world space, its radius
r
, its window-space orientation
θ
,

and its velocity
V
.

Search Nedrilad ::

Custom Search