A Modeling Technique Called Lofting
The term lofting comes from shipbuilding. The ribs of a ship are drawn out full size on the floor of a loft at the boatyard. The ribs are then cut and positioned along the keel of the ship, and the skin is applied to create the hull.
In 3ds max 6, you determine a 2D path (keel) and 2D cross-section shapes. 3ds max 6 then applies the skin for you, making a 3D surface.
The biggest advantage of lofting is that simple 2D shapes can generate complex 3D objects with flexible editing and control of face density.
There can only be one path along which any number of shapes can be placed. The path and shape objects can be open or closed shapes. The only real restrictions are that each shape along the path must have the same number of splines and a path can have only one spline. For example, you cannot loft a Circle primitive and a Donut primitive on the same loft path, nor can you loft a shape along a Donut primitive. The Circle primitive has one spline, and the Donut primitive has two.
In this section, you create two objects with lofting: a command console and an air-handling duct. The console will be a single shape along the path, and the duct will be two shapes on the path. This creates a transition from a circular to rectangular cross-section.
One particularly important aspect of lofting is the relative position of the first vertex of each shape along the path. The loft mesh surface is created by first stitching vertices and shape steps to form the segments of the skin. You learn more about these terms as you go along in the exercises.
Another important thing to know is that the pivot point of a shape determines where it attaches to the start (first vertex) of the path. Transforming the pivot point of the shape affects the orientation on the path.
Finally, the Local reference coordinate system axes of the shape and path affect the orientation of a shape on the path. The positive local Z-axis of the shape aligns along the path.
A lack of understanding of the first vertex and the default orientation keeps many users from taking advantage of the power of lofting. The important fundamentals in this chapter enables you to take full advantage of the tool.
You also learn the power of mesh optimization that lofting has to make your models more efficient or more detailed as you might require.
In Exercise 9.3, you learn to loft a single shape along a path to build a command console for the control instruments for your boat. The console could be created with other techniques, such as box modeling, but you would not have the ease of editing or the ability to optimize the mesh.
Lofting 2D Shapes Along a 2D Path
Open the file called Ch09_interior03.max on the CD-ROM or from the preceding exercise. From the File pull-down menu, choose Save As, point to an appropriate subdirectory on your hard drive, and use the plus sign button to save a new file with the name incremented to Ch09_interior04.max.
In the Camera01 viewport, using Select by Name, select console_shape, a closed parallelogram, and console_path, an open inverted U shape. In the Tools pull-down menu, choose Isolate Selection (Alt+Q) to hide the other objects. Click the Zoom Extents All button. In the Camera01 viewport, press P to switch to a Perspective view and Arc Rotate so that the viewport looks similar to Figure 9.10.
Figure 9.10 Select console_shape and console_path and isolate the selection. Zoom Extents All and switch the Camera01 viewport to the Perspective viewport and Arc Rotate to be viewing from upper left.
In the Perspective viewport, select console_path. In the Create panel, Geometry panel, click Standard Primitives, and choose Compound Objects from the list. In the Object Type rollout, click the Loft button (see Figure 9.11).
Figure 9.11 In the Create panel, Geometry panel, Compound Objects panel, check the Loft button in the Object Type rollout.
In the Creation Method rollout, click the Get Shape button and, in the Perspective viewport, pick console_shape. Your first lofted object looks like Figure 9.12. A nice object, but not the right console for your boat. The object would not sit on the floor, but would drop below it.
Remember that the shape's pivot point attaches itself to the path's first vertex, and the shape's pivot point location is in the geometric center of the shape. You move the pivot point to the lower-left corner of the console_shape, which modifies the loft object. On the main toolbar, click the Select Object button. In the Top viewport, select console_shape. You see the pivot tripod axis in the center of the modified rectangle shape. In the Hierarchy panel, click the Affect Pivot Only button. On the main toolbar, click the Align button and then click the edge of console_shape in the Top viewport. In the Align Selection dialog, check X and Y Position, check Pivot Point in the Current Object column and Minimum in the Target Object column. The pivot point aligns to the lower-left corner of the shape as seen in the Top viewport (see Figure 9.13). Click OK. In the Hierarchy panel, click Affect Pivot Only to exit that mode.
Generally, you select the path and then use Get Shape to attach a clone (instance) of the shape to the path.
If the shape is already positioned correctly in the scene, however, you may use the Get Path option to clone the path to the shape's location.
Figure 9.12 In the Creation Method rollout, click Get Shape, and pick the console_shape object in the Perspective viewport. The shape is lofted along the path. However, the console is backward and too low in relation to the floor surface.
Figure 9.13 In the Hierarchy panel, Affect Pivot Only mode, use Align to position the pivot point at the minimum axes of both X and Y position.
In the Perspective viewport, select the Loft01 object. In the Modify panel, rename it Console01. In the Creation Method panel, click the Get Shape button and pick the console_shape in the viewport. The Console01 jumps up and the path is now defining the inside-bottom corner. The console still slopes in the wrong direction, however.
It is important that you are in the Modify panel when you pick Get Shape and pick the console_shape. Otherwise, you would be creating a completely new loft object.
While you are still in Get Shape mode, hold the Ctrl key and pick the console_shape in the Perspective viewport again. Holding the Ctrl key while performing a Get Shape action flips the shape clone 180 degrees around its pivot point. The negative local Z-axis of the shape orients down the path (see Figure 9.14).
The shape is cloned to the path as an instance to create the object. Any modifications to the original shape are passed to the clone to edit the loft object. However, moving the pivot point is not a modification, but a transformation, and you must use Get Shape to update the changes on the loft object.
Figure 9.14 Holding the Ctrl key while performing a Get Shape operation in the Modify panel flips the shape 180 degrees and replaces the current shape on the first vertex of the path.
Close all windows and dialogs and save the file. It should already be called Ch09_interior04.max.
Modifying the Shapes to Change the Loft
In Exercise 9.4, you learn to modify the original 2D loft shape to make relatively complex changes to the 3D loft object. You are taking advantage of the fact that the cloned shape on the path is an instance of the original, a powerful option.
You add a kick space to the front of the console and round the sharp edge along the top back of the sloped surface.
Modifying the Original Shape to Change the Instance Clone on the Path
Open the file called Ch09-interior04.max on the CD-ROM or from the preceding exercise. From the File pull-down menu, choose Save As, point to an appropriate subdirectory on your hard drive, and use the plus sign button to save a new file with the name incremented to Ch09_interior05.max.
On the main toolbar, click the Select Object button. In the Top viewport, select console_shape. In the Modify panel, Stack view, expand Editable Spline and highlight Segment sub-object level. Select the shorter vertical segment on the right side of the shape. In the Modify panel, near the bottom of the Geometry rollout, enter 2 in the Divide field and click the Divide button. This adds two new vertices to the segment (see Figure 9.15).
Figure 9.15 In sub-object Segment mode, select the short vertical segment of console_shape. Enter 2 in the Divide field of the Geometry rollout, and click Divide to add two new vertices to the segment.
In the Modify panel, Stack view, highlight Vertex sub-object level. On the main toolbar, click the Select and Move button. In the Top viewport, move the three vertices on the right side to look similar to Figure 9.16. You notice in the other viewports that the changes are being reflected in the Console01 object (see Figure 9.17).
Figure 9.16 Move three vertices down and/or left to define a kick space at the bottom right of the 2D shape. Use the Transform gizmo, but just guess at the size for this example.
Figure 9.17 A kick space is being created at the inside bottom of Console01 as you modify the 2D shape.
While in Vertex sub-object mode, select the top two vertices of console_shape. In the Modify panel, Geometry rollout, enter 4 in the Fillet field and press Enter. This rounds the top edges of the console for the entire length (see Figure 9.18). In Stack view, highlight Editable Spline to exit sub-object mode.
Do not click the Fillet button during this operation. There are two ways to use Fillet: by entering numbers in the field and pressing Enter or by clicking the Fillet button, and then interactively dragging the fillet in the viewport.
Figure 9.18 In Vertex sub-object mode, select the top two vertices of the shape and enter 4 in the Fillet field. Press Enter to see the results on the shape and the loft object.
Close all windows and dialogs and save the file. It should already be called Ch09_interior05.max.
You have created a loft object, but is it as efficient as it could be? The face count of lofted objects with curves can get out of control quickly, so it is important to be vigilant.
In Exercise 9.5, you check the face count of the object, and then use path and shape step controls to adjust the density of the mesh so that it retains the look, but is substantially more efficient.
Using Path and Shape Steps to Optimize Loft Objects
Open the file called Ch09_interior05.max on the CD-ROM or from the preceding exercise. From the File pull-down menu, choose Save As, point to an appropriate subdirectory on your hard drive, and use the plus sign button to save a new file with the name incremented to Ch09_interior06.max.
In the Perspective viewport, select Console01. Right-click the Perspective label and check Edged Faces in the menu. Right-click Console01, and choose Properties in the Quad menu. You see that the object has 1,820 faces. Click OK. In the Perspective viewport, you can see segmentation cause by vertices, path steps, and shape steps (see Figure 9.19).
Figure 9.19 There are, by default, five path steps and five shape steps between each vertex to define curvature. The segmentation shows this when Edged Faces is on or when in Wireframe mode.
In the Modify panel, Skin Parameters rollout, decrement the Path Steps by 1 until you get to 0. Watch the Console01 in Perspective as you change each amount. When you get to 0, you will only have horizontal segments, except where the path vertices are. There is no curvature in the path, so the object does not change. Right-click Console01 and choose Properties. You see that there are only 380 faces. Click OK to close the dialog.
There will always be segment lines defined by any vertex in the shapes or paths.
Decrement the Shape Steps field by 1 until you get to 0. The Console01 now only has 60 faces, but the curvature is completely gone from the object and it looks terrible (see Figure 9.20).
The Path Steps and Shape Steps settings adjust the number of steps between each vertex equally, so just adding shape steps increases the face count in places where the extra detail is not needed. To repeat the definition of path and shape steps, there are points between vertices that define curvature. The path has no curvature, so 0 Path Steps is fine. The shape has curvature only at the filleted areas. Instead of adjusting steps at this point, you would be better off adding vertices to the curved segments of the original 2D shape. In the Top viewport, select console_shape. In the Modify panel, Stack view, highlight Segment and select the two curved segments at the upper corners. In the Geometry rollout, enter 3 in the Divide field and click the Divide button. This adds three new vertices to define the curvature (see Figure 9.21). Exit sub-object mode.
Figure 9.20 With Path Steps and Shape Steps set to 0, the object is only 60 faces but is no longer acceptable visually.
Figure 9.21 Using Divide to add three new vertices to each curved segment of the original shape adds segments to the mesh only where needed.
Select Console01, right-click it, and choose Properties to see that the object looks like it did originally (but instead of 1820 faces, it now has only 108). Click the Exit Isolation Mode button to return all objects.
Save the file. It should already be called Ch09_interior06.max.
Knowing this simple lofting process of adjusting path and shape steps is critical to fast, flexible modeling in 3ds max 6. Make sure you understand this exercise before proceeding. Otherwise, it is much too easy to overwhelm even the most powerful computers with lofted objects.
Lofting Multiple Shapes on a Single Path
In Exercise 9.6, you learn to loft two shapes on the same path for a more complex object. The important thing learned here is the effect of the first vertex on a lofted object. With a single shape, the first vertex has no noticeable effect because it is constant along the path. If the first vertices of multiple shapes are not in the same relative position, however, twisting occurs along the loft object. You learn to correct that.
Lofting with Multiple Shapes
Open the file called Ch09_interior06.max on the CD-ROM or from the preceding exercise. From the File pull-down menu, choose Save As, point to an appropriate subdirectory on your hard drive, and use the plus sign button to save a new file with the name incremented to Ch09_interior07.max.
Using Select by Name, select duct_path, duct_shape01, and duct_shape02. Isolate the selection. This is another inverted U that will be used as the path, and a square and a circle, respectively, that will be shapes. Click Zoom Extents All to view all objects. With the shapes all selected, right-click in the Top viewport and choose Properties in the Quad menu. In the Object Properties dialog, Display Properties area, check Vertex Ticks (see Figure 9.22). This enables you to see the vertices of the selected shapes without being in sub-object mode.
You notice a white box around each first vertex on each spline of each shape. (They are all simple shapes.) The first vertex of the square and circle are out of relative position by 45 degrees. In the Top viewport, select duct_path. In the Create panel, Geometry panel, Compound Objects panel, click the Loft button. In the Creation Method rollout, click the Get Shape button. In the Top viewport, pick duct_shape01 (square). You now have a simple square duct in the scene. The Path Steps and Shape Steps settings are remembered from the preceding exercise. In the Modify panel, Skin Parameters rollout, enter 5 in both the Path Steps and Shape Steps fields. Rename the object Duct01. You will optimize later (see Figure 9.23). In the Skin Parameters rollout, clear the Transform Degrade check box so the changes you make later will be visible in the viewport.
Figure 9.22 By turning Vertex Ticks on in the Object Properties dialog, you can see vertex ticks in the viewports without being in sub-object mode.
Figure 9.23 A square shape lofted along a Path with both the Path Steps and Shape Steps fields set to 5.
In the Modify panel, Path Parameters rollout, enter 100 in the Path field and press Enter (see Figure 9.24). This puts the active Get Shape level at 100 percent along the paththat is, at the other end as indicated by the yellow tick at the end of the path.
Figure 9.24 Setting Path to 100 moves the active Get Shape level from the start of the path to the end of the path as indicated by the yellow tick. Otherwise, when you get the next shape, it would just replace the one at 0 percent along the path.
In the Creation Method rollout, click the Get Shape button to turn it on and pick duct_shape02 (circle) in the Top viewport. The Duct01 now starts as a square cross-section on the left and ends as a round cross-section on the right with a 45 degree twist along the way (see Figure 9.25).
Figure 9.25 With a square shape at the start and a round shape at the end, the Duct01 changes form, but has an unwanted twist along the length.
Not only is there a twist, the duct should also not transition from square to circle over the entire length. You first get the transition in a smaller area halfway along the path. In the Modify panel, Path Parameters rollout, enter 45 in the Path field and press Enter. The active Get Shape level is now just before the halfway point on the path. Click the Get Shape button, if it is not still active, and pick the duct_shape01 (square) in the Top viewport. Now, the Loft starts as a square cross-section, holds that form until 45 percent, and then changes from a square to a circle.
In the Path field, enter 60. With Get Shape on, pick the duct_shape02 again. Now, the transition takes place within 15 percent of the Path (between 45 and 60), but still has the twist.
Loft objects also have sub-object levels. In the Stack view, expand Loft and highlight Shape in the list. On the main toolbar, click the Select Object button. In the Front viewport, move the cursor over the loft object and pick when you are over the shape clone at 60 percent and see the small crosshair cursor (see Figure 9.26). The clone shape turns red when selected.
Figure 9.26 In Shape sub-object mode, select the clone shape at 60 percent along the path. It turns red when selected.
On the main toolbar, click the Select and Rotate button. Notice that the reference coordinate system is locked on Local for each shape. In the status bar at the bottom of the display, toggle to Offset Transform Type-In mode. In the Transform Type-In Z-axis field at the bottom center of the display, enter 45 and press Enter (see Figure 9.27). The twist is removed at that point.
Figure 9.27 Toggle Offset Transform Type-In mode and enter 45 in the Z-axis rotation. Press Enter. The twist is removed at that point.
Select the clone shape at 100 percent of the way along the path and rotate it 45 degrees. The twist is removed from the entire Loft object. In the Stack view, highlight Loft level to exit sub-object mode. In the Skin Parameters rollout, set the Shape Steps to 3 and the Path Steps to 0 (see Figure 9.28).
In Transform Type-In for rotation, positive angles are counterclockwise because you are looking down the axis.
Exit Isolation mode. You now have an efficient console and duct, but there is some strange shading (see Figure 9.29). You take care of that in Exercise 9.7.
Close all windows and dialogs and save the file. It should already be called Ch09_interior07.max.
Figure 9.28 Rotating both circle clone shapes 45 degrees removes any twist, and setting the Shape Steps field to 3 and the Path Steps field to 0 is a good compromise between efficiency and visual acceptance.
Figure 9.29 The duct and the console are efficient, but have some strange shading on the surfaces.
Smoothing Faceted Surfaces
Through the creation and editing of lofted objects, there has been a process going on that assigns numbers called smoothing group numbers to each face. The rule is that if two adjacent faces share a common number, the edge between them is smoothed; otherwise, it is a hard edge. 3ds max 6 does a pretty good job at guessing, but is not always right, causing odd shading in some areas and noticeable facets in other areas. In Exercise 9.7, you apply a Smooth modifier that reapplies the smoothing group numbers based on the angle that faces meet. This makes your objects appear correct in the scene.
Assigning Smoothing Groups with Smooth Modify
Open the file called Ch09_interior07.max on the CD-ROM or from the preceding exercise. From the File pull-down menu, choose Save As, point to an appropriate subdirectory on your hard drive, and use the plus sign button to save a new file with the name incremented to Ch09_interior08.max.
On the main toolbar, click the Select Object button and select the ceiling object. Click the Select and Move button and move the ceiling object up so that the duct shows in the room (see Figure 9.30).
Figure 9.30 Move the Ceiling01 object up to reveal the entire duct.
Activate the Camera01 viewport and, on the main toolbar, click the Quick Render button to render the scene. In the Rendering pull-down menu, choose RAM Player. In the RAM Player dialog, click the Open Last Rendered Image in Channel A button (teapot on the left). Click OK in the RAM Player Configuration dialog to accept the defaults. Close the Rendered Frame Window. Minimize (do not close) the RAM Player window.
Click the Select Object button and, in the Top viewport, select Console01. In the Modify panel, Modifier List, choose Smooth modifier. In the Parameters rollout, check the Auto Smooth check box. It is set for a threshold of 30 degrees. If two faces share a common edge at 30 degrees or less, the edge will be smoothed. Otherwise, it will be a hard edge. Render the Camera01 viewport and not much will have changed with the Console01. In the Threshold field, enter 15.8 and press Enter. Render the Camera101 viewport. There is now an acceptable level of smoothing to make the object look better.
Select the Duct01 and Wall01 objects and apply a single Smooth modifier to the two objects with Auto Smooth checked on and a threshold of 22.8 degrees. Render the Camera01 viewport. Maximize the RAM Player and click the Open Last Rendered Image in Channel B. Click OK. In the RAM Player, click and hold in the display area and move the cursor back and forth to compare the two images (see Figure 9.31).
Figure 9.31 Default loft smoothing is shown on the left in the RAM Player (Channel A), and smoothing with the Smooth modifier is shown on the right.
Close all windows and dialogs and save the file. It should already be called Ch09_interior08.max.