Planettool

From Elite Wiki
Revision as of 20:34, 8 February 2012 by Svengali (talk | contribs) (added category -> Oolite_utilities)

planettool is a tool for working with textures for planets. Its main purpose is to convert equirectangular projection textures to cube map textures. It was developed for Oolite, but should work anywhere you need planet textures or cube maps. It is available from the Oolite file repository. It comes in two forms: a cross-platform command line tool, and a graphical application for Mac OS X only.

Overview

The basic function of planettool is to read a texture map for a sphere in one coordinate system, and write it out in a different coordinate system (or the same one, if you really want to). It does this using high-resolution sphere domain supersampling and floating-point, linear-space colour blending for high quality output.

While doing this, planettool can also mirror and rotate the texture in 3-space.

Usage (command line)

planettool --input <inType> <inFile> --output <outType> <outputFile> [options]
planettool --generator grid1 --output <outType> <outputFile> [options]
planettool --help

planettool takes either an input file and type or a generator, and produces and output file of the specified type. In this context, “type” refers to the projections listed below.

The additional options are:

  • --size (-S): The size of the output file, in pixels. For cube and cubex types, this is the size of each edge. For the latlong type, it’s the height of the output file. For the Mercator and Gall-Peters projections, it is the width of the output file. Broadly speaking, a given size value for a cube type provides twice as much overall detail as for the latlong type. Note that textures should always have power-of-two sizes.
  • --fast (-F): Use faster, lower-quality rendering. Useful for previewing options.
  • --jitter (-J): Use stochastic supersampling. This makes rendering much slower, but can eliminate certain types of aliasing artefacts (at the cost of added noise). Try this if you see noticeable artefacts caused by repeating patterns in the input file.
  • --flip (-L): Mirror the texture through the YZ plane of the projection sphere. This corresponds to mirroring a latlong texture horizontally:
    Planettool-flip.png
    Oolite requires cube map textures to be flipped.
  • --rotate <rx> <ry> <rz> (-R): Rotate the texture around the projection sphere. Rotations are applied in the following order: first around the X axis, then around the Z axis, and last around the Y axis. If this is inconvenient, you can supply any number of --rotate (and --flip) options, which will be chained together. The axes are assigned as follows:
  • --sixteen-bit: The output image is saved as a sixteen-bit-per-channel picture (that is, 64 bits per pixel).

Usage (Mac OS X)

Screen shot of Planet Tool 0.4.2 for Mac OS X, showing a Mercator projection of the Earth taken at a 45° angle.
Planet Tool 0.4.2 for Mac OS X

For Mac OS X 10.5 and later, the command line tool may be used as above, but a normal graphical application named Planet Tool is also included. The rendering functionality is identical to the command line tool, but it has an interactive user interface with a live preview.

To use, open a PNG image in the normal fashion, or select “New Grid Generator” from the File menu. Planet Tool will guess at appropriate settings based on the size and shape of the input file, but you can change these settings as you wish.

  • Input Format and Output Format: select source and target projections.
  • Output Size: select the desired size of the output image. The meaning of this value depends on the output projection, and is explained in the caption. The stepper control changes the size in power-of-two increments – note that textures should always have power-of-two sizes.
  • Flip: select to mirror the texture through the YZ plane of the projection sphere. This corresponds to mirroring a latlong texture horizontally:
    Planettool-flip.png
    Oolite requires cube map textures to be flipped.
  • Rotate: specify rotation of the texture around the projection sphere. Rotations are applied in the following order: first around the X axis, then around the Z axis, and last around the Y axis. The axes are assigned as follows:
  • Fast: select to use faster, lower-quality rendering. Useful for previewing options.
  • Jitter: select to use stochastic supersampling. This makes rendering much slower, but can eliminate certain types of aliasing artefacts (at the cost of added noise). Try this if you see noticeable artefacts caused by repeating patterns in the input file.
  • Preview pane: shows a fast rendering of the current options.

Once the appropriate options are selected, press the “Render…” button (or select “Render…” from the File menu) to render the image.

Projections

Each projection is shown with the grid generator (a grid with lines at ten-degree intervals of latitude and longitude, each 0.5 degrees wide), an image of the Earth, and labels identifying the cardinal directions, with no rotation or flip options selected.

Equirectangular (Latitude/Longitude)

Planettool-grid-latlong.png Planettool-world-latlong.jpg Planettool-xyz-latlong.png

Command line name: latlong

In the equirectangular projection, the intervals between pixels are constant steps of latitude and longitude. This is conceptually simple, but inefficent; lots of pixels are crammed together tightly near the poles.

Cube

Planettool-grid-cube.png Planettool-world-cube.jpg Planettool-xyz-cube.png

Command line name: cube

The surface is divided into six equal areas, which are projected onto squares. These are then stacked vertically, in the following order: +x, -x, +y, -y, +z, -z. This is the format Oolite requires for cube maps.

Note: cube maps can be used as input, but support is currently incomplete. Artefacts will appear at the seams between cube faces.

Cube (Cross)

Planettool-grid-cubex.png Planettool-world-cubex.jpg Planettool-xyz-cubex.png

Command line name: cubex

The same projection as cube, but the squares are rearranged into a more human-friendly layout (which can be printed and folded into a cube if you're bored).

Note: cross cube maps can be used as input, but support is currently incomplete. Artefacts will appear at the seams between cube faces.

Mercator

Planettool-grid-mercator.png Planettool-world-mercator.jpg Planettool-xyz-mercator.png

Command line name: mercator

The main feature of the Mercator projection is that it preserves angles, making it the traditional projection for sailors and people who can't be bothered to choose a more appropriate projection for whatever they're doing. Since it wastes even more pixels near the poles than the equirectangular projection and doesn’t actually reach the poles at all, it’s entirely unsuitable for texturing, but could be useful if you want a wall map.

Note: the Mercator projection can only be used for output.

Gall–Peters

Planettool-grid-gall-peters.png Planettool-world-gall-peters.jpg Planettool-xyz-gall-peters.png

Command line name: gall-peters

Another real-word map projection, the Gall–Peters projection is a variety of cylindric equal-area projection, in which the proportions between different areas are preserved. This is a somewhat popular projection among people who want to make political points about the sizes of different countries, but not so much among cartographers, who prefer maps that give some idea of the shapes of things and can be used for navigation.

Note: the Gall–Peters projection can only be used for output.

Links