- When we rig cartoon characters, we often want to add stretch to the limbs, and that allows us to get a more cartoony animation. Now rigging for stretch requires a little bit of math. Now Maya doesn't normally build that into rigs, so we have to build it in ourselves. So before we actually rig up a stretchy joint, let's go ahead and understand some of the basics of how this works. Now, typically in Maya, we're going to start off with a simple joint chain. Now this is a bare joint chain, but typically, we will have one with an IK handle.
So let's take a look at that. So here's the same joint chain, but we've got an IK handle and this IK handle is attached to a controller. Now this is a typical setup that you would see, maybe, in a leg rig and we can actually take this controller here and we can manipulate it to manipulate the leg. Now, if we want to make a rig stretch, we need to have a couple of bits of information. Now the first thing we need to know is the length of the joints so I need to know the length of each joint because when I move my IK handle to the limit, this length here will be the sum of both of those joints.
So this, when it's completely extended, is A1 + A2, in other words, the sum of the joints. Now, the problem comes in when we extend this IK handle beyond this limit. So if I go beyond this, the joint won't normally stretch. Now in a typical Maya environment, these joints will remain the same length, but we want to stretch them. So in order to do that, we need to know how far we want to stretch them, and so we're going to measure this, we're going to measure the length from the top of the joint to the IK handle and, for the sake of argument, let's just call that B.
Now if we have all of these numbers, then we can actually start to create a formula that gives us the amount that these joints need to stretch. So let's take a look at that. So, I've got the stretch as equal to the length of the IK handle divided by the length of the joints. Now when this value B is greater than the sum of the joints, we get a number greater than one, and if we apply that to the scale of the joints, we can scale them up so that they meet the target.
So by multiplying these joints by this number, we get this result. Now there's another case that we don't account for in this equation, and that's if B is smaller than A. So if we, say, move that IK handle so that the joint bends, we don't want those joints to shrink down because in this point, B is smaller than the sum of the joints and so this number will be smaller than one. If we multiply that by the joints, these joints will shrink down too much.
We want to keep them at their default length or greater. So in order to do that, we need to add in one more thing, and that's called a conditional. So if B is greater than one, then stretch. Otherwise, just leave it as is. So now that we understand the basic math of this, let's go ahead and start rigging.
- Creating stretchy joints with expressions and the Node Editor
- Adding spine stretch
- Setting up IK/FK switching
- Manipulating faces with blend shapes
- Skinning the character
- Creating controls for facial animation
- Rigging the eyes
- Testing the rig with a simple animation