Table of Contents Glide Programming Guide


Configuring the Texture Pipeline for Trilinear Texture Mapping



Download 6.22 Mb.
Page67/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   63   64   65   66   67   68   69   70   ...   106
GLIDEPGM

3Configuring the Texture Pipeline for Trilinear Texture Mapping


When doing standard mipmapping, noticeable banding can occur because of the visible differences in mipmap levels. One way around this is to blend two separate textures within a mipmap based on the LOD (level of detail) fraction bits. This is known as mipmap blending which, in conjunction with bilinear filtering, is referred to as trilinear texture mapping. To perform trilinear texture mapping the application must download a texture specifically for use with trilinear mipmapping and then use this texture only for blended mipmapping operations.
When using texture combining to implement mipmap blending (i.e. trilinear texture mapping), mipmaps must be created specifically for trilinear texture mapping on each Texelfx chip. The odd levels must be downloaded to one chip and the even levels must be downloaded to another chip, and the mipmaps must have the trilinear variable set to FXTRUE (see Chapter 10). The texture combine unit on the downstream TMU is set differently, depending on whether it holds the even or the odd LODs. The upstream TMU always uses decal mapping.
If a texture will be used for trilinear filtering and another combine operation (but not simultaneously), it must be allocated and downloaded twice, once with LODblend set to FXTRUE and the other time with LODblend set to FXFALSE.
Example Texture Mapping.3 Using trilinear filtering: mipmap blending with bilinear filtering.
The first code segment shows the texture combine unit configuration for trilinear mipmapping when the even LODs are stored in TMU0 and the odd ones are in TMU1. As usual, the code assumes that the textures are loaded, the TMU base registers are pointing to them, and the color combine unit is configured to make use of the resulting RGBA value.
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL,
GR_COMBINE_FACTOR_LOD_FRACTION,
GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL,
GR_COMBINE_FACTOR_LOD_FRACTION,
FXFALSE, FXFALSE);

grTexCombine( GR_TMU1, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,


GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE );


This second code segment gives the proper grTexCombine() configuration when the situation is reversed: the odd LODs in the mipmap are on TMU0 while the even ones are upstream on TMU1. Note the difference: the setting of the rgbInvert and alphaInvert parameters. We make the same assumptions as above.

grTexCombine( GR_TMU0,


GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL,
GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL,
GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
FXFALSE, FXFALSE);

grTexCombine( GR_TMU1, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,


GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE );


Download 6.22 Mb.

Share with your friends:
1   ...   63   64   65   66   67   68   69   70   ...   106




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

    Main page