Difference between revisions of "UV coordinates in Blender"

From PioneerWiki
Jump to: navigation, search
m (Tips)
(Basic method)
Line 35: Line 35:
 
== Basic method ==
 
== Basic method ==
  
to do...
+
First we're going to unwrap everything and place it off to the side of the texture, so we can see which faces we are yet to unwrap properly.
 +
 
 +
* Select your mesh in the 3D view. Tab to edit mode. Ctrl-tab to face select mode. Hit 'a' key until all faces are selected.
 +
* Hit 'u' key and choose 'Unwrap'. All faces will be mapped to the UV space - if you're on 'Texture' viewport shading mode in the 3D view you'll see your mesh covered in the grid texture.
 +
* Hit 'g' key in the UV view on the left. Move all the polygons to one side, so they're a decent way away from the grid. This gives us our pool of 'not done yet' faces.
 +
 
 +
Now we selectively unwrap and pack sections of the model. Choose a group of faces that are logically connected. Either they are going to look identical (perhaps windows, or engine outlet surfaces), or you're going to want them next to each other.
 +
 
 +
Select all the faces you want to unwrap together in the 3D view - it might help to turn 'Clipped with depth buffer' on. Hit 'u', then choose an unwrapping method - you'll have to experiment to work out which one works best for the geometry you're dealing with.
 +
 
 +
Move the polygons around in the UV map with 'g', 's' and 'r' until they're roughly where you want them. Switch to vertex mode and fine tune. If you have multiple vertices you want at the same spot, select them, hit 'w' twice to weld them together, then shift-s and select snap to pixel.
 +
 
 +
Select the faces you've finished with on the UV map ('b' for box select helps), then hit 'h' to make them invisible (alt-h brings them back).
 +
 
 +
Keep picking groups of logically connected faces, unwrapping and packing, until you're done.
 +
 
 +
If you need to find out which faces are left to do in the 3D view, box select the pool of 'not done yet' faces we made earlier (make sure you've got 'Keep UV and edit mode mesh selection in sync' selected).
  
 
== Using seams ==
 
== Using seams ==

Revision as of 03:24, 21 January 2013

This page is intended for a crash course in UV coordinates in Blender.

Links to good tutorials are welcome, as are tips from veterans, but the plan is to make a solid run-through for an absolute beginner, so if you're dealing with advanced topics likely to confuse a beginner please either leave them at the end, or perhaps consider a different page.

Tested on Blender 2.65

What is UV unwrapping?

Basically we're mapping a 2D texture onto a 3D mesh. Think of a world map's projection (like unpeeling an orange), or unfolding a cube to make a 2D surface.

Every XYZ point on the surface of our mesh must be mapped to a UV point on our texture. Fortunately we don't have to do it point by point - the vertices in XYZ space have corresponding vertices in UV space, and Blender interpolates the surface in between for us.

Even easier, Blender has methods for 'unwrapping' a mesh or part of a mesh. By repeated selective unwrappings, the computer does most of the work, and we just fine tune it afterwards.

Objectives

The main things you are trying to balance when unwrapping:

  • Size
    • Maximise use of texture space: You want to make your texture files as small as possible to avoid straining the game engine. Pack polygons into the map as tightly as you can, using space efficiently. A single part of the texture can be mapped to multiple polygons, and any faces internal to the model (which should be avoided where possible to prevent z-buffer issues) can be shrunk to a point.
    • Optimise detail: Parts of the mesh probably need more detail than others. The parts that should be highly detailed need more texture space, so should be made larger when unwrapped.
  • Control distortion: You can distort polygons on the UV map for effect, but assume to begin with that you want to minimise distortion. If your polygon is a square on the mesh, it should be square on the UV map.
  • Alignment: Where texture detail crosses contiguous faces, it makes it much easier to line it up correctly if the faces are contiguous on the UV map too. For textures with 'grain' you may need to rotate parts of the map for it to look right.

Set up Blender

  • Select 'UV Editing' screen layout using the widget in the top left which probably says 'Default'

The screen is divided in two, the 3D view on the right, the UV map on the left.

  • Select 'New' in the widget below the UV map. Choose your texture's size, which must be a power of 2. For 'Generated type' it can be helpful to select 'UV Grid' - this creates a 'fake' texture for you, so you can see how it maps to the mesh in the 3D window. Hit OK.
  • Switch the 3D view's 'Viewport Shading' mode to 'Texture'. Your mesh will turn white, because we haven't mapped anything to it yet...

Basic method

First we're going to unwrap everything and place it off to the side of the texture, so we can see which faces we are yet to unwrap properly.

  • Select your mesh in the 3D view. Tab to edit mode. Ctrl-tab to face select mode. Hit 'a' key until all faces are selected.
  • Hit 'u' key and choose 'Unwrap'. All faces will be mapped to the UV space - if you're on 'Texture' viewport shading mode in the 3D view you'll see your mesh covered in the grid texture.
  • Hit 'g' key in the UV view on the left. Move all the polygons to one side, so they're a decent way away from the grid. This gives us our pool of 'not done yet' faces.

Now we selectively unwrap and pack sections of the model. Choose a group of faces that are logically connected. Either they are going to look identical (perhaps windows, or engine outlet surfaces), or you're going to want them next to each other.

Select all the faces you want to unwrap together in the 3D view - it might help to turn 'Clipped with depth buffer' on. Hit 'u', then choose an unwrapping method - you'll have to experiment to work out which one works best for the geometry you're dealing with.

Move the polygons around in the UV map with 'g', 's' and 'r' until they're roughly where you want them. Switch to vertex mode and fine tune. If you have multiple vertices you want at the same spot, select them, hit 'w' twice to weld them together, then shift-s and select snap to pixel.

Select the faces you've finished with on the UV map ('b' for box select helps), then hit 'h' to make them invisible (alt-h brings them back).

Keep picking groups of logically connected faces, unwrapping and packing, until you're done.

If you need to find out which faces are left to do in the 3D view, box select the pool of 'not done yet' faces we made earlier (make sure you've got 'Keep UV and edit mode mesh selection in sync' selected).

Using seams

I don't understand seams, someone else will have to write this bit :-)

Tips

  • If you've thoroughly stuffed it up and want to start again, switch to 'Default' screen layout and tab into object mode. Select your mesh, and switch the panel on the right to 'Object Data'. Hit the minus sign next to UVMap to delete the map entirely.

Advanced techniques