Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page64/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   60   61   62   63   64   65   66   67   ...   106
GLIDEPGM

12Combining Textures


The Voodoo Graphics hardware can combine multiple textures together simultaneously. This allows for interesting effects including detail texturing, projected texturing, and trilinear texture mapping. Combining two textures requires a single pass with two TMUs or two passes with a single TMU. Combining two textures is controlled with the function grTexCombine().
Each TMU selects an appropriate texel for the current rendering mode and filters it (point sampled or bilinear, as determined by a mipmap’s associated filtering mode or the most recent call to grTexFilterMode()), then passes the texel on to the texture combine unit. The texture combine unit combines the filtered texel with the incoming texel from the other TMUs, according to the user-selectable formula defined by the most recent grTexCombine() function. The simplest combine function is a simple passthru that implements decal texture mapping. However, more elaborate texture mapping combinations can be used to implement useful effects such as trilinear mipmapping, composite texturing, and projected textures.
void grTexCombine( GrChipID_t tmu,
GrCombineFunction_t rgbFunction,
GrCombineFactor_t rgbFactor,
GrCombineFunction_t alphaFunction,
GrCombineFactor_t alphaFactor,
FxBool rgbInvert,
FxBool alphaInvert
)
The first argument names the TMU to which the rest of the arguments apply. Valid values are GR_TMU0, GR_TMU1, and GR_TMU2. The next two arguments, rgbFunction and rgbFactor, describe the combining function and scale factor for the red, green, and blue components produced by the texel selection circuitry of tmu. Similarly, alphaFunction and alphaFactor define the combining function and scale factor for the alpha component. Table Texture Mapping.4 lists the possible combining functions; the scale factors are detailed in Table Texture Mapping.5. In both tables, clocal and alocal represent the color components generated by indexing and filtering from the mipmap stored on tmu; cother and aother represent the incoming color components from the neighboring TMU (refer to Figure Texture Mapping.1).
The texture combine units compute the function specified by the rgbFunction and alphaFunction combine functions and the rgbFactor and alphaFactor combine scale factors on the local filtered texel and the filtered texel from the upstream TMU. The result is clamped to [0..255], and then a bit-wise inversion may be applied, controlled by the rgbInvert and alphaInvert parameters. Inverting the bits in an 8-bit color component is the same as computing (255 – c).

Download 6.22 Mb.

Share with your friends:
1   ...   60   61   62   63   64   65   66   67   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page