In the world of personal computing, 3D is big thing. All of us, on a day to day basis, use our computers to do mundane tasks like word processing, accounting, check our email. These things are all strictly 2D, things that fit nicely on a flat monitor because all that matters for an image is width and height. But, move beyond that into some of the more complex gaming titles, and that 2D flat screen is rendering full 3D images that actually do a good job at fooling the eye into thinking you are in a 3D world. How do game programmers do this? How do they get a flat screen to output images with percieved depth, shadowing, etc? I go into this here in this article, and in the proces, hopefully shed light into some terminology you have heard but weren’t quite sure what they were.
3D versus 2D
First, we need to get an idea why all of this is even necessary, and to do that we need to look at some of the obvious differences between a 2D image and a 3D image. Simply put, a 3D image not only communicates a lot more than a 2D image, but it also takes a lot more data to render it. To demonstrates this, let’s take the following simple example:

On the left, we see a standard 2D box. It takes four lines and four angles to render it. It communicates simply a square. But, on the 3D image on the right, you have series of lines that communicates a cube. It takes 9 lines and and 12 angles to render it. Obviously, much more data and many more calcualtions must be performed to move from the 2D world to the 3D world, even in this simply example. Now, add to this equation 3D moving images. In order to render a moving image, we need to generate image frames, similar to the pages of a cartoonist’s notebook. So, we have this increased number of calculations, moving. Now, add to that making these images look life-like. Today’s consumer is demanding. We want our games to look like our DVD movies. So, this complexity adds millions of more calculations in order to generate shading, depth, and a ton of other features that must be added atop the image to make it look real.
A number of things can be done to a 2D image to make it look 3D, and these things have been known and used by artists for centuries in order to make a scene on a canvas look lifelike. Such things include making objects that are supposed to be further away look smaller. Objects that are further away also appear fuzzier than items up close. You can add shadow effects to a 2D image to make it look as if it has an actual position in space. These things all come together in the world of 3D programming.
Oh, But There’s More
Oh, there is a lot more that goes into the prgramming of a 3D landscape than just trying to fake out our eyeballs visually. There is also the entire concept of realism and the way things act in the real world. For example, many of today’s games have human figures in them. The programmer goes through all of the necessary calculations to generate a human figure, and they succeed in making it look 3D and real. But, it also needs to ACT 3D. The human skeletal structure acts in certain ways. Our knee joins bend backward, they do not bend forward. Our hands move in certain ways. When this 3D human body on screen interacts with its virtual environment, it must also do so realistically. For example, the body cannot walk through a mountain. If the character puts his hand on a wall, it shoudl not go through the wall. If he hits his hand on a surface of liquid, it should make waves. These things are not a given to the programmer – they must be programmed into the software to make them work that way.
So, with these things put together, the programmers will generate a full 3D world. Now, we add into the equation the ability of the user to move around in this virtual world and change their viewpoint. Taking the same landscape, all of the angles and shadows and other such things change if you move over and view it from a different angle. Characters in games are always moving around. Virtual objects must maintain their realism even while the perception changes. The whole point is to make the 3D world look realistic. Programmers do not want the user saying “That couldn’t happen in the real world”. We’ve all seen it, though. Ever seen a gaming character die on a ledge? The body hangs over the ledge in a fully erect position, only being kept from falling by the feet. So, the realism depends on the quality of the software, for sure.

David Risley is the founder of PCMech.com. He is the brains, the thinker, the writer, the nerd.