IT lexicon › Programming › Nearest-neighbor filtering

Nearest-neighbor filtering

Programming På svenska → Updated: 2026-10-26

Texture filtering that simply takes the closest texel with no blending — the thing that gives pixel art crisp edges instead of blurry mush.

When a texture is sampled between its texels, the GPU has to choose a colour. Nearest-neighbor, also called point filtering (GL_NEAREST), just takes whichever texel is closest and ignores the rest. The opposite is bilinear and trilinear filtering, which weight the neighbours together into a smooth transition.

On magnification the result is blocky — exactly what you want for pixel art, retro graphics and sharp UI icons, and exactly wrong for photorealism, where it produces aliasing instead. For pixel-perfect scaling, nearest-neighbor is paired with integer scale factors, so every source pixel becomes the same number of screen pixels and no shimmering appears.

← Back to the lexicon