Sub topic 7
Binding a Mesh with the Armature Modifier
This chapter assumes you can navigate the viewport, switch between Object, Edit and Pose modes, and build a small bone hierarchy. It also assumes you know that a child object follows its parent's transform. Here you learn how a mesh actually deforms when bones move, and which pieces must be in place for that to work.
The three pieces of a bind
A bone does not move a mesh by itself. Parenting a mesh to an armature object only makes the mesh follow the whole object, like any parent and child. To make individual bones bend the surface, three things must line up:
- An Armature modifier on the mesh that points to the armature object.
- Vertex groups on the mesh, one per bone you want to deform it.
- Matching names: a vertex group deforms only when its name is exactly the same as a bone's name.
The modifier is the connection. The vertex groups say which vertices each bone owns and how strongly. The names are the link between the two.
What the modifier does internally
For each vertex, the modifier looks at every vertex group the vertex belongs to. For each group, it finds the bone with the same name. It then takes how far that bone has moved from its rest position to its current pose and applies that change to the vertex, scaled by the weight. If a vertex has several groups, the results are blended by their weights.
This is called skinning. Two consequences follow:
- Only the difference between rest and pose matters. A mesh in the rest pose looks undeformed, whatever the bones' absolute positions are.
- A vertex with no group, or a group with no matching bone, does not move with the bones.
Modifier settings
The Armature modifier has a few options worth knowing:
| Setting | Effect |
|---|---|
| Object | The armature object that supplies the bones. Empty means no deformation. |
| Bind to Vertex Groups | Use vertex group weights. This is on by default and is the normal choice. |
| Bind to Bone Envelopes | Use each bone's envelope volume instead of weights. Rarely used, and hard to control. |
| Preserve Volume | Uses dual quaternion blending, which reduces the pinching at twisted joints but can bulge elsewhere. |
| Vertex Group | Limits the whole modifier to one vertex group, so only that part is affected. |
The default skinning method is linear blend skinning. It is fast and predictable, but at strong twists it collapses the surface like a candy wrapper. Preserve Volume is the usual first fix before you resort to extra twist bones.
Binding in the interface
The quick route is to select the mesh, then shift-select the armature so it is active, and press Ctrl+P. Choose With Empty Groups to get the parent relationship, the modifier and one empty vertex group per deforming bone, or With Automatic Weights to also fill in the weights. The next chapters cover weights in detail. Both options add the Armature modifier for you.
Plain Armature Deform (without groups) adds the modifier and parent but creates no groups, so nothing bends until you make them yourself.
Binding with Python
The same setup in code needs the vertex group, the modifier and, optionally, the parent. This script assumes the objects DemoRig (with a bone named child) and Cube already exist.
import bpy
arm_obj = bpy.data.objects["DemoRig"]
mesh_obj = bpy.data.objects["Cube"]
# A vertex group named after a bone makes that bone deform those vertices
vg = mesh_obj.vertex_groups.new(name="child")
vg.add([0, 1, 2, 3], 1.0, 'REPLACE')
# The Armature modifier connects the mesh to the rig
mod = mesh_obj.modifiers.new(name="Armature", type='ARMATURE')
mod.object = arm_obj
# Optionally parent the mesh to the armature object
mesh_obj.parent = arm_objvg.add takes a list of vertex indices, a weight and a mode. 'REPLACE' sets the weight to exactly 1.0, where 'ADD' would add to an existing weight and 'SUBTRACT' would remove from it.
Common errors
- The mesh does not move at all. Check that the modifier's Object field is set, that the modifier is enabled in the viewport, and that the armature is in Pose Mode or that you actually changed a pose. Edit-Mode changes to the armature alter the rest pose and the mesh will not follow them.
- Only some parts move. Vertex group names do not match bone names. A common cause is renaming a bone after the group exists, or duplicating a bone and getting
Bone.001. Blender renames the bone's group in some tools but not when you edit the name from a script. - The mesh moves twice. The mesh is parented to a bone (Bone parenting) and also has an Armature modifier. Use one method only: modifier for deformation, bone parenting for rigid objects such as a helmet.
- The mesh deforms in the rest pose. The mesh was modeled in a different pose than the rest pose, or the armature's Pose Position is set to Pose with a pose already applied. Set Pose Position to Rest Position to check.
- Mesh is offset from the bones. The armature object has a transform that the mesh does not share. Apply scale on both objects before binding.
- Non-deforming bones affect the mesh. Bones with Deform turned off are ignored by the modifier even when a group matches. See the later chapter on deform and control bones.
Checking the bind
A fast test is to switch to Pose Mode, select one bone, press R to rotate it, and watch which vertices follow. Then press Alt+R to clear the rotation. If the correct region moves and the surface returns exactly to its original shape, the bind is sound.
Exercise
A mesh is parented to an armature and the Armature modifier's Object field is set, but rotating a bone named "Arm.L" moves nothing. The mesh has a vertex group named "arm.L" with weight 1.0 on the arm vertices. What is wrong, and how do you fix it?
Show answer
Vertex group names are case sensitive, so "arm.L" does not match the bone "Arm.L". Rename either the vertex group or the bone so both names are identical, and the bone will start deforming the arm vertices.
Exercise
You want a helmet to stay rigid and follow the head bone while the character's body deforms smoothly. Which binding method should you use for each?
Show answer
Use the Armature modifier with vertex groups for the body, and parent the helmet to the head bone (Bone parenting) so it moves with the bone as one rigid piece without a modifier.