B I G P O N Y.com Logo
Home
Code
Art
Writing
Big S
About
Links
Overview
Blender Conference presentation list

Hair Particles
My Hair Particle presentation

UV Mapping
Byron's UV Mapping presentation

Byron's UV Mapping Presentation
Byron Kindig presented UV Mapping to the attendees of the Blender Conference. You can download a ZIP Archive of the files from the presentation if desired.


In this demo today we will be learning one way to create a UV Texture map for a simple character. This will work for other objects such as buildings as well.


Need Mesh

First we will need a mesh to place our UV map onto. We will use a simple and not so sophisticated character mesh, I call Ugly Bob. (UglyBob.blend) We will be opening the mesh up so that it will lie flat. In order to do this we will need to mark some seams so that we can “cut” the mesh. We want these seems to be in places where they will not show as much. We well put as many as we can at borders of clothing to help hide the seams.



Marking Seams

Make sure the mesh is selected in object mode and then Tab into edit mode. Once we have decided where we want to cut our mesh, we need to select those edges. This is of course best done in Edge Select mode. Once the edges are selected, press Ctrl E Key and select “Mark Seams.” When an edge is marked as a seam, it will turn orange, to make it easier to find. We don’t need to do them all at once. We can add edges to our seams, as well as remove edges. If we have marked seams and then change our mind we can reselect the edges and with the Ctrl E Key again, choose “Clear Seams.”
(UglyBobSeams.blend)
Unwrapping our Mesh

Before we unwrap our mesh, we need to select all the faces in Edit Mode. This can be done with the A Key. If you want to only place a UV Map on some faces, select only the faces you want to place an image on with any of the usual face select techniques.

Make one of the windows on your screen into a UV Editor window if you have not already done so. The UV Editor window has a grey grid, with its own cursor. It looks similar to the 3D cursor, but is a diamond shape instead of a circular shape. Remember, the UV cursor is a 2D cursor instead of a 3D cursor, because a UV image is a 2 dimensional image that is mapped on the surface of a 3 dimensional shape.


With your mouse pointer in the 3D view window press the U Key and choose "Unwrap". The UV Editor window will show your UV layout. It looks like a bunch of vertices with dashed lines connecting them. Do not be fooled. They are not really vertices! They are called nodes, and there are more of them than there are vertices in the mesh. Where ever their was a seam cut, there is node on each side of the cut for every vertex.


The good news is that although they are not vertices, they can be selected, moved, rotated, and scaled, the same way that vertices are moved, rotated, and scaled. If you want to move a node, select it and press the G Key. If you want to constrain it to the left and right axis press the G Key, then the X Key. If you want to constrain the movement to the up and down axis, however, press the G Key followed by the Y Key. Again it is a two dimensional image, so there are only 2 axis, X and Y, but not a third or Z axis.

Rearranging our layout

Sometimes the layout has islands that overlap. We can select one node from an island by right clicking on it. We can then press the L Key to select all the connected vertices. Once the entire island is selected it can be scaled, rotated, or moved to a new location where it does not have to share space with other islands, and therefore have its own texture and color.

(UglyBobRearange.blend)
Pinning and Live Unwrap Transform

Sometimes we want to change the UV lay out so that faces that need more detail are larger and faces that don't require so much detail are smaller. If you look at the nodes that represent our character's face, (highlighted in the image above,) for example, you will see that the area that we want the most detail has the smallest area on our UV layout. We can use Pinning and Live Unwrap Transform, to stretch this area into an easier layout to work with. You can think of the pinned nodes as handles with which to stretch the layout.

First click on the UVs in the UV Editor window's footer and select Live Unwrap Transform, from the menu. Now select one or more nodes in the layout and press the P Key to set it as a pinned node. You will know it is pinned because it will be highlighted in red. You can Unpin a node by selecting a pinned node and pressing the Alt P Key.

Now if you select a pinned node or group of pinned nodes, and move, scale, or rotate them, they will stretch the island that they are part of.

(UglyBobPinned.blend)
As you can see, the area of the character's face is a lot larger and relatively easier to see when we start to create a texture for it.

You can select all the pinned nodes by pressing Shift P Key

Save UV unwrap

Once you save your UV Unwrap you can not change the locations of the nodes or your image will be out of registration, so be sure it is as you want it before this step.


Change the window on the left to a scripts window and open the Scripts menu and choose, "UV", then "Save UV Face Layout". By default, the image will be saved as a Targa file. Name it and save it to a location, where you can locate it easily. It will come in handy in the near future.

Creating UV Texture Image

In the footer of the UV Editor window, click on Image then New.

In the pop up window click on the color picker window and choose a base color for your texture image. It will be Black by default, but I like to make it the color of the skin of my character. Also name the image and choose the width and height dimensions of the UV map image. If you will be using this in a game, remember to keep these dimensions both square (Width = Height,) and also equal to a power of 2,(256, 512, 1024, etc.) The smaller the image, the faster the rendering, which is especially important for games.

When you are done, click the OK button. Your UV image will suddenly be too large for the window, so go ahead and press the Home Key to bring it down to size. Remember, the UV Layout image and the UV Texture image are not the same.

You can now change the window on the left back to a 3D View port window. Change the Viewport Shading to Solid, and the Mode to Texture paint. This way you will be able to see your texture in real time, (although right now it is just a solid color.) The buttons window will now have a Paint panel with controls for your brush and a color picker.

The Tab key will now toggle between Edit and Texture Paint mode. When in edit mode you will be able to see the UV layout superimposed on the UV image in the UV Editor window. In Edit Mode you will also be able also to paint onto the UV image with your left mouse button or pen tablet if you have one. Remember you can change options in the Paint panel in the buttons window. Use the color picker to choose a color. Use the sliders to control the Opacity, Size, Fall Off, and Spacing of your brush. Click the little "p" at the other end of the sliders to allow the pen pressure to control this parameter if you are planning to use the pen tablet. Be sure the Draw button is selected to be able to paint. You can Soften or Smear the colors with the other two buttons, but they will not color anything.

In the footer of the UV Editor window, scroll over (Middle Mouse button, click and drag,)to the Edit button with the pencil icon and click it, to be able to edit the UV image that is now only a solid color. Now scroll back to the left and click on View and then Paint tools. This will open a floating panel with the paint tools in the UV Editor window.

In Texture Paint mode ( Remember, Tab toggles between Edit and Texture Paint modes,) you can paint directly on the mesh in the 3D View port window and it will be copied onto the UV image. My preference is to start by painting a little on each of the parts of the mesh as a way to identify which islands in the UV image belong to which parts of the mesh. They are often so distorted that I am not sure, otherwise. Then I like to go back to the UV Editor window, Tab into Edit mode and finish painting directly on the UV image.

Before closing Blender be sure and save the UV image changes, by going to the footer of the UV Editor window and clicking on "Image", then "Save", or "Save As".
(UglyBobColor.jpg)

Importing UV Layout in another program

Although you can do a lot with the paint tools in Blender, it tends to be slower and has fewer options than some other 2D graphics programs. You may want to use another program such as The Gimp, or Photoshop, to refine your UV images. To do this open both the UV image (UglyBobColor.jpg) and the UV Layout targa files,(UglyBobUVlayout.tga) in your 2D graphical editing program. Select the layer in the UV image and duplicate the background layer. Add another layer on top of that. Go to the UV Layout image and select it, copy it, and past it on the blank layer of the UV image. Change the blending type of the layer of the UV Layout copy to Multiply. That will allow you to see what is underneath.

Editing and saving Texture map

If you have a photo of a texture you want to apply to the skin of your character, open the texture image in the 2 D program and use the clone tool to paint it onto the UV Image.

When you are done, turn off the UV Layout layer and save the image. (UglyBobColorPhotoTex.jpg) You will need to reload your UV image when you return to Blender.

In order for the UV Texture to Render you must add a new material to your mesh. You then need to add a texture and make it an image type. You can then use the UV image that you have created from the menu as it is already loaded. In the material setting under the Map Input panel change from Orco (Original Coordinates,) to UV. In the Map To panel the default should already be set to Col for color.

One material, Several Texture types.

You can add other textures as well, such as for Nor (Normal) and assigning a grey scale image to it to paint in wrinkles or warts onto your character. This is much easier to do in the 2D program where you can keep color on one layer and bump or normal on another layer. You can make one layer semi transparent in these programs to align the bumps with the color variations. Be sure to save the individual layers to their own image files. Remember you can adjust the amount of effect the normal map has in the Map To panel with the Nor slider.

There are lots of other tutorials on this subject that you can find if you search the web. I hope this one was helpful, but if it is not clear, don't give up. Just look for another tutorial.