Features - Programming

Creating Backgrounds for 3D Games
 
by Gavin Bell
Gamasutra
October 23, 1998
Vol. 2, Issue 42


Introduction

Related Technologies

Rendering Skyboxes

3DStudio MAX R2 environment maps

Skyboxes from Bryce

Painting Skyboxes

Game Engine Integration

Other Uses and Advanced Techniques

Conclusion

Creating backgrounds for 2D games is easy. You create a bunch of bitmaps in your favorite paint program and you're done. Creating backgrounds for 3D games can be much more difficult if you don't know what you are doing. The earliest games (both 2D and 3D) were set in deep space, because drawing a few stars on a completely black background is fast, easy, and requires no artistic talent. Game players today demand more interesting graphics.

Some game developers solve the 3D background problem by sweeping it under the rug-using one of several techniques to hide the background. For example, the game's scenery completely fills the screen in top-view games like SimCity or Command and Conquer. Indoor games like Descent also fill the entire screen with game scenery. Fog is sometimes used to make distant object dissolve into a background that is just a single fog color. These techniques make the game feel either two-dimensional or claustrophobic.

Driving games can cheat and use a single bitmap that is scrolled left/right/up/down as the player drives around the track. This works pretty well, because the players are limited to driving on a pre-determined path and they never look straight up at the sky.

However, if you want to create a 3D game that allows the player unrestricted movement and makes them feel like they are in an unlimited 3D world, you need to learn to create 3D backgrounds, otherwise known as skyboxes. The rest of this article explains how to create realistic skybox backgrounds for your 3D games.


Figure 1


A skybox is a cube made of six images that surrounds the game player. Figure 1 shows a slightly exploded view from inside a skybox. Skyboxes are also known as environment maps. The player stands in the middle of the box, so no matter which way they turn they see some part of the box. The game engine figures out which parts of the skybox are visible and displays the proper pixels as the player moves. The player is never aware they are inside a big cube; see Figure 2 for three snapshots of what the player when turning inside the skybox of Figure 1.


Figure 2

Skyboxes are drawn as if they are infinitely large--no matter how far the player moves, they are still surrounded by the box. Only objects that the player can never reach will look correct, like clouds in the sky or distant mountains. If the player's movement is limited to just looking around (rotating their head) from one spot, then a skybox can be used even for nearby scenery.

Skyboxes look great, if they are created properly. They create the illusion the player is in a large, seamless world. But the illusion is quickly shattered if the borders between the skybox images don't match exactly, or if you create images with the wrong perspective. This article will give you a good understanding of skyboxes and related technologies, and will help you avoid time-wasting mistakes by describing several techniques for creating skyboxes.


Related Technologies