Bilinear filtering is a
texture filteringmethod 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 distortion. Because of this, most pixels will end up needing to use a point on the texture that's 'between' texels, assuming the texels are points (as opposed to, say, squares) in the middle (or on the upper left corner, or anywhere else; it doesn't matter, as long as it's consistent) of their respective 'cells'. Bilinear filtering uses these points to perform
bilinear interpolationbetween the four texels nearest to the point that the pixel represents (in the middle or upper left of the pixel, usually).
In these equations, uk and vk are the texture coordinates and yk is the color value at point k. Values without a subscript refer to the pixel point; values with subscripts 0, 1, 2, and 3 refer to the texel points, starting at the top left, reading right then down, that immediately surround the pixel point. So y0 is the color of the texel at texture coordinate (u0, v0). These are
linear interpolationequations. We'd start with the bilinear equation, but since this is a special case with some elegant results, it is easier to start from linear interpolation.
Assuming that the texture is a square bitmap,
Are all true. Further, define
With these we can simplify the interpolation equations:
And combine them:
Which is rather convenient. However, if the image is merely scaled (and not rotated, sheared, put into perspective, or any other manipulation), it can be considerably faster to use the separate equations and store yb (and sometimes ya, if we are increasing the scale) for use in subsequent rows.
This code assumes that the texture is square (an extremely common occurrence), that no
mipmapping comes into play, and that there is only one channel of data (not so common. Nearly all textures are in color so they have red, green, and blue channels, and many have an alpha transparency channel, so we must make three or four calculations of y, one for each channel).
Bilinear filtering is rather accurate until the scaling of the texture gets below half or above double the original size of the texture - that is, if the texture was 256 pixels in each direction, scaling it to below 128 or above 512 pixels can make the texture look bad, because of missing pixels or too much smoothness. Often,
mipmapping is used to provide a scaled-down version of the texture for better performance; however, the transition between two differently-sized mipmaps on a texture in perspective using bilinear filtering can be very abrupt. Trilinear filtering, though somewhat more complex, can make this transition smooth throughout.
For a quick demonstration of how a texel can be missing from a filtered texture, here's a list of numbers representing the centers of boxes from an 8-texel-wide texture, intermingled with the numbers from the centers of boxes from a 3-texel-wide texture (in blue). The red numbers represent texels that would not be used in calculating the 3-texel texture at all.
0.0625, 0.1667, 0.1875, 0.3125, 0.4375, 0.5000, 0.5625, 0.6875, 0.8125, 0.8333, 0.9375
Textures aren't infinite, in general, and sometimes one ends up with a pixel coordinate that lies outside the grid of texel coordinates. There are a few ways to handle this:
*Wrap the texture, so that the last texel in a row also comes right before the first, and the last texel in a column also comes right above the first. This works best when the texture is being tiled.
*Make the area outside the texture all one color. This may be of use for a texture designed to be laid over a solid background or to be transparent.
*Repeat the edge texels out to infinity. This works best if the texture is not designed to be repeated.
Wikimedia Foundation. 2010.
Look at other dictionaries:
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
Bilinear map — In mathematics, a bilinear map is a function of two arguments that is linear in each. An example of such a map is multiplication of integers.DefinitionLet V , W and X be three vector spaces over the same base field F . A bilinear map is a… … Wikipedia
Bilinear interpolation — In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables on a regular grid. The key idea is to perform linear interpolation first in one direction, and then again in the other… … 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
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… … Wikipedia
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
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
Trilineares Filtering — Trilineare Filterung oder trilineare Interpolation ist eine isotrope Interpolationsmethode, die als Texturfilter beim Rendern von 3D Computergrafik zum Einsatz kommt. Bei der Trilinearen Filterung handelt es sich um eine Erweiterung der… … Deutsch Wikipedia
Radeon R200 — ATIGPU name = Radeon 8500 9250 Series codename = Chaplin created = Late 2001 entry = 9200SE midrange = 9000, 9200, 9250, 8500LE/9100 highend = 8500 d3dversion = 8.1, Shader Model 1.4AMD chipsets Table name=Radeon R200 based chipsets CPU= Pentium… … Wikipedia