Lesson 02

Texture sampling

A picture pinned to a surface almost never lines up one dot to one pixel, and the fix is two separate jobs with two separate knobs. The magnification filter handles up close, where one dot of the picture is spread across many pixels (blocky vs. blurry). The minification filter handles far away, where a whole crowd of dots has to collapse into a single pixel (clean vs. a shimmering mess).

Try this: the floor runs off to the horizon. Set Minification to Trilinear — the distance is calm. Switch it to Bilinear, no mips and watch the far floor crawl and sparkle; notice Magnification does nothing to that. Now flip to the 2D flat view, zoom in, and work the Magnification knob instead: Nearest gives hard blocky dots, Linear smears them into a blur.

Two filters, two regimes

Whether a texture is being enlarged or shrunk at a given pixel depends on the geometry, and the hardware picks the matching filter automatically. Where one texel covers many pixels (the near floor, or the zoomed-in 2D view) the magnification filter runs: nearest snaps to the closest texel and shows hard blocks; linear blends the four surrounding texels into a smooth ramp. Where many texels fall under one pixel (the distance) the minification filter runs instead. Changing one filter leaves the other regime untouched — that independence is the thing to feel.

Why the distance shimmers

Minification is the harder problem. One pixel covers dozens of texels, but a plain sample reads just one of them. As the surface (or camera) moves, which texel gets read jumps around, so the far floor crawls and sparkles — that's aliasing: high-frequency detail masquerading as low-frequency junk because we undersampled it.

Mipmaps: shrink it ahead of time

The fix is to precompute the shrinking. A mipmap is a chain of progressively half-sized copies of the texture, each one a proper average of the last. At distance the hardware reads from a smaller level where the averaging is already done, so a pixel gets a stable blend instead of a lottery pick. Trilinear blends between the two nearest mip levels so the transition is seamless; anisotropic takes several samples along the stretched direction so a floor at a grazing angle stays sharp instead of going uniformly blurry. Toggle Motion to make the shimmer crawl, then add mips and watch it settle.