Lecture
UV mapping, or unwrapping, in three-dimensional graphics (UV map) is the correspondence between coordinates on the surface of a three-dimensional object (X, Y, Z) and coordinates on a texture (U, V). The values of U and V typically range from 0 to 1. Unwrapping can be done either manually or automatically — for example, 3Ds Studio MAX offers several algorithms for automatic model unwrapping.
Modern three-dimensional hardware assumes that the UV transformation within a single triangle is affine — consequently, it is sufficient to specify U and V for each vertex of each triangle. However, it is the 3D modeler who chooses exactly how to join the triangles together, and the ability to build a successful unwrap is one of the indicators of the modeler's skill. There are several criteria for unwrap quality that conflict with one another:

Equirectangular projection — an example of mapping a two-dimensional texture (coordinates U, V) onto a three-dimensional globe (coordinates X, Y, Z)
A checkerboard texture on a sphere: on the left — a single matrix applied to the whole sphere, on the right — an unwrap with an equirectangular projection

An example of mapping a texture onto a cube. The texture is in the form of a flat unwrap.
In cartography, a cylindrical projection is a family of projections that transform meridians into verticals (U=const) and parallels into horizontals (V=const). One of the cylindrical projections, the so-called equirectangular projection (φ — latitude, [−π; π]; λ — longitude, [−½π; ½π]):
A similar transformation can also be applied in computer graphics to map a texture of the Earth's surface onto a three-dimensional sphere. According to these metrics:
Drawn and photographic textures use only two coordinates: U and V. In the case of auto-generated textures or multitexturing, a third coordinate is possible — W, depth in the «texture continuum» . For example, W=0 might be sand, W=1 — rocks, with intermediate values being sand with rocks poking through.
Theoretically, a fourth, fifth, and so on coordinates are possible — however, graphics hardware, when applying textures, performs the transformation and discards the third coordinate. UVW mapping puts the discarded coordinate to use for transitions from one texture to another: this brings the «world behind the screen» to life without significantly changing the design of the graphics card.
Comments