Mipmap

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In 3D computer graphics, mipmaps (also MIP maps) are pre-calculated, optimized collections of images that accompany a main texture, intended to increase rendering speed and reduce aliasing artifacts. They are widely used in 3D computer games, flight simulators and other 3D imaging systems for texture filtering. Their use is known as mipmapping. The letters "MIP" in the name are an acronym of the Latin phrase multum in parvo, meaning "much in little".[1] Since mipmaps, by definition, are pre-allocated, additional storage space is required to take advantage of them. They also form the basis of wavelet compression.

Basic Use[edit]

Mipmaps are used for:

  • Speeding up rendering times. (Smaller textures equate to less memory usage.)
  • Improving the quality. Rendering large textures where only small subsets of points are used can easily produce moiré patterns.
  • Reducing stress on GPU.

Origin[edit]

Mipmapping was invented by Lance Williams in 1983 and is described in his paper Pyramidal parametrics.[1] From the abstract: "This paper advances a 'pyramidal parametric' prefiltering and sampling geometry which minimizes aliasing effects and assures continuity within and between target images." The "pyramid" can be imagined as the set of mipmaps stacked on top of each other.

How it works[edit]

An example of mipmap image storage: the principal image on the left is accompanied by filtered copies of reduced size.

Each bitmap image of the mipmap set is a downsized duplicate of the main texture, but at a certain reduced level of detail. Although the main texture would still be used when the view is sufficient to render it in full detail, the renderer will switch to a suitable mipmap image (or in fact, interpolate between the two nearest, if trilinear filtering is activated) when the texture is viewed from a distance or at a small size. Rendering speed increases since the number of texture pixels ("texels") being processed can be much lower with the simple textures. Artifacts are reduced since the mipmap images are effectively already anti-aliased, taking some of the burden off the real-time renderer. Scaling down and up is made more efficient with mipmaps as well.

If the texture has a basic size of 256 by 256 pixels, then the associated mipmap set may contain a series of 8 images, each one-fourth the total area of the previous one: 128×128 pixels, 64×64, 32×32, 16×16, 8×8, 4×4, 2×2, 1×1 (a single pixel). If, for example, a scene is rendering this texture in a space of 40×40 pixels, then either a scaled up version of the 32×32 (without trilinear interpolation) or an interpolation of the 64×64 and the 32×32 mipmaps (with trilinear interpolation) would be used. The simplest way to generate these textures is by successive averaging; however, more sophisticated algorithms (perhaps based on signal processing and Fourier transforms) can also be used.

The original RGB image
In the case of an RGB image with three channels stored as separate planes, the total mipmap can be visualized as fitting neatly into a square area twice as large as the dimensions of the original image on each side. It also shows visually how using mipmaps requires 33% more memory.

The increase in storage space required for all of these mipmaps is a third of the original texture, because the sum of the areas 1/4 + 1/16 + 1/64 + 1/256 + · · · converges to 1/3. In the case of an RGB image with three channels stored as separate planes, the total mipmap can be visualized as fitting neatly into a square area twice as large as the dimensions of the original image on each side (twice as large on each side is four times the original area - one plane of the original size for each of red, green and blue makes three times the original area, and then since the smaller textures take 1/3 of the original, 1/3 of three is one, so they will take the same total space as just one of the original red, green, or blue planes). This is the inspiration for the tag "multum in parvo".

Anisotropic filtering[edit]

When a texture is seen at a steep angle, the filtering should not be uniform in each direction (it should be anisotropic rather than isotropic), and a compromise resolution is used. If a higher resolution is used, the cache coherence goes down, and the aliasing is increased in one direction, but the image tends to be clearer. If a lower resolution is used, the cache coherence is improved, but the image is overly blurry.

Nonuniform mipmaps (also known as rip-maps) can solve this problem, although they have no direct support on modern graphics hardware. With an 8×8 base texture map, the rip-map resolutions are 8×8, 8×4, 8×2, 8×1; 4×8, 4×4, 4×2, 4×1; 2×8, 2×4, 2×2, 2×1; 1×8, 1×4, 1×2 and 1×1. In general, for a 2^n×2^n base texture map, the rip-map resolutions are 2^i×2^j for i and j from 0 to n.

Summed-area tables[edit]

Summed-area tables can conserve memory and provide more resolutions. However, they again hurt cache coherence, and need wider types to store the partial sums than the base texture's word size. Thus, modern graphics hardware does not support them either.

References[edit]

See also[edit]