Sponsored By

UV Mapping Tips And Tricks

In this paper, Renier Johannes Banninga attempts to counteract the insanity of UV mapping by sharing every trick and technique he knows for making the process of texture mapping easier.

Game Developer, Staff

March 25, 2004

24 Min Read

The movie and game industries have made giant leaps in visual realism over the last 10 years. We're able to create fairly realistic creatures now, featuring everything from muscle dynamics to cloth simulation and even accurate liquid dynamics. Visual effects work has become a science and an art rolled into one.

But one subject that gets little attention is texture mapping. It's always the last part that the 3D modeler wants to deal with, yet it's something that can make texture artists go insane.

Imagine you've just finished your latest creation: a fantastic, multi-limbed creature with layers of internal mesh details. Now it's time to create the UVs. But despite its beauty, you've created a nightmare: none of the basic modifiers will work. It's an all-out custom job to complete the texture mapping. You have to give each surface its own unique mapping to eliminate any distortions. That means no stretching or shearing, and keeping a consistent pixel density over the entire character. While you're doing this, you also have to come up with a texture map that's understandable to the texture artist. And of course, you need to finish all of this in time to hit your deadline. Welcome to the world of texture mapping.

My primary goal with this paper is to arm you with every trick in the book when it comes to UV mapping, and provide tips and methods to use in every situation. My second goal is to share some tricks in achieving more texture detail in real-time games by the use of blending techniques using small modular detail textures.

The Basics

Mapping Types And Their Uses

Planar

Planar mapping is the most basic of the mapping modifiers to apply to objects. It works by projecting the texture onto a model from one direction. So it's useful for objects like walls and basic terrain. But it can't effectively be used on complex objects with many overlapping surfaces, since it often stretches the polygons that don't face the projected map directly. There several ways to fix these problems, which we will be cover in a moment.

banninga_01.jpg

 

 

Box

Box mapping works by projecting the desired texture onto the model from six sides. This is very handy when working on technical or architectural objects, and when you just need quick mapping for less important parts of an object. Unfortunately, it's not very useful for organic objects where you need accurate mapping. An example of a situation where box mapping is useful is for tiny screws on a cargo container, or some metal bars or grates in a factory. It becomes less useful when you start working with more complex objects that require specific mapping.

banninga_02.jpg

 

 

Spherical

Spherical mapping projects the texture in a spherical pattern onto an object. Space junkies love using this technique to map asteroids and planets, but one side effect that it causes is very high pixel density at the poles of the spheres mapping. This causes a pinching effect that's hard to counter when painting the texture. It's helpful in blocking out mapping on human heads, but it still requires significant tweaking afterwards. It starts to lose its usefulness on models with many overlapping parts.

banninga_03.jpg

 

 

Cylindrical

Cylindrical mapping is used more widely then any other type of mapping. Projecting the texture in a radial pattern inwards makes it very useful for mapping objects like tree trunks, arms, torso and legs. It's very handy for blocking out mapping on various types of meshes. But it still requires a lot of tweaking afterwards in the UV editor. Like the other mapping options, it doesn't work in every situation.

banninga_04.jpg

 

 

Shrink Wrap

I have yet to see anyone use this modifier to map objects. I have yet to figure out its purpose or how it works exactly, because it seems to create some of the most useless mapping solutions of any technique. I don't recommend using this technique for any object, and if somebody does find a use for it, let me know. I am curious to see how it could be put to practical use.

banninga_05.jpg

 

 

Pixel Density and Stretching

It's important to make sure that your mapping keeps a consistent aspect ratio for the pixel size in the texture map -- nothing annoys a texture artist more than warped mapping. Keep a lookout for areas where the texture gets stretched or skewed. The last thing the texture artist needs to worry about is correcting his texture to counter any warped mapping. It's also considered wasteful when you use more pixel area than required.

Mapping Seams

Seams are an artifact produced by cuts in the mapping because of the shape of a mesh. You can't avoid seams, but you can minimize their effects and the amount of effort it will take the texture artist to fix them. Simply align the vertices of the seam with the corresponding connection in the mapping on either the horizontal or vertical plane of the texture coordinates. This way the pixels align on one of the axes when the texture artist fixes and hides the seams. For technical objects, it's easier to get away with seams since they tend to be quite fragmented, and the nature of the object allows it. But for organic meshes, you should minimize the amount of seams as much as possible by using accurate, continuous mapping (which I'll cover a later in this article). The other solution is to use a good 3D paint program like DeepPaint 3D.

banninga_06.jpg

 

 

Symmetry Mapping and Overlaps

Sometimes you encounter models - character models, usually -- that are the same on both sides (also called bilateral symmetry). When this is the case, you can cut your mapping time in half by mapping one side of the model and then mirroring it onto the other half.

Another optimization that you can use is overlapping mapping coordinates. For instance, say you have a character with lots off spikes protruding from his back. You can map all those spikes using the same texture by overlapping them all onto the same area. For a real-time character, this saves you a lot of unneeded texture resolution that could be better used elsewhere, instead of mapping each spike individually.

banninga_07.jpg

 

 

Tiling Textures

Tiling graphics has long been one of the quickest ways to save memory and mapping space. For example, a repeating pattern could be used on a rubber hose or the treads on a tank. A tiled texture allows you to use a small texture area and repeat it, conseving pixel density while achieving a realistic effect. Terrain artists use tiled textures extensively, but they use blend maps to hide the tiling pattern by mixing other tiling textures over each other. We will cover this more in depth later.

Advanced

Optimized UV Layouts

Optimized UV layouts are particularly relevant for real-time characters. In a nutshell, don't waste any space in your texture mapping. Since the entire texture gets loaded into memory, you should use as much of the texture area as possible. To do so, you should scale, rotate and move those UV-mapped vertex bits until you can't save another ounce of space. Think of it like a giant puzzle with no picture to work with. Your job is to maximize pixel resolution and leave as little unused space as possible. A good UV-mapped model can use up to 90 percent of the final picture. If there are parts of a model that rarely get seen, scale the UV mapped space down to 50 percent of its original size and cram it in somewhere.

banninga_08.jpg

 

 

Continuous Mapping

Continuous texture mapping usually only used for organic creatures. With this method, you try to link all the relevant body parts' mapping so as to reduce the number of seams. This typically involves clever warping and arranging the UV-mapped bits for the mesh you're attempting to map. In the figure below, you can see that the body, legs and head consist of a single mapped area. I also used symmetry to save texture space. This gives the texture artist fewer seams to work around and makes his life easier. In short, the more parts you can link together, the better. Trying to do this with mechanical parts is almost impossible, however: it usually warps the texture.

banninga_09.jpg

 

______________________________________________________

Creating texture maps for organic models is easy in some respects, but it does come with its own pitfalls. First, you're bound to encounter some crazy shapes when mapping an organic creature. But the blessing is that you can get away with much more warping in the mapping because of the model's curvy nature. Continuous mapping is definitely a key technique you should use when mapping organic shapes. Keep an eye on your seam count and look for ways to just unify everything into a continuous map, while using as much of the texture space as possible - this is almost an art unto itself.

banninga_10.jpg

 

Technical Model Mapping

Technical objects are actually fairly easy to map. The difficult part is organizing and optimizing the layout for the poor texture artist. All the texture artist gets is a giant, colored puzzle, and he'll spend hours trying to figure out where every part goes.

There are some simple rules to follow when mapping a technical shape:

  • There should be no distortion with the mapping. This is a technical shape, so keep your mapping as true to the original polygons as possible.

  • Pixel aspect ratio is very important. Nobody wants to paint tons of little rivets and bolts and then notice that they're being squashed or stretched on the final mesh.

  • Orientation is critical. If the texture artist needs to place logos on several polygons somewhere on the object, make sure you keep those polygons at 90 degree angles to each other. The last thing the artist wants to do is rotate logos into odd angles to make them show up vertically or horizontally on the final mesh.

  • Make it easy to figure out. It has to be a functional map. So it has to use its space effectively while still being comprehensible for the texture artist. It really is a balancing act.

banninga_11.jpg

 

 

UV Mapping With Shader Effects In Mind

Shaders are a welcomed change in the world of gaming. John Carmack really introduced the concept and his artists took full advantage of it. Quake 3's characters and environments greatly benefited from the use of shaders. From cheating effects like cascading waterfalls to the patterns of energy running through the outer layers of mech armor plating in Zone of the Enders, shaders have opened up a new range of visual possibilities for artists everywhere. All you have to do to achieve these effects is follow some basic mapping rules.

Say, for instance, you want to create a flowing river that wraps around objects that get in its way. All you have to do is decide which direction the water will flow, and then orient and distort your mapping to help achieve this. The picture below illustrates the mapping and final look of the effect. All I did was straighten out the more curved areas so that when the shader is applied, it will looks like it is actually flowing around obstructions.

The same rules apply for things like tank treads and billowing smoke, which were created with polygons instead of particles in Freedom Fighters. The game just used a simple scrolling texture with the model's mapping oriented to take advantage of it.

banninga_12.jpg

 

 

Blended Detail Textures With Layered Materials

A detail texture is a texture that's blended over another texture, to a degree that's based on your distance from the object. The advantage to this is that you can cheat a lot of micro details without actually having to use a massive image. For instance, imagine you have a brick wall that's 256x256 pixels in size, and another one at 128x128. The smaller one would be used for the detail texture. Usually when you start getting really close to a wall it starts looking blurry, but when the bigger texture is used in combination with a smaller detail texture that fades in when you get closer, it gives the illusion of greater detail.

There's another use for detail textures as well, which requires some programming to create a pixel shader for your game engine. Using a shader, you can use up to three different detail textures at the same time on a model, using either vertex colors or an extra texture to define the blends. You use the RGB color values in the picture to define the blends, and each color value coincides with one of the detail textures that you define in the game's material system. This permits smooth blends from one detail texture to another, because it checks the RGB level. (Black, of course, won't show up at all.) The figure below shows a color example and the final results when using the detail textures in conjunction with a color map.

banninga_13.jpg

 

And the final bend of the face itself:

banninga_14.jpg

 

 

Renier's Texture Mapping Process

No I'll explain a method that I developed for UV-mapping objects in 3ds max. It takes a little work to get use to, it but once you're accustomed to it, you may never map objects the same way ever again.

Think of it like skinning an animal, then removing the skin, laying it out on the ground, and painting it. To begin the process, I clone the object and then take it apart manually in 3ds max. Then I organize it and apply mapping to it, saving that out to a separate file. Finally, I select the original object and load the mapping data from the cloned version. That's an overview of the process, now let me explain it in more detail.

Things To Keep Track Of

Keep the same polygon count. The polygon count of your object needs to stay the same as the original from which you cloned it. When doing the final welding, make sure you don't accidentally delete or merge any polygons. Otherwise your mapping will fail to load and you'll need to do it all over. Save regularly and keep an eye on that polygon count every time before you save.

Detach to same object. When breaking up the model into the desired sections that you want to map, make sure that you detach it to the same object. Otherwise you will remove polygons, and the object's mapping will become invalid and you won't be able to load it back onto the original mesh.

Mapping by hand

Clone object. The first step is to create a clone from the original object. Write down its polygon count and put that aside for later reference. Next, hide the original mesh because you don't want to edit it -- you're going to be taking the cloned mesh apart and you don't want to change the original.

banninga_15.jpg

 

 

Fragmenting the Object. Since this is a symmetrical mesh, there is no reason to map both sides at the same time. So before you clone the mesh, delete the right side of the head. Just map one side and mirror its mapping to the other side.

Now the mesh is ready for mapping. Hide the original mesh, start taking the clone apart. In the image below you can see I've isolated the ear, the inside of the mouth and the front area of his hat to be the first areas to cut.

banninga_16.jpg

 

 

The beauty of this process is that you have all the modeling tools at your disposal when taking apart the model. Simply pick a viewport that you want your polygons to face and then start taking the mesh apart, arranging the polygons to face in the desired direction, as shown in the figure below.

banninga_17.jpg

 

 

As you can see, I started detaching the polygons and made them face the viewport as much as possible. This ensures an accurate pixel density for all the objects I map. Make sure you haven't deleted any polygons in the process.

Next we move to the face. In the next figure, I've highlighted the sections that I plan on breaking apart:

banninga_18.jpg

 

 

I begin detaching them from each other, orienting them towards the viewport at the optimal angle. I keep an eye on my polygon count just, to make sure I haven't deleted anything, then save the scene in case my PC crashes.

As you see in the next figure, the mesh is very fragmented. That's not a problem, though - I will take care of this eventually.

banninga_19.jpg

 

 

Now that everything is detached and laid out nicely, we can begin to organize it. I keep to a 1x1 aspect ratio for the layout since this model will be used for real-time game graphics. After moving around some polygons here is the end result:

banninga_20.jpg

 

 

Reassembling the Puzzle. Now that it's organized, it's time to weld the polygons back together again. This process is simple and doesn't take much time. Just keep and eye on the polygon count when merging the vertices. After some welding, here is the final result. Now it's time to transfer the mapping over to the final object.

banninga_21.jpg

 

 

Transferring mapping. Select the mesh and apply the planar map to the model. Now that it has mapping, apply the UNWRAP modifier. This is the modifier I use to load and save the mapping of the model. Click and save mapping for the mesh.

Saving and Loading mapping. Next, unhide the original model and apply another UNWRAP modifier to it. Click on "load" and then apply the mapping from the cloned model onto the final mesh. Click on "Edit mapping" to check if the mapping loaded properly.

banninga_22.jpg

 

 

If all went well, you have a model with accurate mapping.

Enjoy your newly mapped model!

______________________________________________________

Read more about:

Featuresevent gdc
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like