Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Texture Overview

"Texture mapping" is a way of painting (possibly part of) an image onto one or more polygons, so that it correctly moves and scales with the polygon(s). It can be used, for example, to map a photograph of a storefront onto a simple polygonal box, providing greatly enhanced visual impact without loading the machine down with huge numbers of polygons.

Performance of texture-mapping varies from atrocious on current (1994) low-end machines in which it must be simulated entirely in software, to marvelous on current high-end machines with massive hardware support for it. I expect to see high-performance texture-mapping become routinely available on graphics workstation within two to four years, and on personal computers within about a decade, and expect it to be more or less the norm for routine graphics thereafter.

The basic idea is to take an arbitrary image -- the texture -- and impose a (0,1),(0,1) two-dimensional coodinate system upon it. (We ignore more exotic one- and three-dimensional textures.)

If, when rendering a polygon, we then specify the coordinates of each polygon vertex on this texture, in this two-dimensional texture coordinate system, the rendering engine (whether software or hardware) can then in essence snip out the specified part of the texture image and paste it onto the polygon during rendering.

There is lots of fun involved in actually doing this "pasting" operation, since the image may need to be scaled and warped to fit the polygon image on the screen, but as users, we needn't normally be terribly concerned with that: Our job is mainly to provide the texture image, and then to provide appropriate texture coordinates at each vertex of the polygon(s) in question.

Texture instances accept images in the standard package format of a two-dimensional thing such as those created by xg.3d-make-image-grl, containing canonically three class-8-bit-float-array instances named :PIXEL-RED, :PIXEL-GREEN, and :PIXEL-BLUE. (Monochrome images are usually represented by omitting the :PIXEL-RED and :PIXEL-BLUE arrays.)

Texture coordinates may be specified in either the facet or the point relation: either can be appropriate, depending on the situation.

To provide texture coordinates via the point relation, we include arrays named :POINT-TEXTURE-U and :POINT-TEXTURE-V, allowing us to specify for each point a U,V coordinate in on the texture image. This is the appropriate way to map an image coherently onto a tiled sheet of polygons, with each polygon carrying a small fragment of the image.

To provide texture coordinates via the facet relation, we include (if we are using four-cornered facets) arrays named

:FACET-TEXTURE-U-0 :FACET-TEXTURE-V-0
:FACET-TEXTURE-U-1 :FACET-TEXTURE-V-1
:FACET-TEXTURE-U-2 :FACET-TEXTURE-V-2
:FACET-TEXTURE-U-3 :FACET-TEXTURE-V-3

providing one U,V texture coordinate for each corner of the facet. (Thus, for triangles, we would omit the :facet-texture-u/v-3 array pair.) This is the appropriate way to map a complete copy of the texture image individually onto each face of a cube, say -- something that cannot be done nicely with :point-texture-u/v because the same point that needs to be (0,0) for one facet may need to be (0,1) for an adjoining facet. Storing texture coordinates with the facet solves the problem.

(Should provide a minimal example here.)


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