Home > Articles

  • Print
  • + Share This
This chapter is from the book

Constructing 3D Graphics

Building 3D graphics is relatively easy. You take standard shapes like cubes, cylinders, and spheres and combine them to form the shape you want. As you combine the shapes, you can paint them or wrap them with a 2D image. The final result is an object that you can load into your Direct3D application and manipulate at a high level without having to know that the object you see in your display is really just a collection of triangles with different colors.

Basic Concepts

When you start trueSpace, you have a work area known as a scene. A scene contains a series of objects. An object can be a primitive object such as a cube, a cylinder, a sphere, a cone, a torus (a donut-shaped object), or a plane. An object can also be a complex object composed of a series of one or more primitive objects.

When using trueSpace to create graphics for DirectX, you want to create objects, not scenes. If you can save the object in DirectX format, your game will be able to load the object using a relatively short block of code. Then you have the capability to manipulate the object as a single unit even though the object may be fairly complex visually.

As with the teapot in Chapter 2, "Introducing DirectX," lights provide the effects necessary to view a 3D object. You can add or reposition the lights in trueSpace to make the design process easier. However, it is important to note that the lights are not coupled to the object you're designing. Although the lights are part of the scene, they are not part of the object. When you display the object in your game, you'll have to place your own lights using DirectX.

The 3D coordinate system used by trueSpace involves X-, Y-, and Z-axes that I talked about in Chapter 2. And like the teapot program in Chapter 2, you are free to zoom, rotate, and move the viewpoint (note that in trueSpace, the viewpoint is referred to as an eye). This will not affect the object you create, but it will make it easier to see what you are doing.

When you add a primitive object to the scene, it has a default color. You can easily change the color; however, you probably want to do something more than simply color the object. You have the option to paint an object with a texture. A texture is simply an image file that is displayed on the surface of the object, much like wallpaper is pasted onto a wall. Textures make your objects appear more realistic and are an important part of any 3D game.

Reading room

While there are very few books on trueSpace and none on trueSpace5, you might try reading Inside trueSpace4 by Frank A. Rivera (New Riders, 1999, ISBN: 1-562-05957-2). While it is a little out of date, it does a good job of teaching you how to create 3D graphics using trueSpace.

Using trueSpace

To say that trueSpace has a unique user interface may be putting it a bit mildly (see Figure 3.1). Rather than putting the title bar and menu items at the top of the window, Caligari chooses to put them at the bottom of the window. Also, the user interface relies heavily on icons that are displayed around the edges of the user interface.

Figure 3.1 trueSpace has an unconventional user interface.

Flipping back

If you prefer the menu items listed at the top of the window, you can easily change this by choosing File, Preferences and then placing a checkmark beside TopMenu in the Preferences dialog box.

Also unlike most Windows applications, the functions performed by the toolbar icons are not duplicated by those listed in the main menu. In fact there are very few main menu commands in trueSpace. To select a visible icon, simply move the mouse pointer over the desired button and click the left mouse button.

Many tools are part of a group of similar tools. This is indicated by a small blue triangle in the upper left corner of the icon. If you press and hold the left mouse button while hovering the mouse pointer over an icon, a flyout will be displayed containing the other tools available. To select one of these tools, continue to hold the left mouse button down and move the mouse pointer over the icon you want to use. Then release the mouse button to select the icon. This will both select the desired tool and display the tool's icon as the default icon for the flyout.

Many of the tools available in trueSpace also have an associated dialog box that controls various settings for the tool. Any tool that has a property dialog box displays a small red triangle in the upper-right corner of the icon. To display the dialog box, simply right-click the tool's icon. If this user interface seems complex, it really isn't. After a few days of exposure you should be fairly comfortable using it. If you can't remember what a particular button will do, simply move the mouse pointer over the button. A description of the button will be displayed in the area above the main menu.

trueSpace Tools

In Figure 3.2, I've expanded all of the toolbars to show most of the tools available in trueSpace. While the number of tools may seem overwhelming, I'm going to stick with these tools to create the simple 3D models used in this book.

Figure 3.2 Selected tools in trueSpace5.1.

  • Eye Move—Used to change the location of the camera relative to the object by using the mouse.

  • Eye Rotate—Used to rotate the camera around the object by using the mouse.

  • Zoom—Used to change the field of view of the object using the mouse.

  • Object Move—Used to drag the object around the scene using the mouse.

  • Object Rotate—Used to rotate the object around its center using the mouse.

  • Object Scale—Used to increase or decrease the size of an object.

  • Image Browser—Used to select a texture to be painted on an object.

  • Plane—Used to draw a plane in the scene.

  • Object Subtraction—Used to subtract the currently selected object from the scene, including the parts of any other objects that may overlap it.

  • Material Editor—Used to select and apply colors or textures to an object.

  • Object Tool—Used to select an object. Right-clicking the icon will display information about the object.

  • Glue as Level of Detail—Used to join an object to the currently selected object.

  • Unglue—Used to separate the currently selected object glued object into two or more independent objects.

  • Reset View—Used to restore the current view of the scene to the default view.

  • + Share This
  • 🔖 Save To Your Account