Texture filtering

Texture filtering

In computer graphics, texture filtering is the method used to determine the texture color for a texture mapped pixel, using the colors of nearby texels (pixels of the texture). In short, it blends the texture pixels together by breaking them up into tinier pixels. Another term for texture filtering is called texture smoothing. There are many methods of texture filtering, which make different trade-offs between computational complexity and image quality. Since texture filtering is an attempt to find a value at some point given a set of discrete samples at nearby points, it is a form of interpolation.

Application

Texture filtering is a cheap approximation to anti-aliasing. Soft textures, especially height maps, look better when interpolated.

The need for filtering

During the texture mapping process, a 'texture lookup' takes place to find out where on the texture each pixel center falls. Since the textured surface may be at an arbitrary distance and orientation relative to the viewer, one pixel does not usually correspond directly to one texel. Some form of filtering has to be applied to determine the best color for the pixel. Insufficient or incorrect filtering will show up in the image as artifacts (errors in the image), such as 'blockiness', jaggies, or shimmering.

There can be different types of correspondence between a pixel and the texel/texels it represents on the screen. These depend on the position of the textured surface relative to the viewer, and different forms of filtering are needed in each case. Given a square texture mapped on to a square surface in the world, at some viewing distance the size of one screen pixel is exactly the same as one texel. Closer than that, the texels are larger than screen pixels, and need to be scaled up appropriately - a process known as "texture magnification". Farther away, each texel is smaller than a pixel, and so one pixel covers multiple texels. In this case an appropriate color has to be picked based on the covered texels, via "texture minification". Graphics APIs such as OpenGL allow the programmer to set different choices for minification and magnification filters.

Note that even in the case where the pixels and texels are exactly the same size, one pixel will not necessarily match up exactly to one texel - it may be misaligned, and cover parts of up to four neighboring texels. Hence some form of filtering is still required.

Mipmapping

Mipmapping is a standard technique used to save some of the filtering work needed during texture minification. During texture magnification, the number of texels that need to be looked up for any pixel is always four or fewer; during minification, however, as the textured polygon moves farther away potentially the "entire texture" might fall into a single pixel. This would necessitate reading all of its texels and combining their values to correctly determine the pixel color, a prohibitively expensive operation. Mipmapping avoids this by prefiltering the texture and storing it in smaller sizes down to a single pixel. As the textured surface moves farther away, the texture being applied switches to the prefiltered smaller size. Different sizes of the mipmap are referred to as 'levels', with Level 0 being the largest size (used closest to the viewer), and increasing levels used at increasing distances.

Filtering methods

This section lists the most common texture filtering methods, in increasing order of computational cost and image quality.

Nearest-neighbor interpolation

Nearest-neighbor interpolation is the fastest and crudest filtering method — it simply uses the color of the texel closest to the pixel center for the pixel color. While fast, this results in a large number of artifacts - texture 'blockiness' during magnification, and aliasing and shimmering during minification.

Nearest neighbor with mipmapping

This method still uses nearest neighbor interpolation, but adds mipmapping — first the nearest mipmap level is chosen according to distance, then the nearest texel center is sampled to get the pixel color. This reduces the aliasing and shimmering significantly, but does not help with blockiness.

Bilinear filtering

Bilinear filtering is the next step up. In this method the four nearest texels to the pixel center are sampled (at the closest mipmap level), and their colors are combined by weighted average according to distance. This removes the 'blockiness' seen during magnification, as there is now a smooth gradient of color change from one texel to the next, instead of an abrupt jump as the pixel center crosses the texel boundary. Bilinear filtering is almost invariably used with mipmapping; though it can be used without, it would suffer the same aliasing and shimmering problems as its nearest neighbor.

Trilinear filtering

Trilinear filtering is a remedy to a common artifact seen in mipmapped bilinearly filtered
linearly interpolating the results. This results in a smooth degradation of texture quality as distance from the viewer increases, rather than a series of sudden drops. Of course, closer than Level 0 there is only one mipmap level available, and the algorithm reverts to bilinear filtering.

Anisotropic filtering

Anisotropic filtering is the highest quality filtering available in current consumer 3D graphics cards. It evolved because both bilinear and trilinear filtering sample a square from the texture, which is only correct if the viewer is looking at the texture head-on. This results in blurriness when the textured surface is at an oblique angle - a very common case is the floor as it recedes into the distance. Anisotropic filtering corrects this by sampling in the correct trapezoid shape according to view angle. The resulting samples are then trilinearly filtered to generate the final color.

ee also

*Texture atlas


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Texture Filtering — Texture Filtering,   beim Texture Mapping (Textur) das Aufbereiten von Texturen mit bestimmten Algorithmen, um Treppen bzw. Rastereffekte (Aliasing) zu vermeiden …   Universal-Lexikon

  • Texture mapping — Texture maps redirects here. For the 2003 ambient album, see Texture Maps: The Lost Pieces Vol. 3. 1 = 3D model without textures 2 = 3D model with textures Texture mapping is a method for adding detail, surface texture (a bitmap or raster image) …   Wikipedia

  • Texture mapping — Saltar a navegación, búsqueda 1 = Modelo 3D sin texturas 2 = Modelo 3D con texturas Texture mapping es un método para añadir detalles, colores o texturas exteriores a un grafico generado por ordenador o un modelo 3D. Esta aplicación a los modelos …   Wikipedia Español

  • Anisotropic filtering — In 3D computer graphics, anisotropic filtering (abbreviated AF) is a method of enhancing the image quality of textures on surfaces that are at oblique viewing angles with respect to the camera where the projection of the texture (not the polygon… …   Wikipedia

  • Bilinear filtering — is a texture filtering method used to smooth textures when displayed larger or smaller than they actually are.Most of the time, when drawing a textured shape on the screen, the texture is not displayed exactly as it is stored, without any… …   Wikipedia

  • Trilinear filtering — is an extension of the bilinear texture filtering method, which also performs linear interpolation between mipmaps.Bilinear filtering has several weaknesses that make it an unattractive choice in many cases: using it on a full detail texture when …   Wikipedia

  • Bilineares Filtering — Die Bilineare Filterung oder bilineare Interpolation ist eine Erweiterung der linearen Interpolation, um Zwischenwerte innerhalb eines zweidimensionalen, regulären Rasters zu bestimmen. Sie wird häufig als Grafikfilter zur Skalierung von… …   Deutsch Wikipedia

  • Anisotropes Filtering — Anisotropes Filtern (meist mit AF abgekürzt) bezeichnet eine Methode der Texturfilterung, speziell für Texturen in verzerrter Darstellung; beispielsweise Flächen in 3D Szenen, die in einem flachen Winkel betrachtet werden. Laien bezeichnen dies… …   Deutsch Wikipedia

  • Anisotropic filtering — Anisotropes Filtern (meist mit AF abgekürzt) bezeichnet eine Methode der Texturfilterung, speziell für Texturen in verzerrter Darstellung; beispielsweise Flächen in 3D Szenen, die in einem flachen Winkel betrachtet werden. Laien bezeichnen dies… …   Deutsch Wikipedia

  • Bilinear filtering — Filtrage bilinéaire Le filtrage bilinéaire est un algorithme utilisé en infographie permettant de calculer des pixels intermédaires entre les pixels d une image ou d une texture que l on change de taille. C est un des procédés les plus utilisés… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”