SHOP TALK: DISSECTING MIPMAPS So what is this mipmap we keep talking about? Simply put, a mipmap is a chain of textures, with the first member of that chain being the most highly detailed texture. For each subsequent member of that chain, the size is reduced by one power of 2. For example, assuming that you have an original "high resolution" texture of 256x256, the next level in that mipmap would be 128x128, followed then by 64x64, and so on. Mipmap chains are used by Direct3D to control the quality of the rendered textures, at the expense of needing more memory to store the mipmaps. When objects are up close, the high-quality versions of the textures are used; when objects are far away, the lower-resolution textures are used instead. When creating a texture, one of the parameters used specifies the number of levels you wish to have in this texture. This number of levels corresponds directly to the mipmap chain. Specifying zero for this parameter will cause Direct3D to automatically create a set of mipmaps from your original texture resolution all the way down to a final 1x1 texture in your mipmap chain. In our example above, using 0 for this parameter on a texture that has an original size of 256x256 will create a chain of nine textures: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, and 1x1. When calling the SetTexture function, Direct3D will automatically filter between the various textured mipmaps, based on the currently set MipFilter property on the sampler states class. If you remember our Dodger game we wrote in Chapter 6, you'll remember we set the minify and magnify filters for our road textures. It is the same concept here for the mipmap filters. |