Game Development Reference

In-Depth Information

2

rl

+

0

0

−

rl

−

rl

−

P

2

tb

+

x

0

0

−

tb

−

tb

f

−

P

y

′
=

PM P

=

.

(5.58)

ortho

−

2

+

n
P

z

0

0

−

f

−

n

f

−

n

1

0

0

0

1

The matrix
orth
M
in Equation (5.58) is the OpenGL orthographic projection

matrix generated by the
glOrtho()
function. Note that the
w
coordinate re-

mains 1 after the transformation, and thus no perspective projection takes place.

5.5.3 Extracting Frustum Planes

It is remarkably simple to extract the four-dimensional vectors corresponding to

the six camera-space view frustum planes from an arbitrary projection matrix
M
.

The technique presented here derives from the fact that the planes are always the

same in clip space. They are actually rather trivial since, as shown in Figure 5.18,

each plane's normal is parallel to one of the principal axes.

x
=−

1

x
=

1

z
=

1

0, 0,

−

1

1, 0, 0

−

1, 0, 0

0, 0,1

z
=−

1

Figure 5.18.
These are the normal vectors for the left, right, near, and far planes bound-

ing the cube-shaped homogeneous clip space. The normal vectors for the top and bottom

planes point in and out of the page.

Search Nedrilad ::

Custom Search