Texture Options



There are many options that can be used to manipulate textures. Here we will see the most common options: wrapping modes, magnification e minification.

Open in a new tab

Wrapping Modes

Wrapping modes are used to define how the graphics library will deal with the borders of the texture. You might want to use the last line/column of pixels and copied these colours through the rest of polygon (clamp option) or repeat the entire texture like a tile (repeat option). See Figure 1 to visually understand the differences between these modes.

Figure 1 - Texture wrapping. From left to right, both using repeat, clamp in S, both using clamp.

Minification and Magnification

Pixels of a texture image normally do not match one-to-one with actual screen pixels when a texture is visible onscreen. The most common case happens when a single pixel of the texture is stretched over multiple screen pixels (called texture magnification), or the opposite, when multiple pixels of a texture contribute to the color of a single screen pixel (texture minification).

For both minification and magnification the most common options are nearest (in which the 'nearest' pixel is used) or linear (interpolates the four nearest pixels). Linear filter produces smoother images (See Figures 2 and 3) in both cases.

Figure 2 - Magnification Filter using 'nearest' (left) and 'linear' option.
Figure 3 - Minification Filter using 'nearest' (left) and 'linear' option. Look carefully the indicated region to spot the differences.