Home Technical Talk

UV Unwrapping Best Practice Factors & Priorities

polycounter lvl 11
Offline / Send Message
RedRogueXIII polycounter lvl 11
Well a friend asked me about uv mapping priorities and I kind of went overboard. So as a mini-tutorial, here is a first draft on things to keep in mind when manually uv unwrapping. Any insight, correction or revision to what I have laid out would be appreciated, as I hope that this advice can be further refined into a full tutorial or checklist based on asset type, platform, and production method.


UV unwrapping has no one way that can be considered best for all situations and requirements. Instead it must be balanced between a series of priorities that should be adjusted whenever the situation calls for one specific quality over another. The order and listing of qualities here are based on my personal experience of uv unwrapping weapon assets for first person shooters, using a 2D image editing program, Photoshop, to create the textures. Weapons in first person shooters are single instance assets, highly visible, close to the camera and animated, thus the following order of priorities:

1. Visibility : Certain faces are going to be more visible than others. Thus to make the best use of uv space the relative sizes of the uv islands should be adjusted so that the close up and highly visible faces are scaled up and occupy more space than rarely viewed areas (eg. the interior of a car in a racing game that has no cockpit view, or the front of a gun in FPS view).

2. Readability : Distortion in the uv unwrap makes it harder to texture fine linear details such as text and engravings accurately, however if there are too many seams then it becomes even harder to texture as minor differences in the texture across the gap in the seams become immediately noticeable on the textured asset. Therefore you want to place minimizing the amount of seams before minimizing the amount of distortion in the unwrap. (eg. texturing a spiral onto a curving tube is much harder when each face is a separate island with no distortion than one complete piece with
minor distortion.)

3. Seam Optimization : Each UV island is a separate drawcall when rendering, so the less uv islands there are the more efficient your uv layout is. However this is untrue for uv islands where the actual polygon geometry has either a hard-edge, a smoothing angle of about 70 or higher, a 90 degree connection between faces, or seam between faces as when these situations occur it will also add another drawcall. Thus to maximize efficiency UV island seams should be positioned at these natural intersections of the geometry. This is especially important for the "next-gen" workflow where normal maps are baked from high polygon geometry onto low polygon uv-mapped geometry, because without empty distance in the uv unwrap between the faces connected there will be a visible error in the normal map due to conflicting normal tangents. (eg. the faces of a perfect cube should all be separate islands because they are all connected at 90 degrees to each other. Baking a normal map of a cube with curved edges onto this will not cause any rendering errors later on, but better yet small angled chamfers between the main faces will avoid the normal error and allow you to unwrap the geometry in one large connected uv island. Geometry is much cheaper to process than textures so feel free to add supporting faces to help with the normals and lighting.)

4. Direction : Make the direction that the uv islands consistent, because if they are all oriented facing one direction it will be easier to visualize and paint on directional effects such as diffuse lighting, colour & camouflage overlays. (eg. Orienting all upward facing geometry so that the top vertices of the uv island are closest to the top of the uv unwrap. Thus when painting on light it is easy to visualize light coming from the top of the image and you are less likely to make mistakes.)

5. 2^x Texture Resolution : There will be some cases in which your unwrapped uv islands do not make the full use of the (0,1) square as the islands are overall rectangular and long. (eg. a sword or stick) It is tempting to squash the islands into the normalized (0-1) space and then export the texture image with rectangular dimensions. (eg. 128x1024) But some game engines can only process square images so they will take rectangular textures and convert them into a square using the largest dimension (so a 128x1024 becomes a 1024x1024). This basically wastes a large amount of texture space because of the new dimension most of it is just interpolated pixels from the original size. Therefore to make best use of these irregular islands, it would be best to pack them together in the same normalized (0-1) uv space with other assets of similar rectangular shape on one square texture to make the most of computer memory, and reduce drawcalls.

The goal is to create better art faster, so there are definitely variations of priority and potentially other factors to consider when manually unwrapping meshes.

Replies

  • Eric Chadwick
    Mostly good advice, thanks for writing this up, and for sharing it!

    However a couple things I noticed...
    3. Seam Optimization : Each UV island is a separate drawcall when rendering, so the less uv islands there are the more efficient your uv layout is. However this is untrue for uv islands where the actual polygon geometry has either a hard-edge, a smoothing angle of about 70 or higher, a 90 degree connection between faces, or seam between faces as when these situations occur it will also add another drawcall. Thus to maximize efficiency UV island seams should be positioned at these natural intersections of the geometry.
    UV seams do not cause drawcalls. When the model uses more than one material... this is what causes additional draw calls.

    Edit... a draw call is when the game engine has to send a new set of vertices to the graphics card, to be rendered. Only vertices that share all the same material (same shader) can be sent together in a single draw call.

    UV seams do increase the number of vertices for the model. But it's really not that big of a deal, unless you have something aberrant, like every quad is a separate island.

    Smoothing groups in 3ds Max... the angle you use isn't what matters. It matters only how many hard edges you have. The angle setting only helps to automate the creation of these hard edges. When you have a hard edge that isn't shared with a UV split, this will cause the vertex count to increase.

    Some good reading...
    http://wiki.polycount.com/PolygonCount#Articles_About_Performance
    ... This is especially important for the "next-gen" workflow where normal maps are baked from high polygon geometry onto low polygon uv-mapped geometry, because without empty distance in the uv unwrap between the faces connected there will be a visible error in the normal map due to conflicting normal tangents. (eg. the faces of a perfect cube should all be separate islands because they are all connected at 90 degrees to each other. Baking a normal map of a cube with curved edges onto this will not cause any rendering errors later on, but better yet small angled chamfers between the main faces will avoid the normal error and allow you to unwrap the geometry in one large connected uv island. Geometry is much cheaper to process than textures so feel free to add supporting faces to help with the normals and lighting.)

    Empty distance doesn't have anything to do with tangents. Empty distance between UV islands is needed for texture filtering. http://wiki.polycount.com/EdgePadding

    More geom for tangents is a problem, but only if your renderer doesn't use the same tangent basis as your baker. Which most do not, unfortunately.
    Sticky: Understanding averaged normals and ray projection/Who put waviness in my normal map?
    5. 2^x Texture Resolution : There will be some cases in which your unwrapped uv islands do not make the full use of the (0,1) square as the islands are overall rectangular and long. (eg. a sword or stick) It is tempting to squash the islands into the normalized (0-1) space and then export the texture image with rectangular dimensions. (eg. 128x1024) But some game engines can only process square images so they will take rectangular textures and convert them into a square using the largest dimension (so a 128x1024 becomes a 1024x1024). This basically wastes a large amount of texture space because of the new dimension most of it is just interpolated pixels from the original size. Therefore to make best use of these irregular islands, it would be best to pack them together in the same normalized (0-1) uv space with other assets of similar rectangular shape on one square texture to make the most of computer memory, and reduce drawcalls.

    Almost all game engines these days can use non-square textures, without resizing them.

    As with much game modeling advice, it all depends on the game engine you're working with. Have a few talks with your graphics programmer, they'll help you straighten it out.
  • kylehorne3d
    Offline / Send Message
    kylehorne3d polycounter lvl 9
    Also its good to know about Overlapping vs. Non-Overlapping UV sets. You can Auto create a second UV set in Unreal for example, to use for a light map. The overlapping UV set would be good to paint more detail on objects that share the same textured surface.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    And straighten 'dem shells!
  • pedrodanielrf
    Just updating links send by @Eric Chadwick:
    "Some good reading...": Polygon Count - polycount;
    "Empty distance between UV islands is needed for texture filtering.": Edge padding - polycount.
  • oglu
    Offline / Send Message
    oglu polycount lvl 666
    cptSwing said:
    And straighten 'dem shells!

  • Neox
    Offline / Send Message
    Neox veteran polycounter
    oglu said:
    cptSwing said:
    And straighten 'dem shells!



Sign In or Register to comment.