Recording IK movement into FK bones
Nov 26th, 2010 by admin
I’ve answered this question in forums and via email a number of times (and touch on it in my next-to-be-published book about character animation), so I thought that I would break the process down here for the record.
Sometimes you will run into a situation where you are generating the motion of a limb (like a leg) using an IK controller, but for some reason want to “bake” that motion right into the leg bones themselves, disposing of the IK constraint later on. Because of the nature of IK and constraints, you can’t simply set keys on the leg bones throughout the process and have it stick — even with visual keying enabled. Bones in an IK chain will not accept keys this way, and for a very good reason. Unlike bones under other types of constraints, the bones in an IK chain remain “alive,” and changing their transformation actively affects the outcome of the IK calculations. So, recording keys on them will alter the very result you’re hoping to record.
The solution is to use two sets of bones: one with IK, and one without. The positions of the IK-controlled bones are keyed into the non-IK set. Here’s how, in abbreviated form. If you want the whole write up with flowers and gilding, you can buy my next book
The Setup
- In Edit mode, duplicate the main bones of the IK limb. On a leg, this would be the upper and lower leg bones, not including any of the special helper bones that are often used for legs and feet. Put those duplicate bones on a separate bone layer.
- Make sure that the original leg bones have Deform disabled. Enable Deform for the two new bones.
- Go into pose mode, and rotate the two new bones a little bit from their original positioning so that you can tell them apart from their originals in the 3D view.
- Still in pose mode, add both a Copy Location and Copy Rotation constraint to each of the duplicated bones, targeting their original version in the constraint. This will make them follow the IK leg bones perfectly.
You can now use the rig just like you normally would. By moving the IK controller, you move the IK leg bone chain, which in drives the FK leg bone set throught the Copy Location and Copy Rotation constraints. The FK bones deform your character mesh.
The Trick
Unlike the IK constraint, Visual Keying will work with Copy Location and Copy Rotation constraints. So, make you animation with the IK controller, then set VisualLocRot keys on the duplicated Copy Location/Rotation constrained set of bones. This is the key to the process, recording into the F-Curves of the FK bones the apparent transformation of the IK set of bones.
How often should you set keys to record this motion? You might get away with only doing it on the key poses (contact, passing, etc.), but I would be surprised if you got an acceptable result by doing anything less than every other frame. You might even need to set a key on every frame.
The Cleanup
Once you’ve created your VisualLocRot keys on the duplicate bones, either remove or disable (preferable, you might want to try it again) the Copy Location and Copy Rotation constraints. Then, hide the bone layer that contains the main leg bones that are controlled by IK. Play your animation, and you should find that the FK bones have the correct motion, baked into standard transformation F-Curves!
If you didn’t put keys in on enough frames and the motion isn’t accurate enough, re-enable the constraints and add keys more additional frames.
A Quick and Dirty Shortcut
This won’t work as well — and sometimes maybe even not at all — but you can use a duplicate set of bones and the AutoIK feature in conjunction with automatic keying to get the same effect in a pinch. Create your animation with IK as before, and create a duplicate set of FK bones. Do not, however, give them any constraints. Enable AutoIK, and on, say, every other frame, use AutoIK to pose the duplicate FK bones to match the IK set. Depending on how your original rig is set up, this may or may not work, but it’s worth a try if you only need to do this for a short burst of animation and the results don’t have to be exact.
Good luck!