Game Development Reference
InDepth Information
n
c + sn
1
s
q = Dp
c
q
2

1/
q
Figure 3.7.
Computing the depth plane: a cross section of the ellipsoid scaled to a
sphere as viewed from east of the camera.
in a depthonly pass that is perpendicular to the near plane and intersects the
globe at the horizon. This plane is computed by determining the visible longitude
and latitude extents given the camera position.
Following Figure 3.7, for an ellipsoid,
x
2
a
2
y
2
b
2
z
2
c
2
+
+
=1,andcameraposition
in WGS84 coordinates,
p
, we compute
⎛
⎞
a
00
0
b
0
00
c
⎝
⎠
,
D
=
q
=
Dp,
where
D
is a scale matrix that transforms from the ellipsoid to a unit sphere and
q
is the camera position in the scaled space. Next, we compute the east vector,
e
; the north vector,
n
; the center of the circle where the depth plane intersects
the unit sphere,
c
; and the radius of that circle,
s
:
e
=(0
,
0
,
1)
×
q,
n
=
q
×
e,
q
c
=
,

q

2
1

q

2
.
s
= sin arccos
Search Nedrilad ::
Custom Search