Mipmapping is a technique related to textures that can both enhance the visual quality and the performance of your game.
Mipmaps are pre-calculated versions of a texture at different sizes. Each
texture generated is called a level, and it is half as wide and half as high as the
preceding one. Unity can automatically generate the complete set of levels from the
first level at the original size down to a 1x1 pixel version.
To generate the mipmaps do the following:
- Select a texture in the Project
- Change the Texture Type to Advanced.
- Enable the Generate Mip
Maps option in the Inspector.
The following figure shows mipmap settings:
Figure 4-20 Mip map settings
If a texture does not have mipmap levels, when the area in pixels covered by a
textured surface is smaller than the size of its texture, the GPU scales the texture
down to fit the smaller area. However, some accuracy is lost in this process even with a
filter to interpolate the pixel colors.
If a texture does have mipmap levels, the GPU fetches pixel data from the
level closest to the object size to render the texture. This ensures both higher image
quality and reduced bandwidth because the levels are scaled offline for better quality
and only the texture data from the correct level is fetched by the GPU. The disadvantage
of mipmapping is it requires 33% more memory to store the texture data.
Mipmaps and GUI textures
You do not usually require mipmapping for textures used in a 2D UI. UI textures are typically rendered on screen without scaling so they only use the first level in the mipmap chain.
To change this setting select a texture in the Project window then go in the Inspector and look at Texture
Type. Set the type to Editor GUI and Legacy GUI,
or set the type to Advanced and disable the
Generate Mip Maps option.