txmake - convert image file into texture file


SYNOPSIS

   txmake 
	[-shadow | -envlatl | -envcube  [-fov angle]] | [-minmaxshadow] | [-pyramidshadow]
	[-mode modename] | [[-smode modename] [-tmode modename]]  
	[-ch list] 
	[-short | -float | -word | -byte] 
	[-pattern p] 
	[-filter name]  
	[-filterwidth width] |  [[-sfilterwidth swidth] [-tfilterwidth twidth]] 
	[-format type [pixar or tiff]] 
	[-resize operation]
	[-memory size]
	[-usermipmap picnames txtname]
	[-extraargs str]
	[-compression type [none or lossless or lossy]]
	[-newer | [-verbose] picnames txtname] 

DESCRIPTION

txmake reads an image file called picname in Tag Image File Format (TIFF) and creates a PhotoRealistic RenderMan texture file called txtname. The previous contents of txtname (if any) are silently overwritten.

To make a shadow texture map, the -shadow option must be used, and the input depth image is read from a "zfile" which is produced by the zfile(4) display driver.

In order to make an environment texture, the -envlatl option may be used to convert a latitude-longitude image into a "latlong" environment texture, or the -envcube option can be used to convert a set of six cube face images into a "cube face" environment texture. In the cube face case, the -fov angle option can be used to specify a field-of-view angle in degrees, if the default field of view of 90 degrees was not used. The field of view may vary from 90 to 179 degrees.

In the case of a cube-face environment map, selected with the -envcube option, picnames consists of a sequence of six image names corresponding to six cube face views in the order: px, nx, py, ny, pz, and nz. The option selects the cube-face environment case. In all other cases, picnames consists of a single image name.

Standard TIFF black-and-white, grayscale, color-mapped, and RGB full-color images (TIFF B,G,P,R) are accepted, with the exception that only images with 1, 2, 4, or 8 bits per sample are accepted. In addition to the standard classes, 16 bit-per-sample RGB images and single-precision floating point images are accepted as are 4-channel images.

Images in Alias format are also accepted.

The -format option can be use to output files as either Pixar texture files (txmake -format pixar) or Pixar tiff textures (txmake -format tiff). The default setting is tiff textures. The default behavior may be changed in the rendermn.ini file.

Textures are indexed using (s,t) coordinates ranging from 0 to 1. Note that the coordinates of a texture map are like the coordinates of a raster image: the pixel with texture coordinates (0,0) is at the upper left corner of the image. The s coordinate increases to the right and the t coordinate increases from top to bottom.

For reasons internal to the texture mapping software, texture files must be an even power of two in width and height. Any input image which is not already a power of two in both dimensions will be resized, as described below.

For shadow textures, the resolution of the texture file is derived from the height and width of the image file, each rounded up to the next larger power of two. For example, a 256×512 image file will generate a 256×512 texture, while a 250×84 image file will generate a 256×128 texture. Additional black (zero) pixels are added to the picture data as necessary to fill the texture file. The shadow operation may be incorrect for input images that are not sized to powers of two.

For simple textures or environment textures the resolution of the texture file is determined from the height and width of the image file and the operation specified by the -resize option. If either the width or the height of the image is an exact power of two, that dimension is left unchanged. Any dimension that is not an exact power of two will be adjusted according to the -resize operation. The resize operation may be one of:

up
the image is resized up to the next higher power of two. Texture access will correct for the resize.
down
the image is resized down to the next lower power of two. Texture access will correct for the resize.
round
the image is resized to the nearest power of two. Texture access will correct for the resize.
up-
the image is resized up to the next higher power of two. Texture coordinates will be 0 to 1 across the resulting image.
down-
the image is resized down to the next lower power of two. Texture coordinates will be 0 to 1 across the resulting image.
round-
the image is resized to the nearest power of two. Texture coordinates will be 0 to 1 across the resulting image.
none
the image is not resized, the texture map size will be the next higher power of two. Texture file area not covered by the image will be set to black. Texture coordinates will be 0 to 1 across the resulting image. This is compatible with previous releases.

The default resize operation is up. When texture access corrects for the resize operation, as in up, down and round, the texture coordinates are 0 to 1 across the longest dimension and adjusted by the image aspect ratio across the shorter dimension so that image pixels will remain square if texture mapped onto a square patch.

The resize operation uses the filter specified by the -filter option. The recognized filters are the standard RenderMan filters: box, triangle, gaussian, catmull-rom, sinc and bessel. If no filter is specified catmull-rom is used with a width of 3. The width of the filter is determined by either the -filterwidth option to specify the same width in the s and t directions, or the -sfilterwidth and -tfilterwidth options to specify different widths in the s and t directions. If no width is specified, a width of 1.0 is used. (This is a poor choice for some filters. If you are not sure what to specify, allow the filtername to default and an appropriate width will be selected along with it.)

The -mode, -smode, and -tmode options can be used to specify the desired texture coordinate "wrap modes" which will be used to access the texture. -mode sets both s and t coordinate modes, while -smode sets only the s coordinate mode and -tmode sets only the t coordinate mode. The legal modes are black, clamp, and periodic. The default mode for both s and t is black. The resize operation takes the wrap mode into account for the resize filtering at the texture edges.

By default, the number and order of channels in the texture file depends directly on the set of channels in the image file. An RGBA picture will generate a four-channel texture. An RGB picture will generate a three-channel texture. An R picture will generate a one-channel texture. The -ch option can be used to select and reorder the channels of the image file. The letters r, g, b and a are used to select the red, green, blu, and alpha channels of the image file respectively. -ch g selects only the green channel of the image file and puts it into channel 0 of the texture file. A list of letters can be used to select multiple channels: -ch rgb will select the RGB channels of the image file. -ch brg will select the RGB channels and put them into the texture channels in the order blue, red, green.

By default, the precision of each texture channel is 8 bits per pixel. The -short option can be used to change the precision of each texture channel to 16 bits per pixel. The texture contents is signed 16 bit integers. When making short textures from TIFF images, txmake uses the appropriate TIFF tags to determine if the image data is signed or unsigned and properly converts to the signed texture data format. The -float option can be used to change the precision of each texture channel to 32 bits per pixel floating point. Floating point textures can be made from TIFF images with 32 bits per pixel and their sample format set to IEEE floating point. The -lossy option outputs the floating point textures in a format that provides better compression while still preserving much of their dynamic range. 

Shadow maps are always 32 bits per pixel floating point.

The -pattern option can be used to control the set of filtered texture resolutions which are generated by txmake and stored in the texture file. By default, the pattern is diagonal, which means that lower resolution textures are generated by successively reducing the texture image to one-half of its resolution in both the s and t directions. This results in a texture file which is approximately one-third larger than the original texture image.

Other patterns are:

single
Only a single texture image is stored in the texture file. This will result in very poor texturing performance for most applications.
all
A more complete set of texture images is stored in the texture file. This will make the texture file approximately four times as large as the original texture image (that is, four times as large as the single case). Texturing performance may be better than the default diagonal pattern for images in which the texture is applied to a severely foreshortened surface, or when the range of one texture coordinate is far different from the range of the other.

Shadow maps always use the single pattern.

The amount of memory that txmake will allocate to make the texture can be set using the -memory option. The value is the amount of memory allowed expressed in increments of 1024 bytes. The default value is 2048, for 2048k bytes or 2 megabytes of memory. This default value can handle shadow files that are 16k pixels wide or byte rgba textures that are 8k pixels wide. If you need to make texture files wider than this, you should adjust the value accordingly.

The -usermipmap option allows the specification of mipmap levels. Usage of this command is as follows:

txmake -usermipmap picnames txtname

The files in picnames correspond to the levels in the pyramid (first name in picnames = highest resolution level of the pyramid). Note that there are several rules for generating these "user mip-maps":

SEE ALSO

txinfo(1)

 

Pixar Animation Studios
(510) 752-3000 (voice)   (510) 752-3151 (fax)
Copyright © 1996- Pixar. All rights reserved.
RenderMan® is a registered trademark of Pixar.