Texture mapping

For use with modern hardware, texture map data may be stored in swizzled or tiled orderings to improve cache coherency.

It is possible to use the alpha channel (which may be convenient to store in formats parsed by hardware) for other uses such as specularity.

Multiple texture maps (or channels) may be combined for control over specularity, normals, displacement, or subsurface scattering e.g. for skin rendering.

[8] This may be done through explicit assignment of vertex attributes, manually edited in a 3D modelling package through UV unwrapping tools.

Another multitexture technique is bump mapping, which allows a texture to directly control the facing direction of a surface for the purposes of its lighting calculations; it can give a very good appearance of a complex surface (such as tree bark or rough concrete) that takes on lighting detail in addition to the usual detailed coloring.

Bump mapping has become popular in recent video games, as graphics hardware has become powerful enough to accommodate it in real-time.

Baking can be used as a form of level of detail generation, where a complex scene with many different elements and materials may be approximated by a single element with a single texture, which is then algorithmically reduced for lower rendering cost and fewer drawcalls.

It is also used to take high-detail models from 3D sculpting software and point cloud scanning and approximate them with meshes more suitable for realtime rendering.

In contrast to perpendicular polygons, this leads to noticeable distortion with perspective transformations (see figure: the checker box texture appears bent), especially as primitives near the camera.

Some hardware, such as the forward texture mapping used by the Nvidia NV1, was able to offer efficient quad primitives.

For rectangular objects that are at right angles to the viewer, like floors and walls, the perspective only needs to be corrected in one direction across the screen, rather than both.

Various techniques have evolved for rendering texture mapped geometry into images with different quality/precision tradeoffs, which can be applied to both software and hardware.

Classic software texture mappers generally did only simple mapping with at most one lighting effect (typically applied through a lookup table), and the perspective correctness was about 16 times more expensive.

After performing one perspective correction calculation for the depth, the rest of the line could use fast affine mapping.

Some engines were able to render texture mapped Heightmaps (e.g. Nova Logic's Voxel Space, and the engine for Outcast) via Bresenham-like incremental algorithms, producing the appearance of a texture mapped landscape without the use of traditional geometric primitives.

The reason this technique works is that the distortion of affine mapping becomes much less noticeable on smaller polygons.

The Sony PlayStation made extensive use of this because it only supported affine mapping in hardware but had a relatively high triangle throughput compared to its peers.

A different approach was taken for Quake, which would calculate perspective correct coordinates only once every 16 pixels of a scanline and linearly interpolate between them, effectively running at the speed of linear interpolation because the perspective correct calculation runs in parallel on the co-processor.

The division is then done starting from those values so that only a small remainder has to be divided[15] but the amount of bookkeeping makes this method too slow on most systems.

Texture mapping hardware was originally developed for simulation (e.g. as implemented in the Evans and Sutherland ESIG and Singer-Link Digital Image Generators DIG), and professional graphics workstations such as Silicon Graphics, broadcast digital video effects machines such as the Ampex ADO and later appeared in Arcade cabinets, consumer video game consoles, and PC video cards in the mid-1990s.

In flight simulation, texture mapping provided important motion and altitude cues necessary for pilot training not available on untextured surfaces.

Most systems have settled on the Z-buffering approach, which can still reduce the texture mapping workload with front-to-back sorting.

Once a primitive's vertices are transformed, the amount of remaining work scales directly with how many pixels it covers on the screen.

The linear interpolation can be used directly for simple and efficient affine texture mapping, but can also be adapted for perspective correctness.

However, this benefit is also its disadvantage: as a primitive gets smaller on screen, it still has to iterate over every texel in the texture, causing many pixels to be overdrawn redundantly.

This method is also well suited for rendering quad primitives rather than reducing them to triangles, which provided an advantage when perspective correct texturing was not available in hardware.

The NV1 hardware also allowed a quadratic interpolation mode to provide an even better approximation of perspective correctness.

The existing hardware implementations did not provide effective UV coordinate mapping, which became an important technique for 3D modelling and assisted in clipping the texture correctly when the primitive goes over the edge of the screen.

Beyond 3D rendering, the availability of texture mapping hardware has inspired its use for accelerating other tasks: It is possible to use texture mapping hardware to accelerate both the reconstruction of voxel data sets from tomographic scans, and to visualize the results.

[17] Many user interfaces use texture mapping to accelerate animated transitions of screen elements, e.g. Exposé in Mac OS X.

Mapping a two-dimensional texture onto a 3D model
1: 3D model without textures
2: Same model with textures
Examples of multitexturing :
1: Untextured sphere, 2: Texture and bump maps, 3: Texture map only, 4: Opacity and texture maps
Because affine texture mapping does not take into account the depth information about a polygon's vertices, where the polygon is not perpendicular to the viewer, it produces a noticeable defect, especially when rasterized as triangles.
For rectangular objects, especially when perpendicular to the view, linearly interpolating across a quad can give a superior affine result versus the same rectangle split into two affine triangles.
Doom engine did not permit ramped floors or slanted walls. This requires perspective correction only once per each horizontal or vertical span, rather than per-pixel.
Screen space sub division techniques. Top left: Quake-like, top right: bilinear, bottom left: const-z