Sub topic 10
Fixing deformation with weight painting
This chapter assumes you can already bind a mesh to an armature with automatic weights, switch between Object, Edit and Pose modes, and know that a vertex group named after a bone makes that bone deform those vertices. Here you will learn to find and repair the bad deformation that automatic weights often leave behind.
What weight painting edits
Weight painting is a way to edit vertex group weights by brushing on the mesh. Each weight is a number from 0.0 to 1.0. The Armature modifier reads those numbers and moves each vertex by a blend of the bones that influence it.
- A weight of 1.0 means the vertex follows that bone fully.
- A weight of 0.0 means the bone has no effect on the vertex.
- Values in between mix the motion of several bones.
Blender displays weights as colors. Blue is 0.0, green is about 0.5, and red is 1.0. Unassigned vertices are also shown as blue. The viewport colors cannot tell "weight 0" from "not in the group", but the data can: a vertex that is in a group with weight 0 still counts as a member.
Blender normally expects the weights on one vertex to add up to 1.0 across all deform bones. The Armature modifier normalizes them while deforming, so a vertex with weights of 0.5 and 0.5 behaves the same as one with 1.0 and 1.0. Normalizing the stored values matters later, when you paint.
Entering the right mode
With a mesh bound to an armature, you can paint in either of two ways.
- Select the armature, enter Pose Mode, then Ctrl-click the mesh. Blender switches to Weight Paint Mode, and the mesh shows the weights of the active bone. Clicking another bone in the viewport changes the active group.
- Select the mesh, switch to Weight Paint Mode, and pick the active vertex group in the Object Data properties.
The first method is faster for fixing deformation, because you can select a bone, rotate it to see the problem, and paint on the same screen.
Finding problems before painting
Test the rig before you touch a brush. Pose each joint through its full range and look for these common faults.
| Symptom | Likely cause |
|---|---|
| A knee or elbow collapses into a sharp crease | Weights change too abruptly across the joint |
| Part of a limb stays behind when the bone moves | Those vertices have no weight, or belong to the wrong group |
| A hand pulls part of the torso | A neighboring bone has weight over vertices it should not reach |
| Fingers or thighs pull on each other | Overlapping influence between nearby bones |
| The mesh stretches to the origin | A vertex is unweighted, and the modifier cannot move it |
The brush settings that matter
Open the Tool tab in the sidebar to see the brush options.
- Weight is the value the brush paints. Set it to 1.0 to add influence, or 0.0 to remove it.
- Radius and Strength control the size and the intensity of each stroke. Low strength builds weight gradually.
- Blend modes change what the brush does. Mix replaces the weight, Add increases it, Subtract decreases it, and Smooth averages neighboring weights.
The most useful tool for repairing joints is the Blur (Smooth) brush. Automatic weights usually leave the broad regions right and the transitions rough, so smoothing those transitions is often all you need.
Auto Normalize and Lock Other Groups
Two options in the Weight Paint header decide how a stroke affects the other bones.
Auto Normalize keeps the total weight on each vertex at 1.0 as you paint. When you add weight to the active group, Blender removes the same amount from the other groups. This is usually what you want, because it stops you from leaving a vertex with too little influence overall.
You can lock groups so they never change. The Vertex Group panel has a lock button next to each group, and the Weights menu includes Lock All and Lock Invert. Locking the groups that are already correct lets you paint freely on the one that is wrong.
Cleaning up with the Weights menu
The Weights menu in Weight Paint Mode handles bulk fixes, which are faster than painting.
- Normalize All rescales every vertex so the weights sum to 1.0.
- Clean removes weights below a limit, such as 0.01, which removes faint influences that are hard to see.
- Limit Total caps the number of groups per vertex. Game engines often allow only four, so use this before export.
- Smooth runs a smoothing pass across the whole mesh, optionally on selected groups.
- Mirror copies weights from one side of a symmetrical mesh to the other.
For a character, paint one side, then use Mirror. This only works when the groups are named with a matching suffix, such as arm.L and arm.R, and the mesh is symmetrical. Enable the Mirror option for X-axis painting when you want both sides to change as you paint.
A repair workflow
A reliable order of work helps you avoid undoing your own changes.
- Pose the joint in an extreme position, such as an elbow bent to 120 degrees.
- Pick the bone whose group looks wrong.
- Lock groups that you do not want to change.
- Use Subtract at 0.0 to remove weight where a bone has leaked onto the wrong area.
- Use Add or Mix to give the correct bone its influence.
- Use Blur to soften the border between bones.
- Run Clean, then Normalize All.
- Test the other poses, because a fix in one pose can break another.
Painting weights with Python
You can also change weights from a script, which helps with batch fixes. The mesh must already have the vertex groups from the earlier binding step.
import bpy
mesh_obj = bpy.data.objects["Cube"]
group = mesh_obj.vertex_groups["child"]
# Lower the weight of vertices 0 and 1, creating a soft falloff
group.add([0, 1], 0.5, 'REPLACE')
# Remove a vertex from the group completely
group.remove([2])
# Read the weight of one vertex in a group
for v in mesh_obj.data.vertices:
for g in v.groups:
print(v.index, mesh_obj.vertex_groups[g.group].name, g.weight)REPLACE sets the weight outright. ADD increases it and SUBTRACT decreases it. Setting a weight directly does not renormalize the other groups, so call bpy.ops.object.vertex_group_normalize_all() with the mesh in Weight Paint or Object Mode when you need normalized values.
Common mistakes
- Painting in the wrong group. The active bone decides which group changes. Look at the group name before every stroke.
- Painting without Auto Normalize and then finding that vertices move too little or too much.
- Painting only in the rest pose. Everything looks fine until the joint bends.
- Leaving tiny stray weights. Faint influences cause odd pulling that you cannot see in the viewport. Run Clean.
- Forgetting that the Armature modifier order matters. If another modifier sits above it, the weights may act on a changed mesh.
Exercise
A character's elbow collapses when the forearm bends, and a small patch of the upper arm follows the forearm. Name the order of the three most useful steps to fix it.
Show answer
First lock the groups that are already correct, or turn on Auto Normalize. Next use Subtract at weight 0.0 on the forearm group to remove its influence from the upper arm patch. Finally use the Blur brush across the elbow to smooth the transition between the two groups, then run Clean and Normalize All and test other poses.
Exercise
You set a vertex's weight in a script with group.add([5], 1.0, 'REPLACE'), and the vertex also belongs to another group with weight 1.0. Why can the weights still look correct in the viewport, and what should you run if you need real normalized values?
Show answer
The Armature modifier normalizes the weights while it deforms, so the two 1.0 values act as a 50/50 blend. The stored values are still not normalized. Run Normalize All, or bpy.ops.object.vertexgroupnormalize_all(), to store weights that add up to 1.0.