What are Gouraud shading and texture mapping in 3-D video games?

A simple triangular polygon. Each point of the triangle is a vertex.

The vast majority of 3-D objects created for computer games are made up of polygons. A polygon is an area defined by lines. To have a polygon, you must have at least three lines.

The lines connect a series of coordinates in the three-dimensional "space" the computer creates. The point where the lines connect in known as a vertex. Each vertex has X, Y and Z coordinates.

Advertisement

  • X determines the position relative to right or left in the virtual space
  • Y determines the position relative to top or bottom in the virtual space
  • Z determines the position relative to front or back in the virtual space

Once each polygon has a set of vertices to define its shape, it needs information that tells it what to look like. There are four common ways to do this:

  • Flat shading
  • Gouraud shading
  • Phong shading
  • Texture mapping

Flat shading simply assigns a single color to a polygon. It is very simple and fast, but makes the object look very artificial. Gouraud shading is more involved. Colors are assigned to each vertex, then they are blended across the face of the polygon. Since each vertex is typically associated with at least three distinct polygons, this makes the object look natural instead of faceted. Look at this example:

The same object with flat and Gouraud shading applied.

You will notice that the ball with Gouraud shading appears much smoother than the flat shaded one. But look closely at the outlines of the two balls. That is where you can tell that both balls have the exact same number of polygons!

A more complex version of shading, Phong, is rarely used in games. Where Gouraud shading interpolates colors by averaging between the vertices, Phong shading averages each pixel based on the colors of the pixels adjacent to it.

Another common technique for determining the appearance of a polygon is to use texture mapping. Think of texture mapping like wrapping a present. Each side of the box you are wrapping is a blank polygon. You could paint the box, but it would be very difficult to make it match all the designs on the wrapping paper. However, if you take the wrapping paper and tightly cover the box with it, you have completely transformed the box with just a little effort.

Texture mapping works the same way. Mapping requires the use of another image. This other image essentially is stretched over the object like a skin. Most video game consoles and computer graphics adapters contain a special chip and dedicated memory that stores the special images used for texture mapping and applies them to each polygon on the fly. This allows games such as Tomb Raider to have incredibly detailed 3-D environments that you can interact with in real time.

Here are some interesting links:

Advertisement

Advertisement

Loading...