Go to the first, previous, next, last section, table of contents.

### Texture Mapping

Some platforms support texture-mapped objects. (On those which don't, attempts to use texture mapping are silently ignored.) A texture is specified as part of an appearance structure, as in See section Appearances. Briefly, one provides a texture image, which is considered to lie in a square in `(s,t)` parameter space in the range 0 <= s <= 1, 0 <= t <= 1. Then one provides a geometric primitive, with each vertex tagged with `(s,t)` texture coordinates. If texturing is enabled, the appropriate portion of the texture image is pasted onto each face of the textured object.

There is (currently) no provision for inheritance of part of a texture structure; if the `texture` keyword is mentioned in an appearance, it supplants any other texture specification.

The appearance attribute `texturing` controls whether textures are used; there's no performance penalty for having texture { ... } fields defined when texturing is off.

The available fields are:

    clamp	none  -or-  s  -or-  t  -or-  st
      Determines the meaning of texture coordinates outside the range 0..1.
      With clamp none, the default, coordinates are interpreted
      modulo 1, so (s,t) = (1.25,0), (.25,0), and (-.75,0) all refer to
      the same point in texture space.  With s or t or
      st, either or both of s- or t-coordinates less than 0 or
      greater than 1 are clamped to 1 or 0, respectively.

    file	filename
    alphafile	filename
      Specifies image file(s) containing the texture.
      The file file's image specifies color or lightness information;
      the alphafile if present, specifies a transparency ("alpha") mask;
      where the mask is zero, pixels are simply not drawn.
      Several image file formats are available; the file type must be
      indicated by the last few characters of the file name:
        .ppm or .ppm.Z or .ppm.gz  24-bit 3-color image in PPM format
        .pgm or .pgm.Z or .pgm.gz  8-bit grayscale image in PGM format
        .sgi or .sgi.Z or .sgi.gz  8-bit, 24-bit, or 32-bit SGI image
        .tiff 		       8-bit or 24-bit TIFF image
        .gif		       GIF image
      (Though 4-channel TIFF images are possible, and could
      represent both color and transparency information in one image,
      that's not supported in geomview at present.)
      For this feature to work, some programs must be available in
      geomview's search path:
        zcat  for .Z files
        gzip  for .gz files
        tifftopnm for .tiff files
        giftoppm for .gif files

      If an alphafile image is supplied, it must be the same size
      as the file image.

    apply	modulate  -or-  blend  -or-  decal
      Indicates how the texture image is applied to the surface.
      Here the "surface color" means the color that surface would have
      in the absence of texture mapping.

      With modulate, the default, the texture color (or lightness,
      if textured by a gray-scale image) is multiplied by the surface color.

      With blend, texture blends between the background color
      and the surface color.  The file parameter must specify a
      gray-scale image.  Where the texture image is 0, the surface color is
      unaffected; where it's 1, the surface is painted in the color given
      by background; and color is interpolated for intermediate values.

      With decal, the file parameter must specify a
      3-color image.  If an alphafile parameter is present,
      its value interpolates between the surface color (where alpha=0)
      and the texture color (where alpha=1).  Lighting does not affect the
      texture color in decal mode; effectively the texture is
      constant-shaded.

    background  R G B A
      Specifies a 4-component color, with R, G, B, and A floating-point
      numbers normally in the range 0..1, used when apply blend
      is selected.

    transform transformation-matrix
      Expects a list of 16 numbers, or one of the other ways of representing
      a transformation (: handlename or < filename).
      The 4x4 transformation matrix is applied to texture coordinates,
      in the sense of a 4-component row vector (s,t,0,1) multiplied on
      the left of the matrix, to produce new coordinates (s',t')
      which actually index the texture.

Go to the first, previous, next, last section, table of contents.