Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page61/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   57   58   59   60   61   62   63   64   ...   106
GLIDEPGM

8Mipmapping


A mipmap is an ordered set of texture maps representing the same texture; each texture map has lower resolution than the previous one, and is typically derived by filtering and averaging down its predecessor. LOD0 is the name given to the texture with the highest resolution in the mipmap, where LOD stands for “level of detail”. The LOD1 texture, if defined, is half as high and half as wide, and defines one-quarter as many texels as LOD0. There can be up to nine texture maps in a mipmap. Figure Texture Mapping.5 gives a graphical representation of a complete mipmap. The texture maps can be square or rectangular, but each one in the mipmap must have the same aspect ratio. See Table Texture Mapping.3.
The next chapter will describe Glide functions that manage texture memory and load textures and mipmaps. In this chapter, we will assume that the proper textures are already loaded; we will focus on the texel selection and texture combine capabilities.

  1. Table Texture Mapping.3 Texture sizes and shapes.

A mipmap can be composed of up to nine textures (the LOD names are shown in column 1) and can be square or rectangular (the aspect ratios are listed in row 1). All textures within a mipmap must have the same aspect ratio. The shaded entries in the table below have degenerate aspect ratios: one or both dimensions have been reduced to one texel.




GR_ASPECT_1x1



GR_ASPECT_2x1 or GR_ASPECT_1x2

GR_ASPECT_4x1 or GR_ASPECT_1x4

GR_ASPECT_8x1 or GR_ASPECT_1x8

GR_LOD_256

256×256

256×128 or 128×256

256×64 or 64×256

256×32 or 32×256

GR_LOD_128

128×128

128×64 or 64×128

128×32 or 32×128

128×16 or 16×128

GR_LOD_64

64×64

64×32 or 32×64

64×16 or 16×64

64×8 or 8×64

GR_LOD_32

32×32

32×16 or 16×32

32×8 or 8×32

32×4 or 4×32

GR_LOD_16

16×16

16×8 or 8×16

16×4 or 4×16

16×2 or 2×16

GR_LOD_8

8×8

8×4 or 4×8

8×2 or 2×8

8×1 or 1×8

GR_LOD_4

4×4

4×2 or 2×4

4×1 or 1×4

4×1 or 1×4

GR_LOD_2

2×2

2×1 or 1×2

2×1 or 1×2

2×1 or 1×2

GR_LOD_1

1×1

1×1

1×1

1×1

Figure Texture Mapping.5 Mipmaps.
A mipmap is an ordered set of texture maps representing the same texture. Each texture map in the set has lower resolution than the previous one, and is typically derived by filtering and averaging down its predecessor. GR_LOD_256 is the name given to the texture with the highest resolution in the mipmap, where LOD stands for “level of detail”. The GR_LOD_128 texture is half as high and half as wide, and defines one-quarter as many texels as its predecessor, and so on. The mipmap can contain up to nine texture maps, as shown. The texel addresses range from (0,0) to (256,256) in all nine textures, as described in Table Texture Mapping.2.

The hardware computes an LOD for every pixel. The integer part of the LOD is used to choose one (or two) of the textures in the current mipmap; the fractional part is used to blend two mipmap levels if desired.
· Nearest mipmapping. The mipmap level is chosen based on which mipmap is nearest to a pixel’s LOD. Nearest mipmapping may suffer from a visual artifact known as “mipmap banding” that manifests itself as visible bands between LOD levels appearing in a texture mapped image.

  • Nearest dithered mipmapping. To offset the effects of mipmap banding, the hardware can dither between adjacent texture maps within a mipmap. This technique, known as nearest dithered mipmapping, alleviates the effects of mipmap banding to a great extent, at the cost of performance degradation for larger texture maps.

void grTexMipMapMode( GrChipID_t tmu, GrMipMapMode_t mode, FxBool LODblend )

Mipmapping style is controlled by grTexMipMapMode(). The first argument, tmu, designates the TMU to modify. The second argument, mode, selects the mipmapping style; valid values are GR_MIPMAP_DISABLE, GR_MIPMAP_NEAREST, and GR_MIPMAP_NEAREST_DITHER. The final argument, LODblend, enables or disables blending between levels of detail in the mipmap. GR_MIPMAP_NEAREST should be used when LODblend is FXTRUE.


Using dithered mipmapping with bilinear filtering results in images almost indistinguishable from images rendered with trilinear filtering techniques. On the down side, dithering of the mipmap levels reduces the peak fill rate by approximately 20% to 30%, depending on the scene being rendered. Since the presence or absence of mipmap dithering is not very noticeable, it is very hard to determine the cause of the performance loss. Therefore, Glide disallows this mode by default. To allow GR_MIPMAP_NEAREST_DITHER mode to be used, call grHints().
void grHints( GrHints_t hintType, FxU32 hintMask )


Download 6.22 Mb.

Share with your friends:
1   ...   57   58   59   60   61   62   63   64   ...   106




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

    Main page