Game Development Reference
In-Depth Information
load. A viewport-aligned quad is rendered in two passes, one vertical and one
horizontal, to perform a masked Gaussian blur. Using two passes instead of
one reduces the number of texture reads from n 2 to n + n for an n
n kernel
[Rakos 10].
The fragment shader first reads the alpha mask. If the alpha is 1 . 0, the color
is passed through since the fragment is part of a tile. Otherwise, two other
values are read from the alpha mask. For the vertical pass, these are the topmost
and bottommost texels in the kernel's column for this fragment. For example,
for a 7
3) texels. If the alpha for both texels
is 0 . 0, sky is detected, and the color is passed through. Otherwise, the blur is
performed including only texels in the kernel with an alpha of 1.0 . Essentially,
pixels surrounding cracks are bled into the cracks to fill them.
Kernel size selection presents an important tradeoff. An n
7 kernel, the texels are (0 ,
n kernel can only
fill cracks up to n
2 pixels because of the sky check. We found that a
7 kernel works well in practice for our engine. However, we do not restrict
geometry such that cracks will never exceed five pixels. It is possible cracks will
not be completely filled, but we have found these cases to be quite rare.
Filling Poles in Screen Space
Most standard map servers provide tiles in the Web Mercator projection. Due
to the projection, tiles are not available above 85 . 05112878
latitude and below
85 . 05112878 . Not rendering these tiles results in holes in the poles as shown in
Figures 3.3(a) and 3.4(a). For many zoomed-in views, the holes are not visible.
However, for global views, they are obvious.
There are several geometric solutions to fill the holes. Tiles can be created
above and below the latitude bounds, essentially creating the same geometry as
if image tiles were available. This is simple but can lead to over-tessellation at
the poles. To avoid this, a projection tailored to the poles can be used similar
to Miller and Gaskins [Miller and Gaskins 09]. However, this requires a good
bit of code, and cracking between the two different tessellation methods needs to
addressed. Alternatively, a coarsely tessellated globe can be rendered after the
imagery tiles, but tessellation and lighting discontinuities can be noticeable.
Instead of a geometric solution, holes can be filled in screen space, avoiding
any concerns about over-tessellation or cracking. We render viewport-aligned
quads covering the poles, and detect and shade the holes in a fragment shader.
For each pole, first compute a bounding sphere around the pole's longitude-
latitude extent; for example, the north pole extent is
180 to 180 longitude,
and 85 . 05112878 to 90 latitude. The sphere can be frustum and occlusion culled
like any other geometry. If visible, the bounding rectangle of the sphere projected
into screen space is computed, and a viewport-aligned quad is rendered as shown
in Figure 3.3(b).
Search Nedrilad ::

Custom Search