Game Development Reference
In-Depth Information
9.1.1 Projection Matrix Modification
Let us first examine the effect of the standard OpenGL perspective projection
matrix on an eye space point
(
)
P . To simplify the matrix given in
Equation (5.52) a bit, we assume that the view frustum is centered about the z
axis so that the left and right planes intersect the near plane at x
=
P
,
PP
,
, 1
x
y
z
ne
, and the
top and bottom planes intersect the near plane at y
, where e is the focal
length and a is the aspect ratio. Calling the distance to the near clipping plane n
and the distance to the far clipping plane f , we have
an e
e
0
0
0
eP
x
P

x
(
)
0
ea
0
0
2
ea P

y
P

y
=
.
(9.1)
f
+
n
fn
f
+
n
2
fn
00
P
P

z
z
f
nf
n
f
n f
n

1

00
1
0
P
z
To finish the projection, we need to divide this result by its w coordinate, which
has the value
. The resulting point
P is given by
P
eP
P
ea P
P
x
z
(
)
y
=
P
.
(9.2)
z
f
+
n
2
fn
+
(
)
f
nPf
n
z
for the w co-
ordinate will guarantee the preservation of the projected x and y coordinates as
well. From this point forward, we shall concern ourselves only with the lower-
right 22
It is clear from Equation (9.2) that preserving the value of
P
portion of the projection matrix, since this is the only part that affects
the z and w coordinates.
The projected z coordinate may be altered without disturbing the w coordi-
nate by introducing a factor of 1 ε
×
+
, for some small ε , as follows.
f
+
n
2
fn
f
+
n
2
fn
(
)
(
)
−+
1
ε
P
−+
1
ε
P

z
z
f
nf
n
=
f
n f
n
(9.3)

1

1
0
P
z
Search Nedrilad ::




Custom Search