Chapter 10: UV Unwrapping and Painting: Tools By Roland Hess Blender gives you an excellent and easy-to-use toolset for slicing and flattening mesh models in order to make the application of 2D textures more detailed and efficient. Don't be confused: "UV" unwrapping has nothing at all to do with "ultraviolet," the common expansion of the "UV" acronym. It has to do instead with assigning a set of 2D coordinates to all vertices. Don't they already have 3D coordinates? Yes. As you know, each vertex of a mesh already has an X, Y, and Z coordinate. But if you make a copy of the mesh, slice it and flatten it out, each vertex will also have another set of coordinates, ones more appropriate to a flat workspace. Normally, you'd label the axes of a 2D space X and Y, but those are already taken. So, it's U and V. Where's W? Don't ask.
On the left, a mesh model in Face Select mode. On the right, that model unwrapped in the UV Editor. If you've never dealt with UV unwrapping and mapping before, we strongly urge you to work through the tutorial section first in this chapter. Blender's UV Unwrapper is a highly interactive feature, and one that can be best grasped by actually using it. Unwrapping The unwrapping process itself is found in Face Select mode, accessible on the 3D header's modes menu.
The Modes menu, with Face Select mode highlighted. Most times, you will be unwrapping an entire mesh at once. In this case, simply using the A-key to make sure that all faces are selected will be good enough. The U-key brings up the Unwrap menu in the 3D view. It only works in Face Select mode. There are a number of UV calculation methods, but only a few will be immediately useful. The simplest ones to conceptualize are "Project from View" and the closely related "Project from View (Bounds)." These options take the mesh exactly as seen in the current 3D view, and squash it right into the UV Editor. (Technically, it's the "UV/Image Editor," but since we're only working with UVs right now, we'll call it the UV Editor for short.)
3d view of sphere, flattened with project from view (bounds).
3d view of Suzanne, flattened with project from view (bounds). Project from View can be good when you need to create a quick texture that corresponds closely to the profile shape of the mesh.
A fish texture, done with Project from View. The only difference between the two is that "Project from View" creates UVs at roughly the size that the mesh appeared in the 3D view, while "Project from View (Bounds)" fills the entire UV space with the projection. Some of the other options are also good for making quick unwraps on objects that will appear as background items, or only for a short time. These are the Cylinder, Cube and Sphere options. Each is good for unwrapping (surprise!) objects that closely match those primitives in shape. There will be sections that don't map quite correctly or show distortion. If you're not sure if the job they do will be good enough, give it a shot. You never now until you try. Callout: Meshes are unwrapped by entering Face Select mode and using the Unwrap command from the Ukey menu. Other options aside, though, the most useful unwrapping method is simply called "Unwrap." It uses a procedure called "Angle Based Flattening" in conjunction with seams marked in Edit mode to give excellent results with very little effort. Seams In order for it to work properly, you must first tell the Angle Based Flattening unwrap tool where to make cuts on the mesh. This is accomplished by adding seams to your model.
In Edit mode on a mesh model, seams are added by selecting edges, pressing Ctrl-E and choosing "Mark Seam" from the Edge Specials menu that pops up. Marked seams appear as heavy orange edges. A seam can be unmarked by selecting that edge, pressing Ctrl-E and choosing "Clear Seam."
The Ctrl-E Edge Specials menu for marking seams. Although any selection method will work, it is often helpful when making seams to work in Edge Select mode and to use Alt-RMB to select entire edge loops at once. Seam placement is crucial. The best way to think about it is to visualize actually cutting slits into your model so that, if it were made of paper, it would be able to lie flat on a desk.
A sphere with a single, poorly chosen seam produces a bad unwrap.
A sphere with better seams makes a more useful unwrap. Seams can also be placed so that entire portions of the model are separated from the others. These separate pieces of the model are called "islands."
Notice the island created by seams in the 3D view and in the UV Editor. Callout: Seams are set in Edit mode with Ctrl-E: Mark Seam, and removed with Clear Seam. Once you have seams marked, you can return to Face Select mode and choose "Unwrap" from the U-key menu. Selecting Nodes in the UV Editor If the configuration achieved by the Unwrap command is not exactly what you need, it is possible to adjust it. When dealing with node selection (nodes are the name for vertices in the UV Editor), the following rules and options apply: RMB, B-key border select and double-B-key circle select all function as they do in mesh Edit mode. Pressing the C-key allows you to select entire faces in the UV Editor with a RMB click. When in this "Active Face Select" mode, which is also available from the Select menu on the header, a small purple square is displayed in the lower left corner of the UV Editor. Like working with distinct groups of vertices in mesh Edit mode, hovering the mouse over an island of nodes and pressing the L-key will select the entire island. There is another set of selection modes here that may be a little hard to understand at first, both found in the Select menu: "Stick UVs to Mesh Vertex" and "Stick Local UVs to Mesh Vertex."
The "Local" option is the default. The tricky thing to realize in the UV Editor is that a single vertex from the 3D mesh can have as many instances in the UV Editor as it has faces. This illustration demonstrates:
A single vertex in the 3D view, spanning five faces, each with a separate instance in the UV Editor. When in "Local" mode, RMB selecting one of these nodes will select all instances of the 3D mesh vertex that share that particular point in UV space. It won't feel any different than selecting and transforming vertices and edges in mesh Edit mode. The difference comes when switching to "Stick UVs to Mesh Vertex" (non-"local") mode. When this option is chosen, a little box icon with two yellow vertices appears in the lower left corner of the UV Editor. Selection now works like this: RMB selecting any node will also select all other nodes that share the 3D mesh vertex, regardless of their location in the UV space.
Selecting a node in local mode only selects itself and other nodes it's touching.
Selecting in non-local mode selects all nodes connected in the 3D view. This is particularly useful when your mesh is divided into many islands and you need to find which parts of one island correspond to which parts of another. Callout: Node selection in the UV Editor shares many selection functions with meshes in Edit mode. Fixing the Unwrap Although the default unwrap is usually pretty good, you will probably need to optimize it for texture painting. Areas that will be a focus of rendering and detail need to be carefully painted, and an even, proportional unwrap can only help. Pinning and Live Unwrap Transform Areas of an unwrap that you are happy with can be frozen by "pinning." Pressing the P-key pins selected nodes. Fixing portions of an unwrap that you are unhappy with is as simple as pinning a few key nodes within the bad area and moving them into a better configuration. Then, after also pinning the good areas, Blender can re-unwrap the mesh, hopefully giving better results. It uses all the pinned nodes as a starting point for its next attempt. Asking for another unwrap can be done from the 3D view with the U-key menu as before, or directly from within the UV Editor with Ctrl-E. One great thing Blender can do to make this process much more intuitive is called "Live Unwrap Transform," and can be accessed only through the UVs menu on the UV Editor's header.
Once Live Unwrap Transform is enabled, there is no need to re-unwrap your meshes after pinning and adjusting. The unwrap adjusts itself in real time as you pull and push pinned nodes, giving you great visual feedback that helps to quickly optimize the unwrap.
A bad unwrap, with several nodes pinned, and one selected.
The selected, pinned nodes have been moved, causing the rest of the unwrap to adjust itself. When you have the unwrap the way you want it, be sure to turn off Live Unwrap in the UVs menu so you don't accidentally move a pinned node and ruin your work. Callout: P-key pins nodes. Alt-P unpins. Moving pinned nodes while in Live Unwrap Transform mode adjusts the unwrap in real time. Paint Tools Blender's painting tools can be used to paint onto existing images or to create new ones, and can be used either in the UV/Image Editor or directly within the 3D view. To be able to texture paint a model in the 3D view, you need to have assigned UV coordinates to the mesh's faces by unwrapping. Texture Painting mode Is accessed through the Image menu on the UV Editor header, or by changing the object mode on the 3D header to "Texture Paint".
The Image menu in the UV/Image Editor.
Texture Paint mode, with the Image Paint panel. Whether you are painting in the 3D view or in the UV/Image Editor, you must have an image selected in the UV/Image Editor (just called the Image Editor from now on, as we're done with the UV functionality). If you have an image loaded for some other reason (a texture, a background, etc.), you can select it on the Imageblock selector dropdown on the Image Editor header.
The Imageblock selector. If you would like to create a completely new image, choose "New" from the Image menu, then set a resolution in the dialogue that pops up. A new, black image is created and loaded into the Image Editor. Callout: You can paint directly on images by setting the Image Editor or object to Texture Paint mode. Pressing the C-key in Texture Painting mode in the Image Editor brings up the Image Paint palette. A nearly identical panel, called Paint, is available in the Edit buttons (F9) for use in the 3D view.
The Image Paint and Paint panels. Painting is accomplished by LMB dragging across either the image itself or the model in the 3D view. The general brush controls are: Color: Chosen by LMB clicking on the color swatch. This is the main color that is used for painting. Opacity: How strongly the painting blends with the current image. An Opacity value of 1.0 causes the painted color to completely cover the existing image. 0.50 would cause the color to be applied at only 50%. Size: Adjusts the size of the paint brush. Falloff: The hardness of the brush. Setting Falloff to 1.0 creates a hard-edged brush. Reducing it to 0.0 creates a brush with a very soft edge. Spacing: How frequently the brush "stamps" its color as you drag. Painting in Blender isn't truly continuous as it is if you were to drag a brush loaded with oil paints in the real world. The Image Editor simulates continuous painting by stamping the color every few pixels, in the shape of the brush. The Spacing value is a percentage of the Size value and determines how far apart these stamps occur. If Size is set to 45 and Spacing is set to 10, the brush will paint a new blob of color every 4.5 pixels (10% of 45). If you happen to have a pen and art tablet for your computer, you'll find that it works very well with texture painting. Clicking the little "P" icon beside any of these settings will allow them to be controlled by your pen's pressure.
Airbrush: Enabling this option causes paint to continue to flow for as long as you have the LMB pressed, even if the brush is stationary. Normally, painting only occurs as the brush moves. In addition to painting with a color, it is also possible to paint with a Blender texture, giving even more detail to your painted image. Any texture that has been created in the Texture buttons (F6) can be selected in the dropdown at the bottom of the Image Paint palette. That texture is then used along with the palette color when painting. Note: See Chapter 9 for information on using the Texture buttons. Textured brushes can be created in the Texture buttons by selecting the Brush button in the Preview panel. Draw Modes The top of the Image Paint and Paint palettes control the brush mode. Draw: This is the normal painting brush that you have been using. Soften: This brush blurs the image as you use it. Smear: Dragging with this brush pulls and smears the image. Clone: The clone brush lets you paint portions of other images into the one you are working on. The clone brush is not available when painting in the 3D view. When the clone brush is selected, the texture dropdown at the bottom of the Image Paint palette is replaced by an image selector dropdown. You can select any other image that has already been loaded into Blender. When you do, that image shows up in the background at 50% opacity. Painting with the clone brush copies the portion of the image under the brush into the active image. The background image may be moved around with the RMB in order to align portions of it with different sections of your main image.
A clone image used in the background. Image File Management It is important to remember to save any images you create or alter in the Image Editor. If you don't, any changes you've made will be lost when you quit Blender. To save your changes to an image, or to save a new image for the first time, select "Save" from the Image menu in the Image Editor. Blender will let you know that an image has unsaved changes by placing an asterisk (*) beside the Image menu.
Unsaved image indicator One Last Bit of Fun For a final cool trick, try clicking the Lock icon on the Image Editor header. If your object is visible in the 3D view while painting in the Image Editor, the Lock will show you the painting in the 3D view in real time. To be able to see it, either enable Texture Paint mode in the 3D view or set the object's Draw mode to Textured.