Publishers of technology books, eBooks, and videos for creative people

# 3D Modeling Basics

• Print
This chapter is from the book

## 2D Shapes

Because many of the upcoming 3D operations use 2D shapes as a starting point, a good understanding of how to create and manipulate them is fundamental.

You probably had your fill of 2D polygon theory in the last chapter, so I'll keep this recap brief. 2D shapes can consist of lines, polylines, polygons, or splines. As you recall, a polyline is a type of line with more than one segment (in other words, containing three or more vertices). A polygon is an enclosed shape with three or more edges. Polygons have faces that show up when rendered in a 3D program, whereas lines and polylines generally don't.

### Why Use 2D Shapes?

Building 2D shapes is an excellent way to begin creating a complex 3D object. If you create 2D outlines of some of the forms, it's possible to use the software tools to convert them into 3D objects.

Working in 2D first makes it possible to visualize and define cross-sections, and to establish the proper composition and scale of the components. In addition, 2D polygons serve as cheap mesh, which is a slang term for an object that has a low polygon count or is very efficient and quick to render. An example would be constructing the walls of a room scene out of flat polygons, rather than using several 3D boxes, which contain six times as many faces.

A good example of using 2D shapes to develop a 3D object is the "Gizmo" model I constructed for Mplayer Interactive, an Internet gaming company. The Gizmo is a device that looks like a high-tech portable TV and serves as the user interface for the Mplayer service (see Figure 3.6).

FIGURE 3.6 This 3D model of the Mplayer "Gizmo" was constructed with 3ds max. Image by Mark Giambruno and Laura Hainke, ©1996 Mplayer.

As a starting point, I imported the original 2D Illustrator drawing (by Tom Gooden of Good Dog Design) of the Gizmo into 3D Studio. Next, I broke down the complex, flowing design into a few key cross-sections, which I drew as 2D shapes (see Figure 3.7). I used a modified version of the original Illustrator drawings in conjunction with the additional cross-sections to form the skeleton of the object. I then "skinned" (covered later in the chapter) these 2D forms to create the finished object.

FIGURE 3.7 The Gizmo's basic form was developed out of spline-based cross-sections. The initial shape was imported from an Illustrator drawing, and then additional cross-sections were defined to outline the shape at various depths. Mplayer Gizmo, ©1996 Mplayer.

The 2D cross-sections in this case weren't polylines. They were splines, which are much more appropriate for the required curved shapes.

### Splines

As discussed earlier, a spline is a (usually curved) line that is defined by control points. There are several different types of splines. Modelers commonly use the B-spline, the Bezier, and NURBS (see Figure 3.8).

All splines are similar in that they consist of a line or shape that's controlled by a polyline or polygon. The controlling polyline or polygon itself (also called a control line, control polygon, or hull) isn't seen—it merely serves to define the curvature of the resulting spline. Depending on the type of spline, there are control points or control vertices that mark key positions along the control lines, and tangent points or weights that act like little magnets to attract the spline in their direction. By manipulating these points, the user modifies the shape of the spline.

Figure 3.8 Three types of splines commonly used in 3D programs: B-spline, Bezier spline, and NURBS (Non-Uniform Rational B-Spline). Each uses a unique method to control the shape of the spline.

B-splines use control points with equal weights to adjust the shape of the spline. Control points rarely reside on the resulting curve in this type of spline.
Bezier splines have control points that always reside on the resulting curve. Extending out from the control points are tangent points or handles, which enable the curve to be modified without moving the control points. These tangent points also can be operated independently of each other, which may detract from the smoothness of the curve, but allows for a great deal of control.
NURBS (Non-Uniform Rational B-Splines) also have control points that reside away from the resulting curve, but rather than tangent points, they have weights to control the curve. In addition, there are knots that define the number of control points on a given portion of the curve.

Sounds a bit complicated, huh? Well, the best way to understand splines is to create a few different styles and experiment with them. If you move the control points around you can see how they influence the spline, and the finer points of controlling these shapes will quickly become apparent.

### Editing 2D Shapes

2D shapes are easily modified, which is another advantage to using them as the basis for 3D objects. How a shape is modified depends on whether it's polygonal or spline-based, but some operations are common to both. In addition, note that splines can have polyline segments, or that some of the control points can be different from the others. Figure 3.9 shows some of the different control point or vertex types.

Figure 3.9 Control point types: (a) Standard Bezier. (b) Bezier Corner. (c) Smooth. (d) Corner.

The following list describes these control points or vertex types.

Standard Bezier control points have handles that are tangent from the curve, and move as a unit when they are rotated or their lengths adjusted. This tends to keep the curves fairly smooth.
Bezier corner control points have handles that can be adjusted independently of each other, which enables you to define much sharper and more angular curves.
Smooth control points don't have handles—they use a set formula to calculate how the spline curves between control points.
Corner control points apply no curvature to the spline, making segments between them straight lines.

By mixing these different control point types, you can make virtually any 2D shape. These control points and vertices can be further modified with editing operations.

The basic line and polyline editing operations include moving, adding or deleting lines, vertices, or edges (see Figure 3.10). Note that there may not be specific commands for these operations, because they're usually selected through the use of the mouse buttons or modifier keys such as Shift, Ctrl, and Alt.

FIGURE 3.10 Basic line and polyline or polygon vertex editing operations. Add creates a new vertex, whereas Delete and Move directly affect existing ones.

Add Vertex creates a new vertex, either along an existing edge or as an extension of the last point of a line or polyline.
Delete Vertex removes a vertex and its adjacent edges, and causes a new edge to be formed between any vertices to which it was connected.
Move Vertex enables you to reposition the selected vertex and the edges to which it's connected.

Note that many programs may indicate the first vertex (the one that was created first) by surrounding it with a box or making it a different color during editing. This isn't important for most operations, but it does affect skinning, which is discussed later in the chapter. For now, remember that any vertex can be reassigned as the first vertex if you use the appropriate poly or spline editing tool, which may be called First or First Vertex.

Although less common than basic line and vertex editing commands, some programs offer useful 2D trimming and rounding (filleting) operations (see Figure 3.11). Trims are often applied by hitting a button to start the operation, then selecting the lines in a certain order, but this varies by program.

FIGURE 3.11 Trim connects lines at the point of intersection, whereas Bevel and Round (Fillet) create a new segment or curve to bridge the selected points. Note that the process by which these functions are applied to a shape in a given program may vary substantially from the method shown here.

Trim Lines connects overlapping lines at their intersection, and deletes portions that extend past that point.
Bevel Lines creates a new segment to bridge the gap between selected points. It also deletes portions that extend past the selections.
Round or Fillet Lines create a new segment like Bevel Lines, but in this case, it's a smooth curve.

The basic modifications for splines include moving, adding or deleting control points, and adjusting tangent controls or weights (see Figure 3.12). As with the line, polyline and polygon modifications, there may not be specific commands for these operations. They are usually done through the use of the mouse buttons or modifier keys such as Shift, Ctrl, or Alt.

FIGURE 3.12 Common Bezier spline modifications. Control point adjustments (upper row). Tangent point adjustments (lower row).

Add Control Point creates a new vertex, either along an existing curve or as an extension of the last point on the curve.
Delete Control Point removes a vertex and its adjacent curves, and causes a new curve to be formed between any vertices to which it was connected.
Move Control Point enables you to reposition the selected vertex and the curves to which it is connected.

On standard Bezier curves, the tangent points are locked together most of the time. If you move one, the other moves in a mirror fashion. Through the use of modifier keys or by changing the control point type, it becomes possible to adjust them independently, varying the distance (and sometimes the angle) of one side while leaving the other side undisturbed.

In addition to these common modifications, many programs enable you to convert polygonal lines or objects to splines, and vice versa. Drawing an outline with a polyline and then converting the shape to a spline can make it easier to create a smooth, complex object, because many people find it easier to rough out a shape with polylines (see Figure 3.13).

FIGURE 3.13 Some programs enable you to convert a poly into a smoothed spline. This can make it quicker and easier to create complex organic shapes.

### Shape Resolution

As you know, image resolution relates to the number of pixels on a screen or image, allowing for more or less detail. Similarly, polygon resolution specifies the density of line segments and polygons for mesh, and therefore defines the amount of detail and smoothness in the object (see Figure 3.14).

FIGURE 3.14 Effects of resolution on objects and open splines: (a) High resolution. (b) Medium resolution. (c) Low resolution.

Although a polyline or polygon's resolution is usually set at the time you create it, it's sometimes possible to increase or decrease the resolution later on. Splines, on the other hand, must go through a conversion process when they're used in a polygonal modeler, and their resolution setting has a major effect on how smooth the curves remain.

A common term for indicating a shape or object's resolution is how many steps it contains. Steps refers to the number of additional vertices generated between control points on a spline or vertices on a poly. For example, a setting of 0 steps would mean no subdividing vertices would be added, because the line travels between the original control points or vertices in a single step. If the object had a step setting of 3, however, there would be three additional vertices added, making the line between the original points break into four segments.

It's important to note that resolution settings affect the shape or object as a whole, so if you increase the number of steps to smooth out a curve, the program may also subdivide the straight portions of the object as well, creating unnecessary vertices. Some programs may offer you an optimizing option to delete these extra vertices automatically, however.

### 2D Attach/Detach

Often, it's useful to attach 2D shapes together to join separately drawn elements, or to form a composite shape. Attach is a common command for 3D programs that enable you to join separate elements into one object (see Figure 3.15). Implementation varies, with some programs prompting to see whether you want to attach whenever 2D vertices are moved within range of each other. Other programs require you to select the elements and specifically command the software to attach them.

FIGURE 3.15 Attach and Detach: (upper row) Attaching and detaching line segments makes it easier to create complex 2D shapes or to use portions of one shape elsewhere. (lower row) Attaching objects together is similar to grouping them. They can be detached at a later point.

NOTE

Attaching two polylines together doesn't necessarily mean that they form a single closed shape. In some cases, you may have to weld (combine) the endpoints of the shapes together in a separate operation.

Likewise, you may want to detach part of a shape that divides the original object into two elements for use elsewhere—essentially the opposite of attach. Doing this usually requires you to select the elements you want, and then use the command Detach or something similar.

### 2D Booleans

Boolean operations (named for 19th century mathematician George Boole) enable you to build onto a shape by combining it with a second shape, or carve away at a shape by subtracting a second shape from the first. Booleans are very powerful and useful tools, because they enable you to create shapes that would take much longer if you made the changes by manipulating the vertices.

Shapes selected for Boolean operations are called operands, and the order in which you choose them will affect the outcome in some operations, such as Subtract. Other Boolean types include Add, Intersection, and Split (see Figure 3.16). Note that programs tend to use different terms for Booleans, but the range of operations is similar.

FIGURE 3.16 The 2D Boolean operations Add, Subtract, Intersection, and Split. When using Subtract, the second object selected is subtracted from the first.

Boolean Add combines the shapes into one, adding their volumes together and deleting any overlaps. Add is great for building a very complex shape out of lots of simpler ones, like the cross-section of a gear made out of some circles and rectangles.
Boolean Subtract removes from the first shape any portions of the second shape that overlap it. Use subtract to carve away pieces of a shape or "cut holes" for creating hollow objects.
Boolean Intersection deletes any portion of either shape that isn't overlapping. This can be useful for creating shapes that "fit" snugly inside other shapes, like liquid inside a jar.
Boolean Split deletes any portion of both shapes that overlaps. You probably won't use this one much, but it's nice to know it's available.

### Importing/Exporting Shapes

Another advantage of working with 2D shapes is that they're readily transportable from 2D drawing programs to 3D modelers, and vice versa. This means you can export (save in a compatible format) existing work created in Adobe Illustrator or CorelDRAW!, for example, and import it into your 3D program.

Most 3D programs support at least one 2D import/export format. DXF (Drawing eXchange Format) is a common one, along with AI (Adobe Illustrator) and IGES (Initial Graphics Exchange Specification). See Chapter 10, "Rendering and Output," for more information.