Sub topic 5
Unwrapping the Mesh and Choosing a Method
This chapter assumes you can switch between Object Mode and Edit Mode, select faces and edges, and open the UV Editor. It also assumes you know what a seam is from the previous chapter. You will learn what the unwrap operation does, what each unwrap method is good at, and which options change the result. You will also see how to run the same operation from Python.
What unwrapping does
Unwrapping is the step that produces UV coordinates. Blender takes the selected faces of a mesh, treats the seams as places where the surface may be cut, and flattens each connected piece into a 2D shape called an island. Every face corner (loop) of the mesh receives a U,V pair in the active UV map. That pair says which point of the image lands on that corner.
A 3D surface can't always be flattened without error. A sphere can't be laid flat without stretching or tearing, which is why map projections of the Earth distort something. Each unwrap method is a different compromise about which error to accept. Seams decide how much error the method has to hide.
Three facts about the operator explain most of the surprises you will see:
- It only processes the selected faces. Unselected faces keep their old UV coordinates.
- It creates a UV map named "UVMap" if the mesh has none. You do not need the UV Editor open to run it.
- It treats seams as hard cuts and pinned UV vertices as fixed points. Everything else is free to move.
Running an unwrap
- Enter Edit Mode with Tab.
- Select the faces you want to unwrap. Press A to select everything.
- Press U in the 3D Viewport and choose a method, or use the UV menu in the viewport header.
- Look at the UV Editor to see the islands.
In the UV Editor, islands are only displayed for selected faces unless UV Sync Selection is on. If the editor looks empty after you unwrap, check that the faces are still selected in the 3D Viewport.
After you run the operator, open the Adjust Last Operation panel at the lower left of the viewport. It lists the options for that run, and you can change them and see the result immediately. Do this before you do any manual work on the islands, because changing an option re-runs the unwrap and discards your manual edits.
The two unwrap methods
The Unwrap entry in the U menu is the seam-based method. It offers two algorithms through its Method option.
| Method | What it optimizes | Typical strengths | Typical weaknesses |
|---|---|---|---|
| Angle Based | Keeps the angles of each face close to the 3D angles | Good default for organic and curved shapes | Slower on very dense meshes |
| Conformal | Preserves local shape (least squares conformal mapping) | Fast, and good for simple or nearly flat pieces | Face sizes can vary more across an island |
Angle Based is the default, and it is the right first choice when you have no reason to pick otherwise. If the result shows heavy stretching, switch to Conformal and compare. Conformal keeps small shapes looking right but lets their relative sizes drift. That drift is area distortion, and you see it as the same grid square being large in one place and small in another.
Neither method fixes bad seams. If a curved region has no seam through it, both methods will distort it. The comparison between methods only matters once the seams are reasonable.
Options in the Adjust Last Operation panel
| Option | Effect |
|---|---|
| Fill Holes | Treats holes in the mesh as if they were filled while computing the unwrap. This helps avoid overlaps and keeps symmetry. It is on by default. |
| Correct Aspect | Takes the aspect ratio of the displayed image into account, so a non-square image does not stretch the islands. |
| Use Subdivision Surface | Computes the unwrap on vertex positions after a Subdivision Surface modifier is applied. Use it when the final look comes from subdivision. |
| Margin Method | Chooses how the gap between islands is measured: Scaled, Add, or Fraction. |
| Margin | Sets the gap between islands. A small value such as 0.001 packs tightly. A larger value leaves room for filtering and mipmaps. |
Correct Aspect needs an image to read the ratio from. It uses the image shown in the UV Editor, so open your image there first if you work with a non-square texture.
The margin is applied when the unwrap packs its output into the 0 to 1 space. You can repack later with different values, which the packing chapter covers.
Projection methods
The same U menu holds methods that ignore seams and project the mesh onto a simple shape instead. They are fast and predictable, but they distort anything that does not match the shape.
- Smart UV Project creates its own seams by splitting the mesh wherever the angle between neighboring faces exceeds an Angle Limit (the default is 66 degrees). It produces many small islands. It suits hard-surface props, quick tests, and objects where texture seams are unimportant.
- Cube Projection projects from six directions onto a cube. It works well for box-like objects.
- Cylinder Projection wraps the mesh around a cylinder. It suits pipes, bottles, and limbs, but the caps of the shape stretch.
- Sphere Projection projects from the object center outward. It pinches at the poles.
- Project from View flattens the mesh as seen from the current viewport. It is useful for a flat decal-like surface and gives severe stretching on faces seen at a steep angle.
- Follow Active Quads continues the layout from the active quad across a strip or grid of quads, and gives uniform squares. It suits roads, planks, and straight bands.
- Reset gives each face a full 0 to 1 square.
Smart UV Project is tempting because it needs no seam work, but its many islands create many visible texture edges and waste space between islands. For a model you plan to paint or texture by hand, seam-based Unwrap gives islands you can read and edit.
Choosing a method
The decision depends mostly on the shape of the surface and on how much you care about where the texture edges fall.
Use this as a starting point and verify with a test grid. A method that looks right in the UV Editor can still stretch the texture on the model, and only the grid on the surface shows it.
Common errors
- Nothing seems to happen. The faces were not selected, so the operator had nothing to process. Select the faces and run it again.
- Islands overlap or fold over themselves. Some faces are flipped in UV space, often because a seam is missing or the surface folds in on itself. Add a seam through the problem area, or check that Fill Holes is on.
- The whole mesh becomes one crumpled shape. You unwrapped a closed, curved mesh without seams. The algorithm can't open it, so it produces a distorted layout. Mark seams first.
- Manual edits vanish. You changed an option in the Adjust Last Operation panel after moving islands. The operator re-ran from scratch. Make option changes first.
- Part of the mesh keeps an old layout. Only the selected faces were unwrapped. Select all faces if you want a fresh layout for the whole mesh.
- Square image, stretched result on a non-square image. Correct Aspect was off, or no image was displayed in the UV Editor.
Unwrapping with Python
The operator you run from the U menu is bpy.ops.uv.unwrap. It needs Edit Mode and a selection, like the menu entry. The script below marks the selected edges as seams, selects all faces, and unwraps with the method you choose.
import bpy
import bmesh
obj = bpy.context.active_object
assert obj is not None and obj.type == 'MESH', "Select a mesh object first"
# Seams are stored on edges, so edit them through bmesh in Edit Mode.
bpy.ops.object.mode_set(mode='EDIT')
bm = bmesh.from_edit_mesh(obj.data)
for edge in bm.edges:
if edge.select:
edge.seam = True
bmesh.update_edit_mesh(obj.data)
# The unwrap only affects selected faces, so select them all.
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, margin=0.001)
bpy.ops.object.mode_set(mode='OBJECT')
print("UV maps:", [uv.name for uv in obj.data.uv_layers])Select the edges you want as seams in Edit Mode before you run it. To compare methods, change method='ANGLE_BASED' to method='CONFORMAL' and run the script again. Marking an edge as a seam twice has no extra effect, so rerunning is safe.
The script prints the UV map names. A new mesh will list "UVMap" once the unwrap has created it, which confirms the operator wrote data. The earlier chapter's loop over uv_layers.active.data lets you inspect the coordinates themselves.
Summary
Unwrapping converts seams and a method choice into UV coordinates for the selected faces. Angle Based is the default, and Conformal is the alternative when you see stretching. Projection methods trade seam work for distortion, and Smart UV Project trades it for many small islands. The Adjust Last Operation panel is where you change options such as Fill Holes, Correct Aspect, and Margin. Change those first and edit islands by hand afterward.
Exercise
You unwrapped a character's head with Angle Based, and then you nudged several islands by hand. After that, you changed Margin in the Adjust Last Operation panel. Your edits disappeared. Why did this happen, and what order of steps avoids it?
Show answer
Changing an option in the Adjust Last Operation panel re-runs the unwrap operator from the original state of the mesh, so it recomputes the layout and discards manual island edits. To avoid this, set all unwrap options (method, Fill Holes, Correct Aspect, Margin) first, and do manual moving, scaling, and packing only after the options are final.
Exercise
You select all faces of a default cube that has no seams and run Unwrap. The UV Editor shows a distorted, unusable layout. What is missing, and what is a minimal fix? Name one alternative method that would give a usable result without seams.
Show answer
A closed mesh with no seams can't be opened into flat pieces, so the algorithm has nothing to cut along. Mark seams along enough edges for the cube to unfold (for example, the edges of a cross-shaped net), then unwrap again. Without seams, Cube Projection or Smart UV Project gives a usable layout on a cube.