Applying inverse kinematics to a basic lower-body armature

I have been trying to animate my first human shape, and I followed some tutorials that made it clear I should understand inverse kinematics. Working with them is more natural, but trying to set them up is supernatural, as far as I can tell.

I ran into these two tutorials:
Blender Tutorial: Basics of Character Rigging by Sebastian Lague
and after my first problems, I looked into this to get a second impression of setting up inverse kinematics:
Blender 2.6 Tutorial 30 - IK Rigging Pt. 1 / 3 by BornCG

For an armature of a 3-joined lower body (upper leg, lower leg, foot), I added a IK bone near the foot, inverted on the Z so it could point out the heel. I then added a knee. Whatever I do, I kinda-sorta get something, but it never works quite like in the videos. It’s like I following along exactly, and when they do something, they got something perfect, and when I do it, my house burns down.

Right now, I can’t get the knee IK bone to do anything productive. I see that it is trying real hard to move some bones. It shakes and shudders when I try to control it from the knee, but it doesn’t move anywhere. The foot IK is doing a decent job. If I changed the foot IK’s chain length from 2 to 1, I can get the knee to work in a way I’d expect, but then the foot doesn’t really work quite right.

Another problem is I can’t figure out how to keep both the knee IK and foot IK locked to their positions relative to the areas they affect. For the foot IK, when I move it around, it can move free of the foot area which it controls. I was able to figure out to freeze rotation of the foot so I could rotate the foot from IK, but that’s it. I tried to move the knee away from the mesh in edit mode, which then just causes the knee to be bent forward when I switch to pose mode.

Also, I am still new to this business of rigging, so how do I constrain the knee so it bends in normal, human motions?

The rough process I have followed is something like this:

  • New project
  • Killed the cube
  • Created an armature
  • Created an upper leg bone
  • Extruded from the upper leg bone to make the lower leg bone
  • Extruded from the lower leg bone to make the foot
  • Extruded a foot IK bone off the foot, and removed its parentage so it was free, free!!!
  • Selected the lower leg and applied an IK constraint, targeting the foot IK
  • Set the chain length of the lower leg IK constraint to 2. This had it go up through the upper leg
  • Constrained the foot’s rotation to the foot IK, with Z inverted
  • Extruded a knee IK bone from between the upper and lower legs, and removed its parentage so it was free, free!!!
  • Moved the knee IK bone clear of the armature, forward of the leg.
  • Applied an IK constraint upon the upper leg, targeting the knee IK bone, with chain length of 1.
  • Not profit :frowning:

Here’s the file that has the aftermath of all that:
http://www.pasteall.org/blend/33895

Edit: I suppose I should add that I am not too surprised this doesn’t all work as they do in the videos. I’m having a hard time understanding how one can make an IK constraint fixed by a foot and get one effect, and then use the same process for a knee, which I would consider to kind of be a different effect and works upwards, and the other is at a junction and works upwards and downwards.

Points to note before I look at your rig:

  1. IK chains cannot overlap or they won’t work.
  2. Leg rigs should not be straight or the knee joint will wonder where it choses, Search “Humane Rigging Tutorial” - always have a slight bend in your leg bones so they move in a natural way.
  3. Only use IK rigs when you want to absolutely plant the foot, otherwise the perceived wisdom is to use FK chains - others with more knowledge of making biped models may wish to add more here.
  4. Your IK target can become detached from the chain - this has the effect of stretching it out straight, it will bend back the right way if you have the previously mentioned kink in it.

This file may help you get to grips with biped IK chains - I am not the expert you really need, but this is a start:

skeleton.blend (474 KB)

You will note the original neanderthal posture - this is the beginning of my evolution with skeletons!

Cheers. Clock.

Update:

Before Mr Horseman shouts at me, and rightly so - the refinement of this rig would be this one:

http://www.pasteall.org/blend/33719

which incorporates all the amendments he suggested to me.

As I thought - your leg is dead straight - the knee does not know which way to bend, Also the IK chains overlap - you cant do this! I suggest as a first thing you remove the knee IK target bone and the IK chain targeted to it on the upper leg. Then move the knee joint, the head of bone “Upper Leg” and the tail of bone “Lower Leg”, slightly to the left say one square, then it will work properly. You cannot expect a dead straight leg to know which way to bend, so it will bend all ways and not consistently.

Cheers. Clock.

Don’t forget - Humane Rigging…

Also - Add a floor level “root” bone and parent the foot IK bone to it,add a hip bone and parent the upper leg bone to it and parent the hip bone to the root bone. That way you can move the entire rig without upsetting the leg posture. (Mr Horseman will be proud of me listening to what he said)

Finally - you must be getting p***** off by now, Uncheck Y and Z rotations on your foot’s Copy Rot constraint and check Invert on X rot. Then the foot will tilt the same way (clockwise) as the IK bone.

Apart from that it’s pretty good!

Here’s you modded file: leg_bones.blend (437 KB)

Move “hip” bone to simulate sitting down etc, move and/or rotate “foot IK” to simulate walking, move or rotate “root” bone to reposition entire character. :spin:

Cheers. Clock.

PS. I just checked out the two tutorials you mention - not a straight limb bone chain in sight! Don’t ever make a straight limb armature again. (You should almost be able to see my Gallic finger gestures from where you are!)

I wanted to write back that I’m still digesting your response. I will have to look through that humane rigging video before proceeding. I saw that in the YouTube lineup, but did not know it would mention some of this stuff.

I had tried bending the knee a little and saw as you described that it needed it. I thought though that one should not try to move their default pose. Should I be able to do this just to set up the knee IK and then reset its transformations?

You don’t need the Knee IK - it on confuses the system IMHO. The default for the mesh can be straight limbed, the default or rest position for the bones within that mesh must be slightly bent. You will find that the bones do not necessarily have to accurately follow the mesh in all instances, and you will find that moving hinge points can enhance the movement of your mesh. You should also look at the IK panel in the bone pane for bones in the IK chain, where you can lock or apply stiffnesses and stretching to each bone in the IK chain, see below:


To reiterate; make the bone chain slightly curved when in Edit Mode, i.e. when you create the bones, this is important, as this sets the rest position for the armature and determines the bend profile of the IK chain.

Cheers. Clock.

BTW - Limit Rotation constraints and locking the transform axes has NO EFFECT WHATEVER on an IK train - just so you don’t go trying that!

EDIT:

Instead, set any rotational limits in the same IK panel as shown above (there are none set here, but just check the “Limit” box and type in values. You can, of course, always key frame these values so you have different limits at different times in your animation - I only recently discovered this little gem!

You can alway rotate or move a bone by key framing its TRANSFORM settings as in the picture below:


Rather than rotating or moving it in the view and use key I to insert keyframes. Just LMB click the setting, type in a value, then RMB > “Insert Keyframe(s)”.

Cheers. Clock.

I think the main thing I was doing was combining the two video tutorials by trying to make an knee IK. Rather, I should have just made it a pole target if I was going to use it at all. That does help to make sure the leg points in an expected direction. It never should have had an IK constraint.

What I can’t figure out in Sebastian Lague’s tutorial is how he got the knee bone to control the leg around the knee as if it were tethered with a rope. I can’t say I necessarily need that, but it would have been convenient. I’m still playing with it.

IK rotational limits will achieve what you want I am sure, I have just modded my rig from above with a set of realistic rotational limits and it seems to perform well. As I said before, i am not an expert on figure modelling and animation. Maths I understand, woodwork I understand, but rigging bipeds would not be my chosen subject on Master Mind. I hope my posts have helped you.

Cheers. Clock.

I have just built this rig, using all I learnt here from mr Horseman, and others. I hope it shows correct IK chains and how to use them to manipulate a character, It will become the rig for an endoskeleton for a soft body character I am working on just now:

Here’s a picture or two:



Cheers. Clock.