Graphics programmers often need to use a 3D modeling tool. Just as in any other domain, data in 3D graphics often contain errors. Excel and Photoshop are a better tools than a text editor for editing spreadsheets and images. 3ds Max is a common tool that is faster and easier than a text editor for editing 3D models once one understands a bit of its complicated interface.
Key Elements of the 3DS Max GUI |
For students and indie programmers, there is little quality control on models downloaded from Internet repositories, even relatively high-quality ones like TurboSquid. For professional graphics programmers working with an art team, the assets are often better-suited to the rendering system at hand. However, like anyone else, artists make mistakes. It is often necessary for a programmer to fix them directly while debugging instead of waiting for the artist to correct the model and check in a new version to revision control. Some common model errors are:
- Inverted faces leading to holes and surfaces that disappear when seen from behind.
- Incorrectly assigned or missing materials. For Internet-sourced models, artists often use Vray and other plugins whose materials will be lost when loading without them.
- Stray geometry. Visual effects flags, hitboxes, and corrupt vertices often create extra or broken faces that cut across usable geometry.
- Missing geometry due to corruption or missing polygons.
- Excessive geometric detail from amateur modelers working with subdivision surfaces.
- Incorrect or missing texture parameterizations ("UVs")
3ds Max ("Max") is a 3D modeling tool by Autodesk that is frequently used in video game development. It is free for the educational community and costs about US$1500 per year for commercial use. Max is pretty good for polygon-based modeling. Alternatives include Autodesk's Maya and the free, open-source Blender. For volumetric modeling (like sculpting), Pixologic's Z-brush and Autodesk's Mudbox are two popular tools.
Max is a professional tool with a user interface that evolved over many versions. Even for experts in 3D graphics and modeling, it is confusing to learn. In this article, I explain some basic Max operations for graphics programmers with no previous Max experience, so that programmers can fix the kind of errors describe above--at least, well enough to continue their own work. There are plenty of tutorials for artists on how to use Max. I've found them not particularly useful for programmers. Programmers understand the concepts of 3D model representation, but not the concepts of Max or process of authoring a model, and need to perform modeling tasks that are executed less-frequently by artists. I describe and give screenshots from 3ds Max 2015, but the interface is fairly consistent across recent versions.
Camera Movement
Max requires a three button mouse (the mouse wheel may be the middle button on your mouse--try pushing it down).The navigation cube shown in the upper-right corner of the viewport. |
Hold the middle button and move the mouse to translate the camera perpendicular to the view axis. Scroll the mouse wheel to translate along the view axis. Left click and drag the center of a face on the navigation cube to orbit the camera around the currently-selected object's pivot. Click on a face, vertex, or edge of the navigation cube to snap to a canonical perspective.
For a perspective viewport, you can also use video-game style first-person controls. Select a perspective view and then press the up arrow key to switch to first-person movement. In first person view you can use the W, A, S, D keys or arrow keys to translate the camera in the horizontal plane, translate vertically using E and C, and rotate by pressing the left mouse button and moving the mouse. Pressing any other key or other mouse actions will exit first person movement. The default movement rate is slow. Use [ to slow further and ] to accelerate it.
View
The viewport configuration menus. |
I spend most of my time when working on model corrections in a Perspective projection with the rendering mode set to Shaded. On the menu labeled "Shaded", I set the following Lighting and Shadows options, so that I can see all areas, regardless of the scene's lighting rig:
- Illuminate with Default Lights
- Shadows
- Ambient Occlusion
Backface culling is toggled through the Display Properties rollout on the display tool panel. |
Meshes, Selection, and Modifiers
Most meshes in Max are represented as Editable Poly or Editable Mesh objects. For a programmer, the only practical difference between these is that some tools are only available on one or the other type. Right-clicking on any object opens the context menu, which always contains options to convert to one of these forms.The context menu. |
Modifiers and selection tools. |
When selecting, CTRL adds to the current selection and ALT removes from the current selection.
Once an object is selected, the Modify tab of the tool panel presents context-specific rollouts. The Selection rollout allows selecting vertices, edges, border edges, faces, and whole sub-meshes ("objects"). Pressing one of these red Selection buttons freezes the current object-level selection, so that only parts of that object are eligible. To return to whole object selection in the viewport, either right-click in the viewport and select Unfreeze All or uncheck all of the Selection buttons.
In a crowded scene, it is often useful to use the right-click context menu to hide unselected objects (or sequentially select and then hide objects) to reduce clutter and expose embedded objects. Use the Unhide All option on the context menu to restore full visibility when done editing.
Selecting individual faces. |
Flip Normals
Max doesn't expose winding directions for mesh faces. Instead it presents the face orientation through the face normal. To flip normals, add the Normal modifier to the mesh. Click on the down arrow for the Modifier List dropdown and select Normal. This adds it to the "stack". By default, it appears with normals flipped, so no further work is needed for this task. Scroll down to the new Normal rollout on that mesh to toggle the option.
Make Two-Sided
Meshes can be made two-sided by attaching a two-sided material to them, but this doesn't work with all renderers and will be lost if exporting to OBJ format. So, in practice it is often necessary to explicitly duplicate the geometry.
To make a mesh into a two-sided object with some thickness, apply the Shell modifier. This duplicates and inverts the mesh, and then stitches the edges together with new polygons.
To create a zero-volume two-sided object, clone the mesh (from the right-click context menu), and then apply a Normal modifier to flip the faces.
Adding and Deleting Faces
To delete faces, select the object, choose the face Selection option (with the red square icon), select the faces, and then press the delete key.
To add new faces, choose the face Selection option. Then, scroll the rollout panel down to the Edit Geometry rollout and select Create. Vertices of the currently-selected mesh will be shown as small blue squares in the viewport. Click on individual vertices to connect them into a polygon (the winding order is irrelevant) and press the Escape key to create the polygon. Be careful when selecting because clicking too far from a vertex will create a new vertex in empty space.
Apply, Edit, and Create Materials
To assign or modify materials, open the material editor. The toolbar icon for it looks like a checkered sphere with a small dialog box over it. The left side of the material editor lists materials that can be created, procedural maps, controllers, and Scene Materials. Scene materials are those already in the scene instead of a material library. You can double click them to have them appear in the center panel's node-based material editor.
There are two ways to assign an existing material to an object in the scene. The first is to drag the material from the Scene Materials list onto the object in the viewport. The second is to select an object in the viewport and then right click on a material in the node editor panel of the Material Editor. The right-click menu offers "Assign to Selection" as an option. Materials with textures will not appear correctly on objects that lack texture coordinates (UVs). See the next section for how to assign texture coordinates if needed.
Max supports many kinds of materials. The Standard material is a Blinn-Phong one that exports correctly to most external formats. I use it exclusively because of that property. Materials from plugins, such as VRay, or materials other than Standard may not import into different versions of Max for others and will almost never export correctly.
To edit an existing material, double-click on it in the node editor or the Scene Materials list. The right panel of the editor will then show the fields for editing. To add a texture map, drag a file from your operating system into the node-based view and connect its output node to the desired field's input node.
To create an entirely new material, drag the Standard material from the left pane into the node based editor and then rename and modify it. Note that materials that are not assigned to objects in the scene will be lost during export.
The Material Editor |
Max supports many kinds of materials. The Standard material is a Blinn-Phong one that exports correctly to most external formats. I use it exclusively because of that property. Materials from plugins, such as VRay, or materials other than Standard may not import into different versions of Max for others and will almost never export correctly.
To edit an existing material, double-click on it in the node editor or the Scene Materials list. The right panel of the editor will then show the fields for editing. To add a texture map, drag a file from your operating system into the node-based view and connect its output node to the desired field's input node.
To create an entirely new material, drag the Standard material from the left pane into the node based editor and then rename and modify it. Note that materials that are not assigned to objects in the scene will be lost during export.
Create Texture Coordinates ("UVs")
To add reasonable unique texture coordinates to a mesh, add the UnwrapUVW modifier to it. Press the Open UV Editor button on the new rollout.
Within the UVW Editor, the polygons are shown drawn on a texture map with their coordinates given by texture coordinates. Use the mouse middle button to translate the view and the scroll wheel to zoom. This 2D editor shares a selection and the selection concepts with the 3D viewport. UVW Editor in the foreground, the Unwrap UVW rollout in the background |
The primary command in the UVW Editor is to select the Mapping menu and then the Flatten Mapping menu item. This creates an automatic parameterization. You can further adjust it by moving individual faces and vertices. As with other tools in Max, there are many sophisticated ways that you can adjust the result. See Waylon Brink's tutorial for a good walk through.
Reduce Detail Level
Max has a fairly powerful tool for reducing the tessellation level of a mesh while preserving overall shape. Like many Max tools, it is slow and sometimes locks up, so save your file before trying this.
Add the Pro Optimizer modifer to an object, and then select the "Preserve UVs" option within its rollout. Press the Calculate button, which causes it to compute some metrics (probably an ordering of edge collapses) and is the part that takes a while. When it finishes, change the Vertex% value to the fractional number of vertices that you would like to preserve. The mesh will immediately retessellate to the new vertex count. You can continue to adjust this value to find a good setting.
Morgan McGuire (@morgan3d) is a professor of Computer Science at Williams College, visiting professor at NVIDIA Research, and a professional game developer. His most recent games are Rocket Golfing and work on the Skylanders series. He is the author of the Graphics Codex, an essential reference for computer graphics now available in iOS and Web Editions.