Virtual textures consist of multiple levels of detail, each one four times
the size of the previous (twice the width, twice the height.) Every level
of detail is composed of 2n x n texture tiles, where n must be a power of
two. Celestia chooses the level of detail to use based on the size in
pixels of the object to be textured. The levels of detail do not need to
be fully populated; if a tile at the requested level of detail is not
available, Celestia will fall back to a lower level of detail that is
available. This allows you map planets with very high resolution at
particular locations without forcing you to map the entire planet at such
a resolution. In fact, since 1km/pixel maps of planets are cumbersome to
distribute online, I expect these detail tiles will be the main
application of virtual textures.
A virtual texture is identified by the extension .ctx. A ctx
file is actually just a text file in the familiar ssc-like format. There are
several fields describing the layout of the texture tiles. Here's my test
example:
Code: Select all
VirtualTexture
{
ImageDirectory "tiles"
BaseSplit 0
TileSize 256
TileType "jpg"
}
The image directory gives the location of the individual texture files.
BaseSplit determines the number of tiles in the lowest level of detail
(2^(baseSplit + 1) tiles wide, 2^baseSplit tiles high.) TileSize gives
the number of pixels in each dimension of the texture tiles. This value
is used to figure out what level of detail to use. It is not enforced,
and it could be very useful to have a higher resolution tile at the
highest LOD (though it's not recommended elsewhere.)
Code: Select all
foo/
foo.ssc
textures/
medres/
foo.jpg
hires/
foo.ctx
tiles/
level0/
tx_0_0.dds
tx_1_0.dds
level1/
tx_0_0.dds
tx_1_0.dds
tx_2_0.dds
tx_3_0.dds
tx_0_1.dds
tx_1_1.dds
tx_2_1.dds
tx_3_1.dds
level8/
tx_300_59.dds
In the above example, the planet is fully mapped at resolution levels 0 and 1, and there's one high detail tile at level 8. A few quick calculations . . . The base split here is 0. Let's assume that the tiles are 256x256. That means that the effective resolution at level 8 is 256*2*2^8 x 256*2^8, or 128k x 64k. For Earth, that's approximately 300m/texel. The general formula for the effective height of a virtual texture level is:
TileSize*2^(Level + BaseSplit)
The width is always double the height. I suppose that I should really make some sort of JavaScript calculator to compute sizes and the latitude and longitude ranges of tiles.
The main problem that I've had with creating virtual textures is finding high resolution data. I've got the 32k Earth texture split up into tiles, but I've been unable to find any higher resolution data. If anyone has some good links, please share them. Or better yet, go ahead and use it to create a virtual texture.
--Chris