Thursday, November 1, 2012

Battle Royal, three chain vs. single chain.

I love The Big Bang Theory, and to a lesser extent I seem to enjoy most things from Chuck Lorre. Dharma and Greg was good but it fell short and for some reason and I can't find anything but the first season on DVD. I don't watch Two and a Half Men that often but it's that good kind of stupid funny, like Aqua Teen what ever the hell they named them selves this season. Anyway onto the other stuff.


The three joint chain setup for limbs, the FK chain, the IK chain and the chain bound to the mesh. This seems to be the standard setup for most of the rigs I have seen. This setup is the one I was taught in school. Being the one who always has to reinvent things I looked at what made this setup the standard. I will start with the obvious stuff.

This is the three chain setup.
FK and IK chains parent constraint the bind chain and you use an attribute to drive all the weights on the parent constraints. Simple right?

I asked myself if this was the best way to do it and at least in my opinion you do not need all 3 of these chains.

I use one chain for my FK, IK and bound joints. This is the setup I use in Maya simply because Maya has everything built into the IK handle and joints. Mayas joints remember their FK and IK rotations and these can be accessed for scripts and what not. The IK blend attribute on a limbs IK handle acts just like the three chain setup in that it will move the chain from its FK position to its IK position.

This is my setup.
What you are seeing is literally a 3 joint setup all under one joint chain and Maya's IK handle. You have the FK chain, the IK chain and the bound chain. Now since rigs are meant to be as fast as they can this setup is faster then the three chain setup. Reason one is that when you setup an IK FK switch using the three chain setup you are creating 2 of the exact same systems on top of each other so now Maya is not only calculating the three joint chains you created but also the three joint chains it created doubling the amount of joints to calculate. Reason two is that now you only have one set of constraints to worry about as you only constrain the FK controls to the joints. With the three chain setup you are using two constraints per joint, FK joint to bind joint and IK joint to bind joint. Then on top of that there are constraints from the FK controls to the FK joint chain that add to the number of constraints. Maya also has less connections to update since you aren't driving as many attributes when you go from FK to IK.

I will admit that the single chain setup is harder to work with if you need to get under the hood. The three joint setup is much more visible and you can easily get to each component if there is a need to edit the rig. Also this lets you allow someone to paint weights and another to rig at the same time and simply import the bind skeleton with weighted skin and constrain the rig skeleton to the bind skeleton. With the single chain you would need to copy the weights from one setup to another.

This FK IK setup also works for spline setups too.

As for the scripting to moving FK to IK and IK to FK
Code monkey stuff starts here. 

#three chain

float $ikRot[]=`getAttr IKjoint.rotation`;

#one chain

float $ikRot[]=`getAttr joint.ikRotate`;

So There ya go I find the single chain setup simpler to setup and cleaner for Maya to evaluate.