Game Development Reference
c + sn
q = Dp
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 depth-only 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,
in WGS84 coordinates, p , we compute
0 b 0
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)
n = q
| q | 2 .
s = sin arccos