34 How does a 3D graphics accelerator work?

As you know, the vast majority of computer displays are two-dimensional. As a result, most of the objects which are represented on computers are also 2D. Examples of 2D object include text, images and animations. Of course, most of the world is 3D, so there are obvious advantages in being able to represent real-world objects in a realistic way.

The 3D representation that I'm referring to here is really surface modeling, but involves true 3d objects. This shouldn't be confused with games like Doom or Wolfenstein 3d, which are really just souped-up 2D engines.

The way that 3D objects are traditionally represented is using a meshwork of polygons - usually triangles - to describe their outside surface. If enough polygons are used, then even curved surfaces can look smooth when projected onto the computer display. The minimum parameters which have to be defined to describe a 3D object and its view; The coordinates of the object's polygon vertices (corners), polygon (or vertex) normals (to tell us which side of the polygon is pointing out, and which is inside the object, and for shading purposes), reflection characteristics of the polygonal surfaces, the coordinates of the viewer's location, the location and intensity of the light source(s), the location and orientation of the plane where the 3D scene will be projected on (i.e. the computer screen). Once all of this information is available, the computer performs a process where it projects the 3D scene, given the above information, onto the 2D computer screen. This process is called rendering, and involves equations for tracing from the viewer through the scene, equations for determining how light is reflected from light sources, off of objects and back to the viewer, and algorithms for determining which objects in the scene are visible, and which are obscured. Often, depth cueing is also performed to make distant objects darker, giving move of a 3D feel.

The point of this description is to impress upon you that the 3D rendering process is highly complex, and involves an enormous number of computations, even for simple scenes with few objects and light sources and no shading. The addition of shading often more than doubles computational time. If the computer's CPU had to perform all of these operations, then rendering a scene would be very sluggish, and things like real-time renderings (i.e. for games or flight simulators) would not be possible.

Happily, new 3D graphic card technology relieves the CPU of much of the rendering load. 3D operations are accelerated in a similar manner as standard windowing operations are for say, Windows 3.1. The application program is written using a standard 3D graphics library like OpenGL, Renderman or another. A special-purpose driver, written specifically for that 3D graphics card, handles all requests through the 3D graphics library interface, and translates them to the hardware. Using a software driver adds an additional layer between the application and video card, and as a result is slower than accessing the hardware directly. However, most of the 3D video hardware is proprietary, which means that without a driver, an application developer would have to write a version of their program for each 3D graphics card available. An additional advantage to having a driver, is that if a new 3D graphics standard is released, or an old one is updated, a new driver can be written to support the new standard. For the 3D rendering example above, the rendering process can be sped-up through the use of the special-purpose hardware on the video card. Instead of the main CPU having to perform all of the operations necessary to calculate the colour and intensity of each pixel being rendered, all of the 3D scene information can be sent directly to the video card in its raw form. Polygon vertices and normals, surface characteristics, location of the viewer, light sources and projection plane are all off-loaded to the 3D video card. Then the video card, which is optimized to perform 3D operations, can determine what image is displayed, and dump it to the screen, while the system CPU is free to perform other tasks.

For more information on 3D graphics chipsets and card model specifications, refer to:

the PC 3D Graphics Accelerators FAQ

http://www.cs.columbia.edu/~bm/3dcards/3d-cards1.html http://www.cs.columbia.edu/~bm/3dcards/3d-cards2.html ftp://ftp.cs.columbia.edu/pub/bm/ ftp://ftp.cs.columbia.edu/pub/bm/

http://www.compart.fi/~ttammi/3dcards.html http://www.excalibur.net/~3d/

Here are a couple of other links, which have information on a large number of 3D graphics standards, and also give some insight into how some popular 3D gaming engines work;

http://www.cs.tu-berlin.de/~ki/engines.html http://www.cs.tu-berlin.de/~ki/game_eng.html

Continue to: