HowTo:Textures

From S2PLOT

Jump to: navigation, search

How to convert your images to textures for use with S2PLOT

S2PLOT includes two very basic scripts for converting images to textures for use with S2PLOT. The scripts are:

  • texturise1.csh which creates a 24-bit RGB texture file having power-of-2 sidelengths, from an input image.
  • texturise.csh which creates 24-bit RGB texture files having power-of-2 sidelengths, from one or more input images.

Both scripts use the ImageMagick identify and convert programs so an installation of ImageMagick is required for these scripts to function correctly. The S2PLOT_IMPATH environment variable should be set to the directory in which these binaries can be found. Additionally the standard unix utilities bc and awk are used.

texturise1.csh

This script is called as follows:

texturise1.csh [-crop | -scale | -scale+] inputimage outputimage

The output image should ordinarily have extension .tga as it will be a Targa format image. The required first argument controls the scaling of the image to produce power-of-2 sidelengths:

  • -crop crop both sides to largest power-of-2 that is still smaller than each sidelength. The image is not stretched or squashed, but cropped.
  • -scale scale both sides to largest power-of-2 that is still smaller than each sidelength. The entire image is retained and is stretched/squashed to fit in the chosen dimensions.
  • -scale+ scale both sides to smallest power-of-2 that is just larger than each sidelength. The entire image will be present but is likely to be stretched/squashed.

texturise.csh

This script is called as follows:

texturise.csh [-crop | -scale | -scale+] inputimage[s]

This script converts one or more input images and decides on the output image names itself. The first argument has the same meaning as in texturise1.csh

Personal tools