The Basics of UV Mapping in Maya 2011

In the process of learning Maya I've been frantically searching the Internet for some sort of basic tutorial on creating a UV map for a model in Maya, unfortunately with little success. With some help from colleagues I've managed to work out the basics, but I thought it might be nice to record what I've learned. Maybe it will help you. As an example I will be creating a UV map of this rock. Hopefully this is a good exemplar because it's simple, but not so simple that describing the process will be unhelpful. Here's my model:

01-initial model.jpg

The first step is to apply a material to the object. It doesn't matter what, so I'll use a basic Lambert. We (by which I mean me, and you if you're similarly following along) select the model and under the rendering tab, click the lambert icon (the dull sphere).

02-apply material.jpg

Next we'll add a stock texture so we can see the UV mapping as we work. I'll use a checkerboard pattern. To apply the texture, in the Attribute Editor click the small checkerboard icon next to the color property of the Lambert material you just created. In the box that pops up, select the check pattern. To see the applied texture in the editor window, press 6 on the keyboard to show textures.

03-apply texture.jpg

The initial mapping is, well, awful. You can see where the checkerboard is stretched and contorted. Ideally the checkerboard should cover the object evenly. The UV mapping we're creating will correct this. To get started, open the UV texture editor window:

04-uv texture editor menu.jpg

In the window you'll see the default UV mapping. We'll be replacing this with our mapping.

05-default UV's.jpg

We'll be using a number of planner mappings to piece things together. A planner mapping is just what it sounds like, the vertices of the model are flattened against a plane and become the UV's of the map.

06-planer mapping menu.jpg

When you choose the menu item for planner mapping, open the options box so you can adjust some settings. Set "Projection From" to "Camera". This will use whatever angle the camera is looking as the plane that is projected (hence the name ^_^ ). You'll also want to choose "Keep image width/height ratio". If you don't then the UV arrangement will be distorted to fill the UV plane rather than maintain their relative distances.

07-planer mappting settings.jpg

Hit the project button and the result will be something like this:

08-planer mapping result.jpg

Notice how the checkerboard looks all neat and tidy now? That's what we're looking for.

Before we move on, there is a very important setting we need to adjust. This was one of the things that I didn't find in other tutorials. In the Channel Box, find the settings for the planner projection you just made and edit the Projection Width and Height properties to some easy to remember number, it doesn't matter what. I use "100". You'll notice when you do this that the scale of your UV's in the UV editor will change, which is fine.

09-planer mapping size.jpg

We do this because we're going to be making a number of planner projections. When Maya makes a projection it does all it can to maximize it's size within the UV plane. This means that each time the UV's you get are at a different scale. If you then went and tried to texture this object with a repeating pattern then some parts would magnify the pattern and some would shrink it.

If instead we set these values to some common number each time we make a projection then they will all have the same scale.

Now we're going to start dividing things up. For some reason, (and you may have already noticed this) when you don't have any UV's selected Maya likes to show nothing in the UV editor, which can make finding the points to adjust very difficult. You can make this easer by turning on UV shading in the tool palette of the UV Texture Editor.

10-shaded uv's.jpg

This setting will also help you see if you have overlapping areas (which are to be avoided). You might also want to toggle the texture image on or off, or dim it if it's getting in the way. You can do that with the other set of highlighted controls in the same window.

OK, well if you start moving your model around you'll notice that from the projection direction the mapping looks pretty good, but along the edges things get stretched out and distorted. To address this, we're going to make several more planner projections from different angles to get a good mapping all the way around. However, before we do that, we want to keep the mapping we have in the areas where it's working.

To do this, in the modeling view select the faces you were looking at when we did the planner mapping. As you do, you'll see them highlighted in the UV Texture Editor as well. We're going to separate them from the others. When you have them all selected, in the UV Texture Editor click the "Separate Selected UV's" button. You can then move this grouping off to the side somewhere.

11-move uv away.jpg

Time for another projection. Move the model so you can see it from another angle where the mapping is poor, then select the faces you want to remap. Then, just as last time, perform a planner projection. Don't forget to adjust the width and height properties of the projection to whatever number you are using.

12-next angle.jpg

When you do this you'll see another set of UV's show up in your UV Texture Editor. You'll also notice that the corresponding UV's in what's left of that original projection have been removed. That's because you've replaced them. This is a good way to make sure as you progress that you have a mapping for every face on the model.

Move the new projected part off to the side somewhere and continue on making projections until you've got the model covered. For this model I ended up with 4 pieces.

The next thing you'll notices is that where the surface of the model has been cut into different UV pieces the checkerboard pattern is discontinuous. You can think of this mapping process as taking the peal off of a piece of fruit and then pinning it down to a piece of paper. You have to cut the peal so that it can lie flat without overlapping. When you stretch the peal back over the fruit, it leaves seams where it was cut.

For most models it's unavoidable to have some seams like this, so the goal is to place them in places where they will be less obtrusive. Here, because I'm making a rock, I can make my seams fall along the edges of the rock where the surface texture would naturally be discontinuous. You can also work to hide the seams when you create the images that will form your textures. The point is, put some forethought into where your seams should be.

There are also times when it's advantageous to make 2 projections of an area, but then to stitch them back together in the UV Texture Editor to remove a seam. Here for example I have 2 projections that I would like to join together.

13-full mapping.jpg

By highlighting the associated faces on the model I can find the corresponding edges of my projections. Next I'll position them as close to each other as possible, and then move the individual UV's so that they are nearly coincident.

14-align for sewing.jpg

As you move the individual UV's, watch the model. You'll see the texture swim along the surface. As you move them, do your best to maintain a regular pattern.

Once the UV points are nearly on top of each other, select the two UV's and click the sew button in the toolbar to combine them.

15-sew uv's.jpg

You may also find that along some of the faces that were not quite parallel to your projections the texture has been slightly stretched or distorted. You could perform another projection and then try and sew the pieces together, bit sometimes for small areas it's easier to just adjust the UV's by hand.

Here for example the top face looks a but stretched out, so I'll move the corresponding UV point in the UV Texture Editor.

16-problem area.jpg

Much better. Here's my finished mapping:

18-finished mapping.jpg

Next we need to fit these pieces into the upper right quadrant of the UV plane. We want the pieces to be as large as possible so they are easy to paint, so we're going to rearrange them to be in a roughly square area.

If this were a character model or some other complex object with some areas of low detail and others of high detail, we might scale areas like the face or hands to be much larger, and the other areas smaller to make painting in all that detail easier. In this case however we want the projections to keep their relative sizes so that a rocky texture of a single scale can be applied to the whole thing.

You can translate the pieces and spin them all you want, but don't scale them individually or they will get out of proportion.

When you have them arranged, select all of the UV's and shrink them so they fit into the upper right quadrant.

19-scaled map.jpg

Hey guess what. You"re done! At this point you can export your mapping to Photoshop or whatever image editor you prefer and apply whatever colors or images you're object requires.

I hope this has been helpful. I should point out that I just learned how to do this myself, so some of what I've described above my not be the best approach (or even completely wrong). At the very least, it may be much faster to use some of the other projection methods rather than sticking with planner projections. For this object for example, because of it's roughly columnar shape, a cylindrical projection might have been a better starting point. No matter the projection you use, the basic techniques and principles are the same.

Good luck!