The Texture Mapping Lookup Table


For a list of related topics and for a list of all texture mapping functions, see Texture Mapping.

There are many controls which are applied to a texture map. Texture maps are referenced through a lookup table to allow multiple combinations of control values to be easily applied to the same texture map. See also Texture Mapping Table. The table mechanism also facilitates ensuring control values, many of which are dependent on the specific texture map, are valid.

The rendering control field of the texture mapping lookup table controls whether the texture is applied before or after the primitive is lit.

Several of the fields control parameterization, that is, how texels are mapped to a facet. The parameterization method field specifies how the texture map coordinates for each vertex are determined. (See also Parameterization Controls). The texture map coordinates select a position in the texture map. The portion of a texture map selected by the vertices's texture map coordinates is then applied to the facet. The PEXTMParamVertexCoordMC, PEXTMParamVertexCoordWC, PEXTMParamVertexNormalMC, PEXTMParamVertexNormalWC, PEXTMParamNURBUV, and PEXTMParamFloatData parameterization methods use the vertex, normal, u-v parameterization, or floating-point data list data directly as the texture map coordinates. Field fp data index of the texture mapping lookup table defines the index within the floating-point data list of the first of the consecutive texture mapping coordinates when the parameterization method is PEXTMParamFloatData. The PEXTMParamReflectionSphereVRC and PEXTMParamReflectionSphereWC parameterization methods select texture map coordinates by picking them off a conceptual sphere surrounding the facet. A special reflection vector calculated for each vertex is used to select a point on the sphere. The resulting texture mapping is often called environment mapping since the texturing is view dependent - the facet appears to reflect fixed objects as the facet is moved around. The reflection matrix and hints field of the texture mapping lookup table is applied only when one of these environment mapping parameterization methods is selected. The reflection matrix is used to transform the reflection vectors before they select the texture coordinates from the sphere, which has a fixed orientation.

Independent of the parameterization method used, the texture map coordinates are lastly transformed by the orientation matrix defined by the orientation matrix and hints field of the texture mapping lookup table. After this transformation, a vertex's texture map coordinates are ready to select a position on the texture map. See also Orientation, Transformation, Interpolation, and Perspective Correction.

Another group of fields in the texture mapping lookup table control the sampling of the color mipmap. (See also Sampling Control.) When one pixel corresponds to multiple texels, the min sample method field indicates how the texel data is sampled down to derive a single color value. The mag sample method field controls the opposite case of one pixel corresponding to less than a single texel. The sample methods support a wide range of sampling options to determine the color value, from PEXTMSampleSingleBase, which uses a single texel in the base level of the texture map, to PEXTMSampleWeightedBetweenMipmaps, where the weighted averages of 2n texels on each of the two levels nearest the sample depth are determined, then interpolated to the sample depth. The sampling hints field potentially adjusts the sampling depth, making the texturing more detailed or blurred than it otherwise would have been. It is also used to indicate blurring is unacceptably high due to low spatial frequency in a particular direction in the color mipmap.

Textures sometimes map to something less than the entire facet. The t0, t1, and t2 boundary condition fields specify how the region in each direction outside the mapped texture is handled. PEXlib defines the following boundary conditions:

PEXTMBoundaryWrap
indicates the texture is repeated across the facet.

PEXTMBoundaryMirror
also indicates the texture is repeated, but alternately in reverse order.

PEXTMBoundaryClampBorder
indicates the closest border texel is used to determine the sampled color value beyond that border.

PEXXTMBoundaryClampExplicit
indicates the boundary clamp method field is used to determine the boundary condition. (This level of indirection exists to prevent ambiguity in regions which extend outside the mapped texture in more than one direction.)

PEXlib defines the following clamping methods:

PEXTMBoundaryClampExplicitDiscontinue
boundary clamp method that indicates texturing is to be discontinued beyond the mapped texture, that is, the primitive's color before applying that texture map is preserved.

PEXTMBoundaryClampExplicitColor
boundary clamp method that indicates the boundary clamp color field specifies the texture's color value.

For the sampling methods that use multiple texels on a mipmap level to compute a weighted average, it is possible that the neighboring texels do not exist because the implementation is sampling near the texture map boundary. In these cases, the implementation synthesizes the missing texels by using the boundary condition in effect. However, a boundary condition of PEXTMBoundaryClampExplicit with a clamping method of PEXTMBoundaryClampExplicitDiscontinue does not cause the primitive's intrinsic color to be included in the weighted average.

The remaining fields in the texture mapping lookup table specify the blending of the color values derived from the texture map and boundary conditions with the primitive's color. The composition method field specifies how this blending is done:

PEXTMCompReplace
indicates the primitive's color is replaced with the derived texture color. The alpha component is set to 1.0 if the texture map didn't include an alpha component.

PEXTMCompModulate
specifies the primitive's color and derived texture color are multiplied.

PEXTMCompBlendEnvColor
indicates the derived texture color is multiplied by the color specified in the environment color field. The result is added to the multiplication of the primitive's color and the inverse of the derived texture color. The primitive's alpha component is just multiplied by the derived texture alpha component (1.0 if not present).

PEXTMCompDecal
specifies the derived texture color is multiplied by its alpha component. The result is added to the multiplication of the primitive's color and the inverse of the derived texture alpha component. The primitive's alpha component is not modified.

PETMCompDecalBackground
is identical to method PEXTMCompDecal except the color specified in the background color field is used instead of the primitive's color.