Inverse Kinematics & Animating Game Characters in Blender

Spread the love

The new improvements to Blenders Armature rigging system, introduced with 2.41, greatly improve upon previous iterations making the feature much easier to use and much more useful than before for game character animation.

Because of the way characters for games tend to be rigged using the "Auto IK" system, certain types of Armature set up become problematic because of the restrictions and limitations placed on the rig via the use of the automated rigging system. Being able to now manually set up bone influences and relationships mean Armatures can now have similar behaviour without the caveats of the restrictions associated with Auto IK

Limitations of Automatic IK

Setting up IK constraints in Blender can be a tricky and often breaks an Armature if not set up correctly in relation to what Blender is wanting to see. As a result, Blenders developers implemented an ‘Automatic IK‘ system which, once enabled in "Pose mode" ("Ctrl+Tab"), applies a generalised set of ‘Inverse Kinetic‘ parameters, "IK constraints" to use their proper name, to the Armature based on the hierarchical structure of a skeleton; ‘child’ bones automatically effect a bone directly above itself and on up through the ‘chain’. What this means is that bones will move relative to where the IK constraint is placed in a chain. For example;

bone 1 < bone 2 < bone 3 < bone 4

If the IK constraint is placed at "bone 4" and that then moved, all the bones along the chain ‘above’ it (bones 3, 2 and 1) will be effected by the movement. However

bone 1 < bone 2 < bone 3 < bone 4

However, if the IK constraint is placed on "bone 2", moving that will only move "bone 1" because it’s directly ‘above’ it in the chain. Any bone further down the chain – bones 3 and 4 – will simply rotate around their origin axis, they will have no effect on bones 2 or 1. The movement ‘above’ a bone on a chain with an IK constraint applied is the result of Auto IK active on the entire armature.

The main problem with the auto IK system is that it tends to ‘lock’ the position of individual bones in such as way as to prevent those that aren’t part of a direct "Parent » Child" relationship chain from being moved away for their point of origin (point around which a bone rotates) when grabbed ("G").

The video clip below show this; the head bones move as the should; tilt/rotate back and forth, but the bones associated with the ‘eyes’ don’t – they should ‘free float’, able to move around without restriction – currently all they can do is rotated around their individual origin points.

Video showing locked bones when using auto IK

Using IK chains in ‘manual’ mode

As a result of this issue (it’s not an issue in the literal sense but something that’s simply problematic for certain situations) Blender has a parameter that can be applied to the individual bones of a skeletal Armatures so that the ability to move an entire "Parent » Child" chain can be control as a sub-unit of the overall rig that makes use of the Inverse Kinetics system. In other words, bones can have a special relationship because of the presence of an "IK constraint" that allows IK behaviour up through a controlled number of bones in the chain whilst not impeding the individual movement/rotation of any bones not directly contained in part of the IK.

bone 1 < bone 2 < bone 3 < bone 4

Selecting "bone 2", as above, will effect "bone 1" because it’s above the ‘child’ bone. Selecting "bone 4" in this version of the Armature will allow the bone to move independently of the other bones and the IK chain.

The video below shows how setting up the IK chains manually allows individual bones to be manipulated free from the IK chain; those within the chain to still effect the whole IK object as normal.

Video showing locked bones when using manual IK

Why is are manually set IK constraints useful?

Character animation for games usually has different requirements than those associated with rendered animation sequences. As a result, armatures and skeletons are often set up in a specific way to compensate for the ability to do one thing but not another (usually relative to the complexity of movement required by the character model). It’s during this process that the limitations of the skeleton become apparent; bones being ‘locked’ mean that certain types of movement are impossible to do using the auto IK system. By manually setting the IK Constraints, the bones they influence, the behaviour of a Armature can be tailored to exactly what is required.

Setting up a manual IK chain

As mentioned above, using Auto IK doesn’t always yield the required results. This inevitably means having to assess the structure of an Armature, working out which bones can have a constraint applied so they are then able to act as a ‘root’ for a chain.

Design note: In instances where this is required it’s often useful to add extra ‘control’ bones; from a practical point of view they simply allow easier manipulation of a specific IK chain.

In the example video below two control bones are used; one at the front of the foot which is used to manipulate the whole leg, allowing the foot to bend relative to the pose being made. The other extra bone behind the heal manipulates the leg bones only, allowing the posing of the leg without touching to foot. In other words;

  • foot_control poses the whole leg including the foot.
  • heal_control only pose the leg bones.

The ‘knee’ bone in this setup needs to be ‘free floating’ – it’s the reason for setting up the IK constraints manually; it’s movement is clearly restricted when it’s part of either an Automatic IK chain or is given it’s own IK solver both of which ‘lock’ it’s position.

Setting up an IK chain manually

Adding an IK control

Setting up an IK chain manually is pretty straightforward, the only tricky part is deciding which bones need to have the IK parameters applied to it – one of the other reasons to use control bones.

Before beginning you need to determine how you want an IK bone chain to deform; a leg for instance typically starts at the foot and ends at the hip or upper leg depending on the physical traits of the character being animated; a dog obviously needs a different set up to a humanoid.

  • In "Pose mode" select the bone that needs to act as the IK ‘root’ or ‘control’ point and from the edit buttons ("F9") add a "IK Solver" from the ‘Constraints’ panel (usually on the right hand side of the buttons window by default) – you can name the Constraint where necessary or appropriate but it’s not essential.
  • Still in the Constraints panel, find the "ChainLen: 0" section – it defaults to "0" (zero) – and click the small arrows on the left and right side to increase or decrease the number of bones the IK chain contains ("1" is the IK control bone itself) – as you do this you’ll notice a thin line move up (or down) the chain as each bone is subsequently included.
  • Rinse and repeat until the desired IK chain length is achieved.

Once the IK chain has been set up you should find that grabbing ("G") the control bone (in POSE mode) will position and pose the mesh and skeleton relative to the new IK chain. Because the IK’s haven’t been ‘forced’ as they are with Automatic IK, only the IK Solved bones control the chain which in turn allows ancillary bones to move relatively freely.

Spread the love