Game Development Reference
latitude. (b) A rectangle covering the hole in screen space. (c) Masking and ray casting
to detect the hole. (d) Shading the hole.
Figure 3.3. (a) A hole at the north pole since tiles are not available outside of
The quad is larger than the hole behind it. For horizon views, it extends high
above the ground. The fragment shader discards fragments that are not in front
of the hole by first checking the alpha mask; if it is 1 . 0, a tile was rendered to
this fragment, and it is not a hole. To discard fragments above ground, a ray is
cast from the eye through the fragment to the ellipsoid. If the ray doesn't hit the
ellipsoid, the fragment is above the ground, and discarded. At this point, if the
fragment was not discarded, it covers the hole as in Figure 3.3(c).
We shade the fragment by computing the geodetic surface normal on the
ellipsoid where the ray intersects, and use that for lighting with a solid diffuse
color. Texture coordinates can also be computed and used for specular maps and
other effects. Given that the poles are mostly uniform color, a solid diffuse color
looks acceptable as shown in Figures 3.3(d) and 3.4(b) .