Page 1 of 3

Planettool 0.4.2 released

Posted: Fri Apr 23, 2010 7:53 pm
by JensAyton
Planettool 0.4.2 is now available from GURPO, in Mac, Windows, Linux and source forms.
Old download link is invalid; the Mac build is now available here.

This is a tool for working with planet textures. Most usefully, it can convert lat/long textures to cube maps. A typical invocation:

Code: Select all

% planettool --input latlong my-latlong-map.png --output cube my-cube-map.png --flip --size 512
Bug fixes in 0.4.2:
  • Fixed sixteen-bit-per-channel output on platforms other than Mac OS X.
  • Fixed jittering in Windows.
  • Error message instead of crash when specified size is too large to allocate memory for.
New features in 0.4.2:
  • Interactive, graphical version for Mac OS X.
Bug fixes in 0.4.1:
  • Fixed cubex output.
Bug fixes in 0.4:
  • When reading from a lat/long map, linear interpolation is now used in normal rendering and nearest-neighbour in fast mode, instead of the other way around.
  • Fixed a quantization bug in gamma correction, which caused a posterising effect.
  • Fixed a half-pixel seam at 180° longitude when reading from a lat/long map.
New features in 0.4:
  • Sixteen bit per channel export mode.
  • Mercator and Gall-Peters projection output modes for maps.
Known issues:
  • It’s rather slow.
  • While it can read from cube maps, it fails at the edges of faces and produces artefacts. This does not affect writing cube maps.
  • Writing cube maps with both the --fast and --jitter options results in strangely clipped output.
Official documentation, as per planettool --help:

Code: Select all

Planettool version 0.4.1
planettool -o <outType> <outFile> [-i <inType> <inFile>] [-g <generator>] [-S <size>] [-F] [-J] [--sixteen-bit] [-L] [-R <ry> <rx> <rz>] [-H] [-V] [-Q]

    --output, -o:  Type and name of output file. Type must be one of: "latlong" (l), "cube" (c), "cubex" (x), "mercator" (m), "gall-peters" (g)
     --input, -i:  Type and name of input file. Type must be one of: "latlong" (l), "cube" (c), "cubex" (x)
  --generate, -g:  Type and name of generator. Type must be one of: "grid1" (g)
      --size, -S:  Size of output, in pixels. Interpretation depends on output type.
      --fast, -F:  Use faster, low-quality rendering.
    --jitter, -J:  Use jittering for slower, slightly noisy rendering which may look better in some cases.
   --sixteen-bit:  Save in sixteen bit per channel format (instead of eight-bit-per-channel format).
      --flip, -L:  Mirror the texture in 3D space (through the YZ plane) while rendering. This produces an "inside-out" texture.
    --rotate, -R:  Rotate the texture around the planet while rendering. The ry axis corresponds to the planet's axis of rotation.
      --help, -H:  Show this helpful help.
   --version, -V:  Show version number.
     --quiet, -Q:  Don't print progress information.

Planettool reads a texture map from an input file (in PNG format) or a generator
function, and writes it to an output file (in PNG format). In so doing, it may
change the projection and scale of the map, and may rotate it around the planet.

Planettool's design is geared for flexibility and quality. As a side effect, it
is extremely slow. Don't be alarmed if it takes several minutes to do anything.

EXAMPLES:
planettool --output cube "cubemap.png" --input latlong "original.png" --size 512
    Reads original.png, treated as a latitude-longitude map, and remaps it to a
    cube map with a side length of 512 pixels.

planettool -o c cubemap.png -i l original.png -S 512
    Same as above, only less legible for extra geek cred.

planettool -o cube grid.png --generator grid1 --fast --rotate 30 0 0 --flip
    Generate a grid, tilted 30 degrees and projected onto an inside-out cube map
    at low quality.

THE PROJECTION TYPES:
    latlong: Equirectangular projection. In this format, 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: 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.
      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).
   mercator: An angle-preserving map projection. The traditional projection for
             sailors and people who can't be bothered to choose a more approp-
             riate projection for whatever they're doing. Entirely unsuitable
             for texturing, but possibly useful if you want a wall map.
gall-peters: A variant of the cylindric equal-area projection, in which the
             proportions between different areas are preserved.

THE GENERATORS:
      grid1: A grid with lines spaced ten degrees apart. Longitude lines are
             green in the northern hemisphere, blue in the south. Latitude lines
             are red in the western hemisphere, teal in the east.

Posted: Fri Apr 23, 2010 10:36 pm
by JensAyton
I have noticed two bugs:
  • When reading from a lat/long map, linear interpolation is used in fast mode and nearest-neighbour sampling is used in full quality mode, instead of the other way around. This reduces quality especially in any areas that need to be upsampled. This has been fixed in trunk.
  • There is a serious colour management problem going on, as seen in the seas in my standard Earth texture. (below) I somehow missed this because I’ve been focussing on other types of test patterns.
The geometry is correct, so it’s good enough for testing, but not deployment.

Image

Posted: Fri Apr 23, 2010 11:14 pm
by JensAyton
The colour issue is fixed. There will probably be a new release tomorrow.

Posted: Sat Apr 24, 2010 12:35 am
by SiriusCG
As a new Oolite user, can you tell me what this tool is used for?

Cheers.

Posted: Sat Apr 24, 2010 12:56 am
by JazHaz
SiriusCG wrote:
As a new Oolite user, can you tell me what this tool is used for?
It's for the current trunk version, which recently got a new ability to handle cube maps, for planet textures.

Posted: Sat Apr 24, 2010 8:32 am
by JensAyton
SiriusCG wrote:
As a new Oolite user, can you tell me what this tool is used for?
As a user, not much. If you’re making OXPs with planets or custom shaders, a wide variety of uses are possible. :-)

Posted: Sat Apr 24, 2010 5:45 pm
by JensAyton
0.4 released; first post updated.

Posted: Sat Apr 24, 2010 7:49 pm
by JensAyton
0.4.1 released; first post updated.

Posted: Sat Apr 24, 2010 9:26 pm
by Svengali
Hehe, nice tool, Ahruman. Thanks a lot - played a bit with v0.2 yesterday. Great.

Posted: Sun Apr 25, 2010 12:14 pm
by Eric Walch
You can find here some lat-long maps of planets and moons from our solar system to experiment with.

Posted: Sun Apr 25, 2010 12:15 pm
by JensAyton
And lots of Earth from NASA’s Visible Earth.

They have an Invisible Earth too, but I can’t find it now.

Posted: Sun Apr 25, 2010 5:21 pm
by Cmd. Cheyd
Is there any chance one of you complete geniuses would consider turning this into a Photoshop Script or Plug-In? Is it even possible?

Also - If I've got a latlong in 2048 x 1024, and want to maintain that level of detail, what output size do I need to specify?

Posted: Sun Apr 25, 2010 7:10 pm
by JensAyton
Cmd. Cheyd wrote:
Is there any chance one of you complete geniuses would consider turning this into a Photoshop Script or Plug-In? Is it even possible?
From what I hear, making Photoshop plug-ins is extremely painful, which is part of the reason only professionals do it. Another reason would be the need to have several versions of Photoshop for each target platform.

A script might be possible, but would be many times slower.
Cmd. Cheyd wrote:
Also - If I've got a latlong in 2048 x 1024, and want to maintain that level of detail, what output size do I need to specify?
The closest equivalent is 512.

Posted: Mon Apr 26, 2010 11:47 am
by Getafix
Planettool 0.4.1 for linux-x86 and linux-x86_64, has just been released.

EDIT: ...and has just been removed. OpenSuse reported some issues with libpng14.
EDIT: OpenSuse libpng14 issues are fixed in v2. Release is now available.

Posted: Wed Apr 28, 2010 7:59 pm
by JensAyton
0.4.2 released; first post updated. This fixes some bugs with the more obscure options.

Also, to save myself the trouble of writing a comprehensible guide to command line tools, I wrote a graphical version for Mac OS X.

Image

The graphical version requires Mac OS X 10.5 or later. The command line tool is still included and should work in 10.4.