Chapter 4: Mesh Modeling Discussion By Kevin Braun Introduction What is Polygon Modeling? Polygon, or "Poly," Modeling is the process of creating a 3D model using basic 3D elements called vertices, edges and faces. A vertex (more than one vertex are called vertices) is a point in 3D space. An edge is a line connecting two vertices. Three edges together form a triangle face, while four edges together form a quad face. Those triangle and quad faces of filled space are the polygons.
A vertex, an edge, and a face. One of the main advantages of polygon modeling over other modeling methods is the ability to easily add detail to specific areas without having to add more complexity to the rest of the model. Other advantages include speed of rendering in real-time environments and relative ease of texturing. Modeling Tools Working with Vertices Selecting / Deselecting The first thing you'll need to know in order to begin modeling is how to select and deselect vertices. Run Blender, or if it's already running, clear the current scene with Ctrl-X. There should now be a square in the center of your screen, highlighted in purple to indicate that it is selected. In the introductory chapters, you worked with objects in Object mode, and always used the Tab key to leave Edit Mode when an object was created. Now, we want you to actually work in Edit Mode. So, use the Tab key to enter Edit Mode with the default cube still selected, and you'll see that the four edges (straight lines) and four vertices (points at each corner) that make up this polygon are highlighted in yellow. Callout: The Tab key toggles between Edit and Object modes. If you press the A-key with your cursor in the 3D viewport, you can toggle between selecting and deselecting all of the vertices in this object, just like you could when working with multiple objects in Object Mode. Putting an object into Edit Mode makes it function in many ways like a mini-version of the whole scene - a lot of what you have already learned will apply within this new, smaller scope. Make sure all vertices are deselected and then right click on the vertex in the upper left corner to select just that one. If you now right click on the vertex in the lower left corner, the one you previously selected will become deselected and the lower one will now be selected. You can select (or deselect) multiple vertices at the same time by holding the Shift key down while right clicking (RMB) on each vertex you would like to select. Callout: In Edit Mode, selection works for vertices just like it does in Object Mode: RMB selects, while ShiftRMB builds and takes away from the selection.
Deleting The next thing you'll need to know is how to delete a vertex. First you'll want to get a good look at all the vertices that are in this object. By pressing Numpad-5 you can toggle your view between Perspective and Orthographic view (see Chapter 2 for more on the difference). Switch over to perspective view and use the techniques you just learned to select all of the vertices except the one in the upper-most left corner and then press the Delete key (or the X-key). A menu will appear with a number of different options - this is where things start to differ from object mode. Choose "Vertices" from the menu to delete the vertices that you have selected. You may notice that a side effect of deleting the vertices is that the edges and faces are also deleted. This is because the faces are made up of edges and the edges are made up of the vertices you just deleted. Removing the vertices necessarily removed the other things they had built. If you had chosen "Edges" or "Faces" from the Delete menu you could have removed only the edges or faces respectively, leaving the vertices in place, but unconnected. Callout: X-key or Delete key brings up the delete menu, allowing you remove vertices, edges or faces.
Ortho: Orthographic view.
Perspective: Perspective view. Moving At this point you'll want to move the remaining vertex closer to the middle of the screen so you can begin working with it. To do this you'll need to select it, then press the G-key to "Grab" it. Once you press the Gkey the vertex will move to follow the movements of your mouse, just like an entire object would in Object Mode. Move the vertex near the center of the screen and press the LMB to place the vertex and confirm the translation. Of course, the keyboard constraints that you learned in the Object chapter also apply here:
hitting the X, Y or Z-keys will constrain vertex movement to that axis. Pressing them twice uses the alternative transformation space as defined on the 3D header. Callout: Transform keys in Edit Mode carry over from Object Mode: G-key (Grab), S-key (Scale), and R-key (Rotate), as well as axis constraint shortcuts, transformation manipulators and mouse gestures. Exact Positioning Using the G-key is a great way to move things as long as you don't need to be precise. In fact, most of your modeling will be done using this method. However, there are times when you'll need exact positioning. To achieve that kind of precision in Blender you'll use the "Transform Properties" panel. To access the transform properties dialog make sure you have something selected (the remaining vertex in this case) and press the N-key.
The Transform Properties panel. In the Transform Properties panel you'll see that you have a number of different options. Here you can rename your object by modifying the text in the "OB:" text field (the object in the example is named "Cube"), or place the object exactly where you want it by modifying the numbers in the various X, Y and Z text fields. To place the vertex in the exact center of the 3D workspace hold the Shift-key and click the LMB in the "Vertex X:" spinner control. This makes the field instantly editable. Type the number "0" and press Enter. To complete the process, repeat these steps for the "Vertex Y:" and "Vertex Z:" fields. For faster access to the Y and Z controls, you can simply hit the Tab key when you've entered your value in the X control. When entering values into fields in Blender, the Tab key functions much like it does in other programs you might be familiar with, taking you to the next text field. Callout: N-key brings up the transform properties panel for numeric positioning. The Extrude Tool
A vertex by itself will not show up in a render. So what can we do with vertices? Combine them into edges (which still don't show up in a render) and then into faces. Faces render. There are several ways to create edges from a vertex. The easiest way is to extrude the vertex. Extrusion is simply taking one thing, like a circle, and extending it into space. Extruding a circle into space creates a cylinder. Extruding a square creates a box. Extruding a vertex in Blender will create another vertex and an edge that links them. To do this, make sure the vertex is selected and press the E-key. Now move the mouse around and you'll notice that you are moving another vertex, and that an edge attaches the two vertices like a string. To place the new vertex where you want, press the LMB. To add some precision to your placement you can hold the Ctrl-key while moving the vertex and it will "Snap to" the nearest increment in Blender units. Of course, you could also use the Transform properties dialog. Callout: E-key extrudes vertices, edges and faces in space. If you need to create a whole chain of vertices, there is a simpler workflow than using the E-key for extrude. With a vertex selected, clicking with Ctrl-LMB in the 3D view creates a new vertex at the location of the click, selects it and links it with an edge to the original vertex. By holding down the Ctrl key and LMB clicking repeatedly, you can quickly build a chain of vertices linked by edges. This fast extrusion feature will actually work with any mesh selection: vertices, edges or faces. Callout: Ctrl-LMB will automatically extrude the current selection to the point of the mouse click. Another easy way to create an edge is to duplicate a vertex by selecting a vertex and pressing Shift-D. After using the LMB to place the duplicated vertex, Shift-RMB selecting the original and pressing the F-key will create an edge between them. Removing Extra Vertices There are many cases where you may end up with vertices that occupy nearly the same space. You may have imported a mesh model from a CAD program that has portions of the mesh duplicated in the same spot as the original. You may be trying to join two parts of a mesh into one, scaling vertices toward each other until they occupy the same point. In any of those cases, you need to remove the extra vertices and join the edges and faces that they help to define. To remove extra vertices and join the edges and faces that they build, select the vertices in question and press the W-key, choosing "Remove Doubles" from the popup menu that appears. Remove Doubles works with a distance threshold value, adjustable in the Mesh Tools panel of the Edit buttons (F9) with the Limit spinner, so you can, for example, select all vertices in the entire mesh and use the function without fear that it will remove all but one of your vertices. In the illustrations, you see two halves of a cube, separated, then with the vertices scaled together. Figure PMD.045.1, .2: [no text] Although the vertices occupy the same space, the edges and faces they build are not connected, and will render with ugly lines at the gaps. As you can see in the next illustration, the vertices are still independent, and can be selected and moved apart from each other. Figure PMD.045.3: [no text] Once the vertices of the cube have been selected and the Remove Doubles function has been used, the vertices are merged into one, and the edges and faces they build are now truly connected. Figure PMD.045.4: With the vertices joined into one, the two halves are now one continuous mesh. Callout: Remove Doubles, from the W-key specials menu and Mesh Tools buttons, merges vertices that are very close together. A common technique is also highlighted in the next example. When trying to get vertices close together for a merge, it is often easier to use the Scale command (S-key), scaling them down to 0 with the help of the Ctrl key, than it is to move one (G-key) and trying to line it up with the other on screen.
Working with an Edge With edges, the same rules and methods that you have learned with vertices apply, plus more. You might be wondering why working with an edge (or face) is important since you already know how to work with vertices. By being able to work with all three, you will be able to take full advantage of Blender's tool set and learn to work as efficiently as possible. Selecting Blender has tools made just for selecting edges. To activate Edge select mode, click the icon on the 3D header that looks like a diagonal line. It's between the Vertex select (four dots) and Face select (triangle) icons. Once Edge select is activated, you'll be able to RMB click anywhere along the edge to select it. To select multiple edges, you can hold the Shift key while RMB clicking on other edges.
Blender also has tools for selecting multiple edges. Under the Select menu on the 3D header, you'll see the Edge ring and Edge loop options. These can be used to easily select complex groups of interrelated edges, and are especially useful when working with character models. In the case of this head model, Alt-RMB selects the loop of edges that runs around the mouth, giving the modeler easy access to this crucial area. Also, Ctrl-Alt-RMB will select the corresponding ring of edges, in case the modeler would want to cut a new loop of edges through them to add, say, a crease to the face.
Edge loop selected around the mouth.
Edge ring selected around the mouth. Callout: Alt-RMB selects an Edge Loop; Ctrl-Alt-RMB selects an Edge Ring. Working with Faces Creating a Face Faces are created with a selection and the F-key. To create a face, you need to have either three or four vertices selected (three will build a triangle face, four will build a quad face), or two edges. Figure PMD.08: Pressing the F-key to create a triangle face and quad face from vertices, and a quad face from two edges. Callout: F-key creates a face from three or four selected vertices or two selected edges. Selecting As with anything else in Blender, the quickest way to select faces is to switch over to Face Select mode and use the RMB. The Face Select mode button is to the right of the Edge Select mode button on the 3D header and has a triangle as its icon. Another way to change select modes is by pressing the Ctrl-Tab keys. You'll get a menu that allows you to choose your select mode without having to use the icons. Adding Detail to a Mesh If you are constructing a model and you find that you need more detail in a certain area, one way to achieve this is to "subdivide" the face (or faces) that you are working with. Subdivision cuts a face into four new faces that take up the same space as the previous single one did. To subdivide a face, make sure you have one selected, then click the Subdivide button on the Mesh Tools panel in the Edit buttons. Subdivide can also be found in the Specials menu by pressing the W-key.
A triangle and quad face, before and after subdivision. You'll see that there are some other subdivision options in the Specials menu. The "Subdivide Multi" option allows you to perform more than a single slice at once on the selected faces, and is quicker than selecting "Subdivide" many times in a row. "Subdivide Multi Fractal" does basically the same thing, but moves the resulting extra vertices around randomly. It's great for creating terrain, or any surface that needs to have a rough, random mesh. Immediately below that on the menu is "Subdivide Smooth", which will not only subdivide the selected portions of a mesh, but will simultaneously attempt to smooth out all edges created by the process.
The W-key Specials menu with Subdivide Multi selected. Another way to add detail is to use the Knife tool. This tool allows you to cut Edges by drawing with the mouse. The best way to see how this works is to select all the vertices in a subdivided square and press Shift-K to bring up the Knife subdivide menu. From the menu, choose "Midpoints" and the cursor will change to a knife icon. Press and hold the LMB, drawing a line that intersects several of the edges that make up the square. When you are finished, press the Enter key, and Blender will cut each edge that your line crossed, placing vertices at their centers and creating some new faces in the process. The "Exact" function of the Knife tool cuts the edges exactly where the mouse crosses them, as opposed to their centers. Callout: Shift-K brings up the Knife tool for cutting faces and edges into parts.
Knife cut tool before pressing Enter to activate the cut, and showing the result. Filling Up until now you've been looking at fairly regular shapes. Let's examine a random shape and see how Blender helps to organize it into a group of faces that you can work with by using the Fill and Beauty Fill tools. Take a look at the graphic below:
A shape made of edges, but not filled with faces. You could start to select sets of vertices or edges and use the F-key to build faces for this outline one at a time. A faster (though messier) way is to simply select all of the vertices with the A-key and press Shift-F to use Blenders Fill tool. Blender will fill the shape with the appropriate number of faces. This method doesn't always create the cleanest models, though, so once the shape is filled, Blender's Beauty Fill tool can help to clean things up.
The shape filled with faces by using the Shift-F fill command. With all of the vertices in the shape selected, press Alt-F to activate the Beauty Fill function, and Blender will attempt to clean up the model.
The faces rearranged more pleasingly with Beauty Fill. If you need to clean things up even further, you can even have Blender attempt to join triangles into quads with either the "Convert Triangles to Quads" command from the Mesh menu's Edges section, or use the AltJ hotkey.
Any triangles that can be converted to quads have been. Callout: Shift-F attempts to fill an area of selected vertices or edges with faces. Alt-F attempts to make a nicer arrangement of faces. Alt-J will convert available triangles into quads. Subsurf Up to this point you've only worked on models and objects with sharp edges. When rendered, the models look just like they did in Edit Mode. That would be fine if you only modeled machines or other artificial objects. However, if you tried to model an organic shape or something like a perfectly smooth circle using the methods we've gone over so far, it would take a lot of vertices, exacting placement and a lot of time. That wouldn't be an efficient use of your time and would make your computer work very hard when it came time to render. Fortunately, Blender has a tool made just for this type of modeling called the Subsurf modifier. Subsurf is short for a process called Subdivision Surfacing. In Subdivision Surfacing, a simple low-polygon model (like the default cube) can be used as a "control cage" for a more complex organic model like a ball. To add a Subsurf modifier to a mesh object, first make sure the object is selected in the 3D view. From the Modifiers panel in the Edit buttons, click the "Add Modifier" button, then choose "Subsurf" from the resulting menu.
The Subsurf modifier panel.
A cube, with progressive levels of subsurfing. The default setting is 1 level of subsurfing for both editing and rendering. These values can be changed in the modifier panel, but be careful: subsurfing actually has Blender create extra geometry behind the scenes. Turning levels up too high, especially on models that are complex to begin with, can quickly have your computer trying to perform calculations for millions of polygons, and can bring your system to a crawl. To keep things working better while you model, you can set the subsurfing level for the interface and the renderer separately. Setting the subsurf Levels control to 2 will probably give you a good balance for most work. Try rendering your subsurfed model with Render Levels set to 2 as well. If the results are not smooth enough, increase the value in Render Levels one at a time until they are. The real value of Blenders Subsurf tools becomes evident when working on a more complex organic model like a human head. The only difference between these two illustrations is that the second has a Subsurf modifier applied to it.
A head model before and after the Subsurf modifier. Adding a Subsurf modifier is such a common practice in Blender that there is a direct hotkey for it: Shift-O. Shift-O will add Subsurf modifiers to any selected objects that are currently in Object mode. Furthermore, using Ctrl-1 through Ctrl-4 will set the Subsurf levels for those objects, making it possible to manage your Subsurfing for an entire Scene without ever touching the Edit buttons' modifier panel. Callout: The Add Modifier button in the Modifiers panel of the Edit buttons lets you make a standard mesh into a Subsurfaced subdivision mesh. Working with Normals Understanding the Normal There is one last element of a polygon model in Blender that you'll need to understand before you finish. That element is called a Surface Normal, or Normal for short. Its function is to tell Blender (and the user) which direction a Face is pointing, and to help calculate how light behaves when reflected off of your model. Sometimes when working on a complex model it is possible to end up with adjacent faces whose normals are pointing in opposite directions. This can cause undesirable results so it's best to make sure they are all pointing where you want them. The illustration below shows the default cube with "Draw Normals" activated. The "Draw Normals" button is found in the "Mesh Tools 1" panel of the edit buttons. (In the default configuration of Blender, this panel is actually scrolled off the right side of the screen on most monitors. MMB drag to the left in the Edit buttons area to bring it into view.) You can also change the length of the line that indicates the direction of the normal by changing the value in the "NSize" field just above the Draw Normals button.
The default cube with its normals showing. With Draw Normals activated, small teal lines stick out of each face in your model. These lines represent the direction the Normal is facing. Pressing the W-key and selecting "Flip Normals" from the Specials menu changes the direction of the normals of any selected faces. If you have a model with "normal problems", i.e. strange black seams in solid mode and render, you can force Blender to recalculate all normals to face the outside of the model by selecting everything in Edit Mode, and pressing Ctrl-N. Pressing Ctrl-Shift-N will set all of the normals to point toward the inside of the model. Callout: Ctrl-N recalculates the normals of a model. Tips and Additional Tools Now you know the basics of how Blender handles the various tasks related to polygon modeling. Let's conclude this introduction with some tips that will give you a little more power. Vertex Groups Vertex Groups allow you to save selections of vertices, so that later you can reselect them easily. This is useful when creating complex models that may need adjustment later. For example: when working on a face, if you find that you are constantly selecting the same group of vertices around the nose, it would make sense to save that selection for easy access. It's important to understand that the selected vertices haven't actually been "put" into a group, though. Vertex groups just contain lists of vertices. So, there is no reason that a vertex cannot be listed in several different vertex groups. Vertex Groups are created in the "Links and Materials" panel of the Edit buttons, in the Vertex Groups section of buttons. With your selection of vertices made as you like, press the "New" button in the Vertex Groups panel. Some new controls will appear, including a naming field and popup menu button for choosing other, already created vertex groups.
The Vertex Group controls. The default name for the first vertex group created is simply "Group", but can be replaced with something that will help you to remember its contents better. Once you have entered a name, click the "Assign" button to assign the selected vertices to the named group. Remember that simply clicking the "New" button only creates an empty vertex group - your selection will not be saved into it until you click the "Assign" button. The other controls in that part of the panel do the following: Delete: Deletes the named vertex group. Note that this does not delete the vertices, it just removes the saved selection. Remove: Removes the selected vertices from the currently active vertex group. Select: Examines the named vertex group and selects its vertices in the 3D view. This is an additive selection, so anything that was already selected in the 3D view remains selected. Desel.: The opposite of Select. Any vertices that are selected in the 3D view, but are in the named vertex group, are deselected. Mirroring Another time-saving feature in Blender is the Mirror modifier. It allows you to only model half of a model and see it duplicated in mirrored form, creating the other half. It is useful for modeling symmetrical things, like this head as seen in the illustration below.
Adding a mirror modifier in Blender is just like adding a Subsurf modifier: click the "Add Modifier" button on the Modifiers panel of the Edit buttons and choose "Mirror". The mirrored half will appear as ghosted lines in Wireframe mode, but will be fully solid in Solid mode. Enabling the "Do Clipping" button in the Modifiers panel will prevent any vertices you transform from crossing the center line of the mirror effect. When you have finished symmetrical modeling, pressing the "Apply" button in the Modifiers panel will make the mirrored half of the model into actual geometry that can be selected and modified independently. Loop Cut In addition to the other subdivision controls that you have learned, the loop subdivide tool allows you to quickly and uniformly subdivide all the edges that are within the same "loop". In the illustration below, you can see the cut line looping around the eye, which will allow the modeler to add crease lines. To initiate a Loop Cut, press Ctrl-R and move the cursor over the model. While moving the cursor, you'll notice that when Blender detects groups of edges that it can cut, a magenta line will appear to indicate the location of a possible loop cut. When the magenta line indicates the loop that you would like to cut, press the LMB once to begin the cut. Then, Blender will allow you to slide the cut back and forth between the outer edges by moving the mouse. You can even increase or decrease the number of cuts made along the loop by using the scroll wheel. When you have the cutting line positioned exactly as you like, pressing the LMB will have Blender make the cuts. Pressing the RMB at any point in the procedure cancels the cut.
A new loop is being cut around the eye on the right side of the image. Edge Slide Once you begin using the Loop Cut tool to add detail to your models, you may find that edge loops become even more useful. For example: what if the cut that was made around the eye in the previous illustration fell along the center of the edges, but you had really wanted it nearer to the exterior loop? Instead of moving each edge individually, you can simply Alt-RMB select the edge loop, then choose "Edge Slide" from the Ctrl-E Edge Specials menu in the 3D view. This allows you to slide the edge back and forth between the two bounding loops. LMB accepts the slide, while RMB cancels. This tool will actually allow you to slide any selectable edge loop, regardless of what tools were used to create it. Edge Loop Delete One of the elements in the X-key delete menu we have not mentioned is the "Edge Loop" option. With an edge loop selected, using this option from the X-key delete menu will remove the edges, but join the faces on either side. The effect is as though an edge loop had never been cut there. This is a great tool for cleanly reducing the polygon count of your meshes once you have them looking the way you want. Conclusion In this introduction, you have seen the basic tools for polygon modeling in Blender and learned a little about how you can begin to work with them. If you haven't already worked through the tutorial section of this chapter, it's a good way to see this theory put into practice, and to learn a few more tricks as well.