Turning 2D Shapes into 3D Objects
You've seen how to create and edit 2D shapes, but how are they turned into 3D objects? Actually, you can apply several different operations to one or more shapes, with a surprisingly broad range of results. The most commonly used operations are extrudes, lathes, sweeps, and skins. Shape resolution plays a part in these operations as well, because the software usually enables you to define how many increments (steps or segments) are used when converting a shape from 2D to 3D. By the way, shapes don't have to have depth in order to be useful in 3D scenes. As long as a 2D shape is converted into a flat polygon with a face, it can be mapped and used in a model just like any other object.
Most 3D programs make heavy use of the mouse for defining and moving shapes and objects, but most offer numerical entry as well, enabling you to enter precise coordinates, distances, or transformation percentages.
The most straightforward way of making a 2D shape into a 3D object is by extruding it. An extrusion is simply pushing the 2D shape into the third dimension by giving it a Z-axis depth (see Figure 3.17). The result of an extrusion is a 3D object with width, height, and now, depth.
FIGURE 3.17 Extrude process: (a) 2D shapes are defined using polylines or splines. (bd) Extrude is applied to the 2D shapes, giving them whatever depth is desired.
Extrusions are very useful for creating block-like shapes, columns, panels, and the like, but the sharp-edged result definitely has a CG look to it. In Chapter 5 you'll learn how to modify the Extrude operation to make this less obvious.
To create an extruded object, first define the 2D shapes with polylines or splines. Note that if you create shapes within shapes, such as the two circles in the figure, the inner ones will create holes in the object. Next, select the desired shapes and apply an Extrude operation to them, setting the depth of the object with mouse movement or numerical entry.
The next method of forming a 3D object is lathing. In woodworking, a lathe is a device that rotates a block of wood at high speed, enabling you to trim away at the wood with a sharp gouge. Lathes are used to create intricately carved cylindrical objects such as chair legs and bedposts. In 3D modeling, a Lathe command spins a 2D shape around an axis, extruding it in small steps as it rotates (see Figure 3.18).
FIGURE 3.18 Lathe process: (a) A 2D cross-section is created, and the lathe axis selected. (bd) The Lathe operation spins the cross-section around the axis, extruding it in small steps.
Lathe is ideal for creating any kind of radial object, such as pulleys, reels, pipe flanges, and of course, wine glasses. Along with extrude, it's one of the fundamental operations in 3D graphics.
To create a lathed object, define a 2D object or objects with polylines or splines to use as a cross-section. Selecting the Lathe command enables you to define the axis around which the cross-section will be spun. The result is a radially symmetrical 3D object.
Like many 3D tools, lathe offers significantly different results depending on how you set your axis. If the axis is located in the center of the cross-section, it results in a closed lathe, whereas an open lathe results if the axis is moved away from the center point (see Figure 3.19).
Lathes don't have to be a full 360°they could just as easily be 90°, 180°, or 272°, resulting in a partial lathe. Partial lathes are useful for creating cutaway views of objects, or for eliminating unnecessary portions of the form, such as when part of the lathed object will be inside of another object.
FIGURE 3.19 Lathe types: (a) Closed lathe. (b) Open lathe. (c) Closed partial lathe. (d) Open partial lathe.
Although common, the next two 2D-to-3D operations have different (and sometimes contradictory) terms applied to them depending on the software being used. For example, 3D Studio refers to these operations as lofts, but many other products refer to them as sweeps, and that's what they'll be called here. A sweep is a single 2D cross-section that is extruded along a path (see Figure 3.20).
To create a swept object, start by defining a 2D cross-section with polylines or splines. Next, create a path for the cross-section to follow by using polylines or splines. Note that this path can be open or closed. Assign the cross-section to the path or vice-versa, adjusting its orientation. The cross-section doesn't have to be centered on the path, nor does it need to be perpendicular. Of course, the orientation will affect the final result. Finally, performing the Sweep operation extrudes the cross-section along the path to create a 3D object.
FIGURE 3.20 Sweep process: (a) Define a 2D cross-section. (b) Create a path using polylines or splines. (c) Assign the cross-section to the path or vice-versa, adjusting its orientation. (d) Sweep the cross-section along the path to create a 3D object.
Sweeps come in three basic flavors, defined by the path: open, closed, and helical (see Figure 3.21). Although helical could just be considered another open sweep, it is used so often that it deserves special mention.
FIGURE 3.21 Sweep types: (a) Open sweep. (b) Helical sweep. (c) Closed sweep.
Although we won't be getting into texture mapping until Chapter 6, "Texture Mapping," it's worth noting that sweeps are one of the types of objects that can be tricky to texture map properly if you don't assign mapping coordinates at the time you make them.
The final common way of converting 2D shapes into 3D objects is by skinning, which is similar to an open sweep, except that you can use different cross-sectional shapes along the path (see Figure 3.22). In essence, the program creates a "skin" to wrap over this framework, something like the way fabric or plastic is stretched over metal tines to create an umbrella.
Depending on your program, skinning operations may require some extra preparation. For example, your program may demand that each cross-section (CS) have the same number of vertices. If this is the case, you need to add vertices to some shapes so that they all have the same quantity.
FIGURE 3.22 Skinning process: (a) Define the 2D cross-sectional shapes. (bc) Create a path and determine where the cross-sections will be located. (d) Perform the Skin operation, which creates a surface to bridge the cross-sections.
In many cases, skinning operations are sensitive to the orientation of the first vertex (discussed earlier) on each cross-section, because the program starts the skin by connecting these first vertices. In general, you want the first vertex of each CS to be more or less in line with the others. Otherwise, the object may appear to be twisted (see Figure 3.23). This will require some planning on your part to arrive at a good combination of vertex quantity and placement.
After the cross-sections are ready, you create a path (straight or curved) to define the depth of the final skinned object. The last step is to assign the cross-sections to the path, which may be done in different ways, depending on the software. Some products require you to position the cross-sections at their appropriate depths, then do the Sweep operation by selecting each CS in order. Other programs enable you to leave the cross-sections in their original location, then assign them by distance or percentage to the path. In either case, the process is a good way of creating models of machine parts, rifle stocks, toy cars, and other moderately complex objects.
FIGURE 3.23 Skinning gone awry: (a) Problem: the 3D object appears twisted. (b) Examining the cross-sections shows that the first vertices are not aligned. (c) Rotating the cross-sections creates a better alignment. (d) The skin on the adjusted object is now much less twisted.