Intro to objects. (three-dimensional images in Imagine 2.0) (part of a series)
by Steven Worley
Viewing a 3-D world on a 2-D screen is tricky. Last month's article discussed how most 3-D programs show several views of the 3-D world on the screen, allowing you to see the true scope of your work. This method allows you both to view and to manipulate objects in 3-D with a 2-D input device (a mouse) and 2-D display. Now that you can look at things, how can you manipulate them?
One way to start is to add a simple object to the world to give you something to examine. Imagine's Detail editor lets you add primitive objects to the world using the pulldown menu item labeled Add Primitive. The menu lists several basic objects like spheres, planes, cones, cylinders, and disks. These objects are created automatically by the program, so they're useful for making simple primitive parts without having to build the basic shapes yourself. In this case, it's handy to use them to make an object that we can immediately start mucking around with. Select the Add Primitive command and choose a torus with default parameters. You'll see a doughnut shape appear in the center of the 3-D world. This will give you something to play with as you learn the object manipulation commands.
Object manipulation. Last month, we talked about changing your view of the world, but now we're interested in manipulating objects in that world. You might notice that the torus has a bright yellow dot in the center of it. Every object has a center spot like this; it's called the object's axis, and it's used as a reference point for positioning and manipulating the object. You pick an object by clicking on the axis with the mouse. When an object is picked, Imagine will highlight it, telling you that it understands that you want to manipulate the object. This is handy, as you might have many objects present in the virtual world but only want to work with one at a time.
The most simple object manipulation is a simple translation in space--moving it somewhere. When the object is picked, you can click on the Mov gadget at the bottom of the screen to change into Move mode, allowing you to change the object's position. You can drag the object around in any of the three main views. For example, the Front view will let you move the object left and right, as well as up and down. Similarly, the Top view will let you move the object left and right, in and out.
An interesting effect occurs when you start to move an object--it disappears! The object is replaced with a bright yellow rectangle called a bounding box. Imagine can't redraw complex objects fast enough to let you drag them across the screen, so it uses this simpler representation for movement. The bounding box has the same size as your object, so you can judge relative sizes and orientations as you manipulate your object. Figure 1 shows an object rendered in Imagine, with a framework rendered around it where the bounding box would be when manipulating the object in the Detail editor. Notice that the box has the same height, width, and depth as the object itself.
To finish moving your object, click on the OK gadget to accept the new position. You can also use the Scl and Rot gadgets to scale and rotate your object.
Once you're able to move objects around in the world, you can actually start doing simple modeling! At this point you should understand how to move your viewpoint around the world, how to add new primitive objects, and how to move them to any position you like. Like a crane operator at a construction site, you can start with a supply of basic building blocks (primitives) and jockey them into the position you like.
You can even glue these objects together with a command called Join, found in the Functions menu. To do this, pick each object you want to join together, holding down the Shift key as you click on each object's axis. The Shift key will let you pick many objects at once, just like picking icons on the Workbench. When you select the Join command, Imagine will combine the objects into a single part with a single axis.
A command you should definitely learn early is Save, which will let you store a picked object on disk. Obviously, you'll use Load to retrieve the object later.
Object editing. Being able to assemble objects from basic parts is important, but still limiting. What if you want to edit the shape a bit, rounding off a corner here or filling in a gap there? For this kind of object manipulation, you want to move the individual points that make up the object.
Imagine has many modes that allow you to manipulate objects in a variety of ways. The default mode is Pick Groups, which lets you click on objects to alter them. Another mode (selected from--you guessed it--the Mode menu) is called Drag Points. When you pick an object and select this mode, the points that form the object will be highlighted, and you can click on them to drag them around. If a corner is too sharp, just move the points into a softer curve. To fill a gap, move the points at the gap's edge inward. When you're done changing the object's shape, you can change back to the Pick Groups mode.
Other modes let you add new points, edges, and faces to your object, allowing you to build new features without having to add primitives. By selecting Add Points, you can just click on any of the three main views to add new object points. In Add Edges mode, you add a new edge by clicking on two points (which define the edge). Similarly, Add Faces adds a face by clicking on the three points that will make up the face, as long as there are already three edges that join the points. (Yes, that's kind of odd, but a face won't automatically appear even if all the edges that make it up are already there.)
Building a model often consists of assembling primitives and then manipulating the individual points to fine-tune the shape and remove small flaws. A tree trunk might be made by adding a cylinder and then flaring the end of the tube irregularly to make the base of the stump. Figure 2 shows how effective this simple model can be, especially after some color has been added to the object.
Rendering. Objects are designed using a wireframe editor so that they can be manipulated quickly. The final object you're producing will probably be converted to an image using a slower algorithm, one that will create a picture of your object with a solid framework and light shading. You can make a test rendering like this by using the Quick Render option in the Project menu. This will start a process that will generate a solid picture of your object as it's shown in the Perspective view.
You might notice that your objects look very plain. They don't have the detail that you see in most rendered objects, like the pillar in Figure 1. Next month, we'll talk about object attributes like color and reflection, as well as details added with brushmaps or algorithmic textures. Figure 2 shows how an algorithmic texture can dramatically enhance the appearance of the simple tubebased trunk object.