Texture Mapping in Computer Graphics

By , last updated October 28, 2017

Texture mapping or UV Mapping is a graphic design process where a 2-D image is wrapped around a 3-D object. Letters “U” and “V” stand for coordinates of a 2-D object.

After the texture mapping process, the 3-D object has a surface texture similar to that of the 2-D image. It’s the digital way of applying wallpaper or paint to any real object.

Let’s explain this process with the help of a simple example.

We have a 3-D cube, whose 3 faces are visible as shown in following diagram. All three faces are white and nothing is emboss on either side.

Next we have a 2-D surface, as depicted in following diagram.

Now texture mapping is mapping of this 2-D image on the 3-D surface, and will result in following image.

We can see there is no discontinuities on pattern that is mapped on the cube. This is not always the case. If we take the same 2-D surface and try to map it over a sphere, the mapping will be messy. In order to align the 2-D surface to map perfectly on the surface of sphere, the 2-D surface must be cut in appropriate pieces in order to fit perfectly fit on the surface of sphere. Texture maps are usually flat 2-D images.

Having understanding of texture mapping we move on to see how Texture mapping works in computer graphics.

You take any location on a surface and call a function, that function will modify attributes associated with location like color, shininess, transparency.

Let’s take another example, a sphere.

Now we want to cover the sphere with this snow texture from our texture library and make a snow ball:

There are many tools to do this, we use Blender. Here’s a simple texture mapping tutorial.

Another simple method is to use a JavaScript 3D library three.js.

In order to apply our snow texture to a sphere we need to make a texture map. In other words, we need to break the sphere into many points and place all the points on our 2D image.

This can be done in many different ways, for example as a sphere projection:

The result with this UV map will be a snow ball:

Another good way to project a sphere is from the top view:

You will need a spherical texture in order to make a good looking snow ball.

Texture mapping has further applications like

  • Bump mapping
  • Light Mapping
  • Environment Mapping
  • Billboards