Posts Tagged ‘2d’

3D Texturing

Thursday, September 11th, 2008

Texture mapping is a method for adding detail, surface texture, or color to a computer-generated graphic or 3D model. Its application to 3D graphics was pioneered by Dr. Edwin Catmull in his Ph.D. thesis of 1974.

A texture map is applied (mapped) to the surface of a shape or polygon. This process is akin to applying patterned paper to a plain white box.

Multitexturing

Multitexturing is the use of more than one texture at a time on a polygon. [1] For instance, a light map texture may be used to light a surface as an alternative to recalculating that lighting every time the surface is rendered. 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.

The way the resulting pixels on the screen are calculated from the texels (texture pixels) is governed by texture filtering. The fastest method is to use the nearest-neighbor interpolation, but bilinear interpolation or trilinear interpolation between mipmaps is two commonly used alternatives which reduce aliasing or jaggies. In the event of a texture coordinate being outside the texture, it is either clamped or wrapped.

UV mapping

UV mapping is a 3D modeling process of making a 2D image representing a 3D model. The map transforms the 3D object onto an image known as a texture. In contrast to “X”, “Y” and “Z”, which are the coordinates for the original 3D object in the modeling space, “U” and “V” are the coordinates of the transformed object. This creates the effect of painting the image onto the surface of the 3D object.

In the example to the right, a sphere is given checkered texture, first without and then with UV mapping. Without UV mapping, the checkers tile XYZ space and the sphere is carved out of them. With UV mapping, the checkers tile UV space and points on the sphere map to this space according to their latitude and longitude.

When a model is created as a polygon mesh using a 3D modeler, UV coordinates can be generated for each vertex in the mesh. One way is for the 3D modeler to unfold the triangle mesh at the seams, automatically laying out the triangles on a flat page. If the mesh is a UV sphere, for example, the modeler might transform it into an equirectangular projection. Once the model is unwrapped, the artist can paint a texture on each triangle individually, using the unwrapped mesh as a template. When the scene is rendered, each triangle will map to the appropriate texture from the “decal sheet”.

A UV map can either be generated automatically by the software application, made manually by the artist, or some combination of both. Often a UV map will be generated, and then the artist will adjust and optimize it to minimize seams and overlaps. If the model is symmetric, the artist might overlap opposite triangles to allow painting both sides simultaneously.

It is important to note that UV coordinates are applied per face, not per vertex. This means a shared vertex can have different UV coordinates in each of its triangles, so adjacent triangles can be cut apart and positioned on different areas of the texture map.