
Armatures, Poses, Actions, NLA... some artists have mastered Blender's character animation system, but for many people it's still one of the more obscure sets of tools. To most developers, it was obscure too; one of the parts of the Blender code that was extremely hard to maintain. It was apparently left by NaN in a 'working' state, but only for limited situations and it had taken a lot of quick hacks. In the past years of Open Source development, almost no new development happened here... the code was nearly impossible to grasp. So, it was time for a full recode!
I had to lock myself up for two weeks to find out if this system was actually good, what the original design idea was, and what could be done to bring it back under control. By taking the whole thing apart and re-assembling it, I happily discovered the system wasn't bad at all. On the contrary, the original design was excellent and just needed a proper implementation, strictly following design rules.
So I'd like to give all credits to Reevan McKay, the original designer/developer. Thanks dude!
The first design decision which needed to be strictly followed was defining the exact meanings of Armature, Pose and Action. Clear definitions help the developer, as well as the artist, to have an accurate mental model of these three elements.
1) Armature
The Armature stores the Bones in Rest Position of a character. This is data comparable with a Mesh model, which can be altered in Edit Mode, and be re-used by many Objects.
2) Pose
The Pose defines the Object level changes and relations of an Armature. For each Bone in the Armature, an associated "Pose Channel" is created, containing delta translations, rotations or scaling, and allowing Constraints to link to other Pose Channels or other Objects.
One single Armature can be linked by many Objects, each having their own Pose. Since the Pose is directly derived from the Armature, it always has as many PoseChannels as Bones, allowing the storage of transformation data for quick evaluation.
3) Actions
The Action stores the Animation Curves (Ipos) for the PoseChannels and its Constraints. You can define an Action as the "Ipo bag", the collection of all animated changes you want to be applied to Poses.
Whether an "Action Channel" works on a specific Pose Channel is defined by the Action Channel name. Therefore an Action doesn't have to be directly derived from an Armature, it can have fewer channels and can potentially work on different Poses as well.
Typical Actions can be walkcycles, jumps, waving, grasping, and so on... and be combined (stacked/strung together) within the NLA editor. The NLA editor actually creates a 'working Pose', applies Actions to it, and blends that Pose with the actual Pose.
With the character animation system in Blender designed to work in real-time - for the game engine - a lot of the old evaluation and animation code worked in 'real time' as well, recalculating all of an armature's bones and parents for each redraw request. For simple Armatures that worked fine, as well as for low-poly character deformation. For high quality animation with more complex rigs and high-poly characters, it was clear that the system was terribly slow. Attempts to add caching of matrices only made it worse... Bones or Poses and Actions shared data, copying it around, and getting confused as to who actually should do what.
Now, the positions and transformation matrices are stored in three separate steps. The diagram below provides the overview.
Another complex feature in Blender is the implementation of Vertex Groups. The system works fine for defining exact deformation of vertices, but is extremely cumbersome when editing existing groups. Scheduled are tools and options to (partially) automate this task.
The diagram below shows how a Mesh relates to an Armature for deformation.
The recode (july 18, 2005) includes the following improvements and fixes, now successfully implemented:
- Giant speedup for drawing Bones, evaluating Poses, doing IK, and deformations.
- Current system is still backwards compatible, but expect trouble when reading current files with older Blender versions.
- Bones draw solid in 'Solid' view mode
- Bone selecting enabled in EditMode; selection state is saved for PoseMode, and vice-versa
- Added undo in EditMode
- Bone renaming now does vertexgroups, constraints, posechannels, actions, for all users of an Armature in entire file
- Added Bone renaming in NKey panel
- Transform Properties Panel (Nkey) PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone, like object-level selection (last clicked)
- Parenting Bones in EditMode: CTRL+P, ALT+P, with nice options!
- Pose is added in the Outliner now, showing that constraints are in the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now, on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
- Added B-Bones option, allowing Bezier curved Bones, interpolating 'roll' as well.