In computer graphics, texture filtering is the method used to map texels (pixels of a texture) to points on a 3D object. There are many methods of texture filtering, and developers must make a tradeoff between rendering speed and image quality when choosing a texture filtering algorithm.

The purpose of texture filtering is to accurately represent a texture that is not aligned to screen coordinates. This is a common problem in 3D graphics where textures are wrapped on polygons whose surface is not orthogonal to the screen.

Different methodsEdit

The fastest method is to take a point on an object and look up the closest texel to that position. The resulting point then gets its color from that one texel. This is sometimes referred to as nearest neighbor filtering. It works quite well, but can result in visual artifacts when objects are small, large, or viewed from odd angles.

Antialiasing means thinking of the pixel and texel as blocks on a grid that together make up an image and using the area a texel covers on a pixel as a weight. As this is computionally expensive, a lot of approximations have been invented: mip-mapping, supersampling, anisotropic filtering.

Mip-mapping stores multiple copies of a texture at smaller resolutions. Each mip map is a quarter the resolution of the previous mip map. This speeds up texture mapping on small polygons.

In bilinear filtering, the four closest texels to the screen coordinate are sampled and the weighted average is used as the final colour. In trilinear filtering, bilinear filtering is done for the nearest two mip map levels and the results from both mip maps are averaged. This removes mip map transition lines from the rendered image.

Both bilinear and trilinear filtering do not take into account the angle at which the texture is oriented toward the screen. This produces blurry results for textures that are at receding angle to the screen.

Anisotropic filtering takes up to 16 samples based on the angle of the textured polygon. More texels are sampled at the receding end than the near end. This produces accurate results no matter which way the texture is oriented toward the screen.

See alsoEdit