Home | Lehre | Videos | Texte | Vorträge | Software | Person | Impressum, Datenschutzerklärung |
See subsection 4.2 through section 6 of my tutorial.
"Put wallpaper onto 3D geometry"
Control color, glossiness, transparency, ... (demo with Cinema 4D)
How to place textures on surfaces?
Simple solution: use projections such as orthogonal, cylindrical or spherical (demo with Cinema 4D)
Problem 1: Textures slip under deformations.
Problem 2: The placement is too strongly restricted.
Better solution: “Texture coordinates”. Equip every vertex with the coordinates of its corresponding point in the texture. These coordinates are called u and v, sometimes r and s. Demo with Cinema 4D / BodyPaint 3D and XNA. In between the vertices, texture coordinates are interpolated linearly. On top of that, a perspective correction is applied.
Technical term: Pixels of a texture are called "texels" (texture elements).
On rendering, the texels neither are not of the same size as the pixels of the screen, nor are the texels aligned to the pixels. Hence, we need color values "between" existing texels. Typically, these are computed using linear interpolation (or rather bilinear interpolation because it's done in two directions: u and v). Demo with XNA.
If the texels become significantly smaller than the pixels, we’ll see moiré (=aliasing) patterns in the rendering. Demo with XNA and Cinema 4D. To suppress this effect, "MIP mapping" is used (MIP stands for “multum in parvo”: much in little). A MIP map contains the texture image in several levels of resolution, each one two times the side length of the next. With linear MIP map interpolation, the graphics chip chooses the two most appropriate levels and blends them linearly. Hence, trilinear interpolation, because we’re interpolating in u, v, and MIP level. Demo with XNA.
MIP maps can be created on the fly (demo with XNA) or can be prepared as .dds files. The latter can be achieved for instance through Microsoft’s DirectX Texture Tool that is included with the (free) DirectX SDK. In addition, the DirectX Texture Tool can be employed to combine six images to form a cube map to be used as sky dome or as environment map.
We may use a forth color component (alpha, hence ARGB) to control transparency. Demo with XNA. Note that “alpha blending” incurs a dependency on the order in which objects are rendered.
Textures may also be used to control shape:
Displacement Mapping: Deform the geometry along the normal direction, controlled by a gray-scale image. Needs finely tessellated geometry. Demo with Cinema 4D. Nvidia graphics and current AMD/ATI cards can do this in hardware, too. Demo with XNA.
Bump Mapping: Do not actually deform geometry, but compute the lighting with a deform normal vector. Works with coarse geometry and hence is fast. But the profiles of objects look undeformed, and strong deformations tend to look wrong. Most current graphics cards can do this (with some programming effort). Demo with XNA. See my talk on how to manipulate normal maps.