Equirectangular or TOAST

By
Dave
2012
Feb
16
15:05
Posted in

I previously discussed the use of Hierarchical Triangular Mesh (HTM) geometry with a Tessellated Octahedral Adaptive Subdivision Transform (TOAST) projection, and a geometry based on latitude and longitude with an Equirectangular projection. Currently the project is using the following:

  • HTM for background stars (both for spatial indexing and deciding which cells to render).
  • Equirectangular projections for texturing on planetary bodies.

I thought it would be useful to discuss the combination of geometry and projection with respect to the following:

  • Polar Distortion
  • Tile Distribution
  • Virtual Textures
  • Normal Mapping
  • Texture Scaling
  • Cloud Shadowing

Polar distortion

TOAST projections have the advantage of suffering less distortion than equirectangular projections near to the poles. Currently it appears to be easier to find data in equirectangular projection. The Sphere TOASTER tool for WorldWide Telescope allows re-projection from equirectangular to TOAST. However, since the source maps already suffer from polar distortion, the resultant TOAST projections also have poor resolution in polar regions. Finding undistorted data would solve this issue.

Tile Distribution

Spatial mapping using grid cells based on HTM has a more even distribution than cells based on latitude and longitude. I am therefore using HTM for background stars. This gives an even spatial index, and a more even number of cells to render with respect to camera orientation.

Virtual Textures

It is easy to generate level-of-detail tiles from an equirectangular source maps using a simple tool. Generating tiles for a TOAST projection from an equirectangular projeciton is possible using the Sphere TOASTER tool for WorldWide Telescope.

Normal mapping

Normal mapping using equirectangular projections is straightforward, however leads to texture seams when using TOAST. Since I wanted to use normal mapping for specular lighting, equirectangular maps were more appropriate.

Texture scaling

While waiting for virtual texture tiles to load from a cache, I take a parent tile and divide and scale it accordingly to give a lower-resoultion texture. In the case of an equirectangular projection this is a simple algorithm.

Cloud shadowing

I also wanted to cast shadows from clouds. In the case of an equirectangular projection, there is simple algorithm in the pixel shader for converting between texture and model space.

HTM On TOAST

By
Dave
2011
Jul
19
23:12
Posted in

I decided to switch from Equirectangular to Tessellated Octahedral Adaptive Subdivision Transform (TOAST) projections. TOAST is an extension of the Hierarchical Triangular Mesh (HTM) proposed by Jonathan Fay, chief architect and developer of Microsoft's WorldWide Telescope (WWT). HTM is a representation of a sphere proposed by astronomers in the Sloan Digital Sky Survey (SDSS), which recursively subdivides an octohedron to approximate a sphere with a highly-tesselated polyhedron. The TOAST projection folds the subdivided octahedron out into a square that is very convenient for use in an image pyramid.

Tesselating an Equirectangular projection into a set of texture tiles corresponds to areas on the surface of a sphere bounded by lines of latitude and longitude. The sphere can therefore be approximated using "Slices and Stacks", as shown below in Figure 1. In order to switch to a TOAST projection, the first thing I needed to do was generate the underlying HTM geometry, as shown below in Figure 2. Note that while the fist level is an octohedron in both cases, subsequent levels of Slices and Stacks begin clustering tiles around the poles whereas HTM levels retain a more even distribution.

Equirectangular Equirectangular Equirectangular Equirectangular

Figure 1. Slices & Stacks L1-L4

HTM HTM HTM HTM

Figure 2. HTM L1-L4

Once this was done, I needed to add the relevant texture coordinates to each indexed vertex to map the corresponding TOAST texture tile. Each texture tile maps to two triangles, or HTM "trixels". The texture mapping for an Equirectangular projection is shown below in Figure 3, with the underlying geometry smoothed to more closely approximate a sphere. Figure 4 shows the texture mapping for the TOAST projection, again with the underlying geometry smoothed to more closely approximate a sphere.

Equirectangular Equirectangular Equirectangular Equirectangular

Figure 3. Equirectangular L1-L4 (mapped to Slices & Stacks L5)

HTM HTM HTM HTM

Figure 4. TOAST L1-L4 (mapped to HTM L5)