← blog
Sep 18, 2022

Mipmaps and Why They Are Useful

MIP is short for the Latin phrase "Multum in Parvo" — many things in a small place. A mipmap is a sequence of progressively smaller versions of a texture, typically created by halving dimensions repeatedly until you reach 1×1.

The Problem They Solve

When a textured object is far from the camera, it occupies very few pixels on screen. A single screen pixel may correspond to a large region of the original texture. If you sample just one texel from that region, you miss everything else — the result is aliasing: flickering, shimmering patterns that appear as the object or camera moves.

This is a frequency mismatch. The texture has high-frequency detail, but the screen representation doesn't have the resolution to represent it faithfully.

How Mipmaps Fix It

Mipmaps solve the problem by pre-filtering the texture at multiple scales. When sampling a distant object, the GPU selects a mip level that matches the screen-space footprint of the texture — one texel in the mip maps to roughly one pixel on screen. The pre-averaged color already incorporates all the detail from the larger region, eliminating aliasing.

OpenGL Implementation

glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);

// Set filtering to use mipmaps
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);

GL_LINEAR_MIPMAP_LINEAR is trilinear filtering — it blends between two adjacent mip levels to avoid visible popping at level transitions.

Requirements

Benefits