Note: This documentation is preliminary and subject to change.

WorldWide Telescope is a viewer for spheres. As a viewer zooms in the spheres are of ever increasing size and
resolution. Sometimes, for panoramas and all-sky surveys – WorldWide Telescope renders the inside of a sphere. Other times, for the surfaces of
planets and moons, it renders the outside of a sphere. WorldWide Telescope does *not * model the irregular shape of the Earth
usually referred to as an oblate spheroid. The east-west diameter of the earth is 7,926 miles (or 12,756 kilometers), whereas
the north-south diameter is slightly shorter at 7,901 miles (or 12,715 kilometers). The program treats the Earth, and other planets
and moons, as perfect spheres.

The classic problem with mapping is obtaining a useful 2D flat image of a round 3D surface. There are several well known projection systems, the most popular are briefly discussed here, though all distort areas of the surface to a degree. Distortions which are acceptable to a mapping system designed to show the populated areas of the Earth, are much less acceptable if the object is to display the topography. In WorldWide Telescope the projection of flat images onto a sphere is done using a method called TOAST projection -- a projection system that does not prioritize one area of a sphere over another.

This document provides background information on the theory and practice of
TOAST projection. Equirectangular, Mercator and Gnomonic maps can be converted
to the TOAST format, and are discussed as *source* projections.

- WorldWide Telescope Authoring
- WorldWide Telescope Data Files Reference
- WorldWide Telescope Data Tools Guide
- WorldWide Telescope Web Control Script Reference

The following projections can be used as the source for a conversion to the TOAST format:

With Equirectangular coordinates, every pixel represents the same number of degrees of latitude and longitude for planets, and degrees for Right Ascension (RA) and Declination (Dec) for sky surveys. Equirectangular projection is by far the most common system used to represent earth maps, such as the NASA Blue Marble map shown below. The utility of this projection is greatly assisted by the simple fact that very few people live near the poles, where the projection becomes problematic, in particular all the points along the top of an equirectangular projection represent only one point in 3D space, namely the North Pole. And of course there is a similar singularity for the lower edge of the map and the South Pole.

This composite image of Earth was taken in January 2004. Credit: NASA, Visible Earth. |

The wider problem with equirectangular projections is that the relative sizes of objects (land masses in the map above) are substantially incorrect. An equirectangular image that covers the entire sphere will have a 2 x 1 aspect ratio, so it is two times as wide as it is high (a full circumference east-west, half a circumference north-south).

Unlike equirectangular projection, Mercator projection preserves angles, so is useful in marine navigation, but at the expense of distorting the relative sizes of land masses. The distortion of sizes is even greater than in equirectangular projection, with Greenland appearing about the same size as Africa in Mercator projection, about half the size in equirectangular projection, and about one fourteenth the size on a globe.

Mercator projection is a specific example of cylindrical projection -- where horizontal lines are preserved in the mapping.

A flat map is achieved by projecting from the center of the sphere, perpendicularly through the surface of the sphere, to a tangent plane. Unlike the previous two projection systems gnomonic only enables less than half of the sphere to be projected onto one map. Also known as tangential projection, gnomonic projection displays all great circles as straight lines, so for example, the meridians and equator appear as straight lines on the map.

TOAST (Tessellated Octahedral Adaptive Subdivision Transform) is an extension of as system of representing a sphere as a hierarchical triangular mesh. The extension takes the mesh and flattens it into a square for use as a texture.

A Hierarchical Triangular Mesh (HTM) is a representation of a sphere proposed by astronomers in the Sloan Digital Sky Survey. It first models the sphere as an octahedron, then recursively subdivides each triangular face until the sphere is closely approximated by a highly tessellated polyhedron. WorldWide Telescope extends the concepts of HTM, where the subdivided octahedron is folded out flat into a square.

The recursive subdivision of tiles using an HTM system is shown in the following images. Basically, a sphere is modeled as a polygon (starting with an octahedron) that has lots of triangular faces. If the octahedron was folded flat, the North pole would be at the center, the south pole at each of the four corners, and the equator would form a diamond within the square.

The following images shows the first three levels of HTM subdivision. As each side is subdivided the new point would be on the surface of a perfect sphere. Even after just three iterations the polyhedron is getting close to approximating a sphere.

Image credits: Jonathan Fay, Tom McGlynn (NASA SkyView) |

When the equirectangular earth map is converted to TOAST, it looks like the following:

The unusual warping in this image can be interpreted. The North Pole is in the center, and Antarctica split into four at the corners. In fact, all four corners meet at exactly the same point – the South Pole. The Equator follows a square whose corners are the middle of each side (shown by a red line in the image). The wrap-around in TOAST is shown in the following image. Each point on the side of the TOAST square, for example, A, B, C and D, will be adjacent to the points A`, B`, C` and D` when the projection is mapped onto a sphere.

The following images show the process a little simpler. The 1000 x 500
pixel equirectangular image on the left produces the TOAST projection on the
right, and if the collection file produced by the Sphere Toaster tool (with the
output set to **Planet**) is loaded into WorldWide Telescope, the
planet in the lower image will appear:

Right ascension and longitude values in TOAST depend on whether the projection is being used to represent the inside or outside of a sphere. Notice that the degrees of RA/longitude are on the opposite sides in the following two diagrams.

The inside of a sphere | |

The outside of a sphere |

The resolution of a TOAST image is not even across the square, for example the following three lines all represent one circumference of the sphere, yet all three lines are of different lengths (2L * sqrt(2), 2L, and L * sqrt(2) respectively, where L is the length of one side of the square). This difference in resolution across a single image is still far less than that of equirectangular projection.

The TOAST representation of a sphere can be a rather large square, so it is stored as an image pyramid. In this image pyramid, each lower level contains a higher-resolution version of the total image. One level down has twice the width and twice the height (so four times a greater area) of the image in the previous level. At each level, the image is tiled into 256 x 256 images. The purpose of having image pyramids is that as the viewer gets closer and closer to an object (a galaxy, for example) the rendering of that object becomes progressively more detailed. Alternatively as the viewer moves away from an object, less and less computing power is needed to render the image as lower levels of the image pyramid are used. The first level is a single 256 by 256 tile, which is obviously used when the view is at its maximum (perhaps looking at the stars from the Earth). At level 7, the default deepest level, there are 128 x 128 (16384) tiles.

## Level |
## Number of Tiles |
## Height, or Width, of the Total Image in pixels |
## Approximate TOAST Resolution (arcmin/pixel) |

0 |
1 | 256 | 42.19 |

1 |
4 | 512 | 21.09 |

2 |
16 | 1,024 | 10.55 |

3 |
64 | 2,048 | 5.27 |

4 |
256 | 4,096 | 2.64 |

5 |
1,024 | 8,192 | 1.32 |

6 |
4,096 | 16,384 | 0.66 |

7 |
16,384 | 32,768 | 0.33 |

8 |
65,536 | 65,536 | 0.165 |

9 |
262,144 | 131,072 | 0.0825 |

10 |
1,048,576 | 262,144 | 0.04125 |

11 |
4,194,304 | 524,288 | 0.020625 |