Sub topic 4
Unwrapping the Marked Mesh
This chapter assumes you can enter Edit Mode, select faces, and mark seams as shown in the previous chapter. Here you run the Unwrap operator, learn what it does with your seams, and handle the cases where it produces a poor or empty result.
What Unwrap does
Unwrap takes every selected face and computes a 2D position (a UV coordinate) for each corner. It treats each seam as a cut. Faces connected to each other without crossing a seam end up in the same island, and each island is flattened separately.
The operator runs in Edit Mode. You can call it in two ways:
- Press
Uin the 3D Viewport and choose Unwrap. - Use UV > Unwrap from the 3D Viewport header menu in Edit Mode, or from the UV Editor header.
Unwrap works only on faces that are selected and visible. Hidden faces and unselected faces keep whatever UVs they already have. This lets you re-unwrap one troublesome part of a model without disturbing the rest.
Preparing the selection
Before you press U, check three things.
- Select the faces you want unwrapped. Press
Ato select everything. In Edit Mode with nothing selected, the operator has nothing to work on, so the UV Editor stays unchanged. - Reveal hidden geometry. Press
Alt+Hif you hid parts earlier. Faces that stay hidden are skipped without any warning. - Check your seams are the ones you intend. Seams show as red edges. A seam on a boundary edge does nothing, and a missing seam produces a connected island that you may not want.
A selected face that touches an unselected face along a non-seam edge is still unwrapped on its own. The two parts will not be connected in UV space, so a visible break can appear in your texture along that edge.
The operator panel
After you run Unwrap, an Unwrap panel opens at the lower left of the 3D Viewport. Change the values there and the operator reruns on the same selection. Open it before you do anything else, because it disappears once you run another operator.
| Option | Default | Effect |
|---|---|---|
| Method | Angle Based | The flattening algorithm. The next chapter compares Angle Based and Conformal. |
| Fill Holes | On | Treats holes inside an island as if they were filled while solving, which reduces distortion around them. |
| Correct Aspect | On | Adjusts UVs for the shape of the image shown in the UV Editor, so a non-square image does not stretch the result. |
| Use Subdivision Surface | Off | Computes UVs for the surface as it will look after the Subdivision Surface modifier, instead of the base cage. |
| Margin | 0.001 | The gap left between islands when the operator lays them out in the 0 to 1 square. |
The margin is measured in UV units, so 0.02 means two percent of the texture's width. The operator panel may also show a Margin Method option, depending on your Blender version. Leave it at its default unless you have a reason to change it. Packing and margins get a full treatment in a later chapter.
Running Unwrap from a script
You will often want to rerun the same unwrap many times while you adjust seams. The operator call below does what the panel does. It enters Edit Mode, selects every face, unwraps along the existing seams with the Angle Based method, packs the islands with a margin, and returns to Object Mode.
import bpy
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.unwrap(method='ANGLE_BASED', margin=0.02)
bpy.ops.uv.pack_islands(margin=0.02)
bpy.ops.object.mode_set(mode='OBJECT')Run it with a mesh object active. It fails with a context error if the active object is not a mesh. It also replaces the UV coordinates of every face, including any you moved by hand, so do not run it on a mesh whose UVs you want to keep.
Worked example: a cylinder
A cylinder shows how seams control the result. Add one with Add > Mesh > Cylinder and enter Edit Mode.
- Select the edge loop where the side wall meets the top cap, then choose Edge > Mark Seam. Repeat for the bottom cap.
- Select one vertical edge on the side wall and mark it as a seam as well.
- Press
Ato select all faces, then pressUand choose Unwrap.
The UV Editor now shows three islands. The side wall is a rectangle, because the vertical seam opened the tube like a rolled label. The two caps are circles. Without the vertical seam, the wall would be a closed tube that cannot lie flat, and the solver would squeeze it into a shape with heavy stretching.
This is the general rule. Every island must be a surface that can be opened out flat without overlapping itself. Cuts do that.
Edge cases and common failures
No seams on a closed mesh. A sphere or any closed mesh with no seams has no place where the surface can open. Unwrap still returns something, but the layout is usually collapsed, crumpled, or badly stretched. Mark at least one seam before judging the algorithm.
A seam loop that never closes. A seam that ends in the middle of a surface does not cut it. Seams only cut where they form a boundary around, or across, a region. A dead-end seam inside a face region has no effect on that region's island.
Overlapping islands. Unwrap places islands so they do not overlap each other. If islands do overlap, they may have come from an earlier operation, such as faces you left unselected whose old UVs occupy the same area. Select all faces and unwrap again.
Manual edits disappear. Unwrapping a selection recalculates the UVs for those faces. Anything you moved by hand is lost unless the vertices are pinned. Pinning is covered in a later chapter.
Different scale per island. Unwrap tries to keep island sizes in proportion to the 3D area they cover. The result is not guaranteed to be uniform, so check it before texturing. The chapter on texel density shows how to correct it.
Subdivision Surface mismatch. If the model uses a Subdivision Surface modifier, enable Use Subdivision Surface in the panel. Otherwise the UVs fit the unsubdivided cage, and textures can shift slightly on the smoothed surface.
Checking the result quickly
After the operator runs, open the UV Editor and look for three things before you go further:
- Each island has a shape that resembles the 3D part it came from.
- No island is a tiny dot or a long thin sliver, which would mean the algorithm had too little freedom.
- Islands sit inside the 0 to 1 square and do not overlap each other.
Spotting subtle stretching needs a checker texture and the stretch display, which are the subject of a later chapter. At this stage you are only confirming that the operator produced a sensible layout.
Exercise
You mark three seams on a closed mesh, but the UV Editor shows nothing after you press U in Edit Mode. List two causes related to selection and how you would fix them.
Show answer
Either no faces are selected, or the faces are hidden. Unwrap only processes faces that are both selected and visible. Press A to select all faces and Alt+H to reveal hidden geometry, then run Unwrap again. Also check that the UV Editor's sync selection setting is not hiding the faces you expect to see.
Exercise
A tube-shaped mesh has seams on both end rings but no seam along its length. What does Unwrap produce for the side wall, and what single change fixes it?
Show answer
The side wall is still a closed tube, which cannot be flattened without stretching, so the layout is badly distorted or collapsed. Mark one seam along the length of the tube so the wall can open into a rectangle, then unwrap again.