16th Sep2011

Rigging the Basic Spine

by bbentley81

In this post we are going to set up a basic spine for a character. In later posts we will make it have have the ability to stretch to match the controller’s position, and squash to maintain volume.

 A biped spine is the two hard masses of the rib cage and the pelvic bone held together by spline wrapped in squishy stuff. So this is how we will set up the spine in Maya. We will have a pelvis joint, a chest joint, and several joints that make up the spine that are driven by a spline ik system.

 Lets Start:

SETTING UP THE JOINTS

The first thing to do is to import your bind skeleton into a new scene. Delete the arms, legs, neck, and head, leaving only the pelvis, chest, and spine joints.

Figure 1

I like to make a duplicate of this heir achy and put it in a display layer and set it visualization mode to template. The helps to make sure that while you are doing your setup your joints do not drift away from the rest.

Figure 2

We need to separate the top of the spine from the chest joint. There is a Maya tool to do this called “disconnect joint”. This command will make break the joint chain and make a new joint for the missing end of the spine. Make sure you zero this new joints rotate and jointOrient Values after using the command.

Figure 3

We will also unparent the spine from the pelvis joint. Rename all your joints to something that will denote them as joints in the animation rig, and not to be directly bound to the skin later on. I like to use the postfix “CTR” for control. So , for example, you would name your spine joints, spineACTR, spineBCTR, ect, ect. It is always a good idea to name your end joint something unique. I use the obvious END so spineCtrEND.

Next we need to make root locators for our newly broken hierarchy. The root locator is a transform that acts as a buffer for translate, rotate, scale information, so that the joint itself can have all it’s values at zero when at rest.

For the first joint in the chest, spine and pelvis repeat the following

  1. create a locator and give it a name that denotes it as a root locator. I like to use CHN or RUT, ie spineRUT or spineCHN

  2. parent the root locator to the root joint in the chain and zero out all it’s transformations. This should snap the locator to the exact spot of the joint chain.

  3. Unparent the locator and repartent the joint under the locator

Once you are done your scene and outliner should look something like this:

Figure 4

 CREATING THE CONTROL OBJECTS

Now we are going to go about creating controls for the whole upper body, the chest and the hips. We want the chest and the hips to be siblings under the upperBody controller so that they can move independent of one another.

You can use any shape, but for the sake of simplicity I am just going to use nurbs circles. Make three, and name them in such a way to denote that they are controller objects. I tend to use the postfix “CON” ie hipsCON, chestCON, and upperBodyCON. We are also going to make root locator for our controllers. They serve the same buffering function as the root locators for the joints.

Create three locators and name them in such a way that denotes them as root locators for your controller objects. I like to use NUL or OFS for “offset” ie hipsNUL, chestNUL ect ect.

Parent your controller objects under their respective locators. Now point snap (hold down the “v” key) the chest locator were the root of the chest joint is. We want the hips controller object and the upperbody controller object to sit in between the base of the spine and pelvis bone.

To do this select the spine and pelvis joints and then the upperbody locator and pointConstrain with maintain offset turned off. This will snap the locator (and it’s children) to a point directly between the two selections. Delete the pointConstraint you just made and point snap the remaining hips locator to the upperbody.

Also select all your controller objects and run a edit > delete by type > history to get rid of any construction nodes that make up the nurbs curve.

When it is finished it should look something like this:

 CREATING THE SPLINE IK

 We are now going to create the spline ik to connect the hips to the chest. Hide your controller objects, chest joints and pelvis joints so that they are not distracting.

We need a nurbs curve for the ik solver to use to rotate the spine. Go to create > EP curve. Now, by holding down v, snap the first point of the curve to the base of the spine joints and the second to the end of the spine. Go into the curves attribute editor (make sure your are on the shape and not the transform) and turn on the display cvs under the component display tab.

Figure 6

As always rename the curve to something that denotes it as a curve. I use the postfix CRV. In this case I have called the curve spineIkCRV.

We are now ready to create out ik. Go to skeleton > Ik Spline Tool and open the options box. Uncheck all the option boxes. Your mouse cursor should be a crosshair now denoting that Maya is now in a building mode. Holding the crtl button on the keyboard, in the outliner, select the base of the spine, the tip of the spine, and then the curve.

Figure 7

You will now have an ikHandle1 in world space, and an effector1 node under the last joint in the spine. Rename these two objects to something useful. I used spineIkHND and spineikEFF.

 Now if you move the cvs of the curve you can see that the joints snake along with it. Pretty cool, but this is not effective for animation. We are going to bind the curve to joints at the top and bottom of the spine os that we can use those to indirectly control the spine.

 Create two locators. These will be the root locators for the joints that will bind the curve. Name them something like spineikCrvANUL, and spineikCrvBNUL. Now create two joints named spineikCrvAJNT, and spineikCrvBJNT. Parent these under their respective locators.

 Point and oritnet constrain, without offset, spineikCrvANUL to the first joint in the spine hierarchy, and spineikCrvBNUL to the last. Now Delete the constrains as they were only to position these joints.

 You should now have something that looks like this:

Figure 8

Now that our joints are in place, we can bind the curve to them. Go to skin > bind skin > smooth bind option box.

Figure 9

Set “Bind to” to “Selected Joints”, “Bind method” to “closest distance”, and “skinning method” to “classic linear”. Now select your two new joints and press the “bind skin” button. Now when you move one of the new joints the spine joints snake along. The bottom will act strange right now b/c we turned off “root on curve” when we made the ik, but we will fix that when we parent everything together.

 We need to adjust the weight of the cvs so that the top two cvs are only affected by the top joint and vise versa with the bottom.

 Hide your joints by toggling their view off in the viewport through show > joints. Select all the cvs of the curve and go to windows > general editors >component editor. Under the smooth skins tab you will see entries for the four cvs and the two joints. Cv[0], and [1] should be 1.00 for jointA and 0.00 for B. Cv[2], and [3] should be 0.00 for jointA and 1.00 for B. once you are done with this turn the joints visibility back on.

Figure 10

CONTROLLING THE SPINE TWIST

Notice that if we rotate either joint on it’s aiming axis we get no twisting action in the spine. This is because curves have no rotation data in Maya. We will use the splineIk’s advanced twist feature to control the twisting of the spine. The advanced twist is basically another aim calculation built into the solver node, and as such has many of the same options. For more information on aim constraints see my post on them.

So we can better see what is happening with our spine, turn on the local rotation axis for all of the spine joints except for the start and end. Also turn on the local rotation axis for the bind joints we just made

Select the splineIkhandle and open the attribute editor. Under Iksolver attributes > advanced twist controls toggle on “enable enable twist controls”. Now yo will see you local rotation axis flip and spin. Not to worry this is only because we have not set the proper parameters yet.

Set the “world up type” to “Object rotation Up start/end”. Now simply type in the name of the joint at the base of your some in “World Up Object” Field and the name of the joint at the top of the spine in “World Up Object 2”. You should now see your local rotation axis are back to normal.

Here are The setting mentioned above and what they pertain to in the rig:

Figure 11

 so now when we twist the two end joints we get nice distributed twisting long the length of the spine joint chain. It is also a good idea to increase the radius of the two bind joints so that they are easier to select.

 PUTTING IT ALL TOGETHER

Wow that was a lot to take in. Luckily the hard part is over, all we have left to do is parent the systems together. Unhide the other elements of the spine that we hid while setting up the Ik.

We want to parent everything that moves with the pelvic bone to the hips controller object, so that would be the pelvis locator, the bind joint at the base of a the spine, and the spine itself.

We want to parent everything that moves with the chest under the chest controller object, so that would be the chest joint locator, and the bind joint at the top of the spine. Finally we want to move the entire system with the upperBody so we parent both the locator above the chest controller object and the locator above the hip controller object to the hips controller object.

Here is what your outliner will look like when all that is done:

 

Figure 12

We still have a few nodes that are not tucked away yet. The curve that drives the spine ik and the ik handle should never be touched or moved by an animator. So, we will put them under a “noTouch” null. Select them both the curve and the splineIkhandle and press crtrl+g. This will put them under a transform that sits at the origin. Rename this group something like spineNoTouch.

 There is still one small problem with our setup. If we take the hips and rotate them in z we can see that our spine top pulls away from our chest base.

Figure 13

This is an easy fix. Zero the rotations in the hips. Select the spine tip and the root locator of the chest joint and point constrain. Now when we rotate the hip the chest sticks to the top of the spine while still following the orientation of the chest controller object.

 Now all we do is group the noTouch and the upperBody locator into another group called spineRigNUL. If everything has gone to plan if you toggle the visibility of this new group on an off you should see no difference in the spine setup and the joint we templated at the beginning of the tutorial.

 Having all the controller object the same color is boring and visually confusing. Lets fix that. Select the hips and chest controller objects, and press the down arrow key. What you have just done is select the shape node of the curve. Go to display > wireframe color and pick a color from the menu that pops up.

Figure 14

Now Just delete the template joints and the display layer and now you have yourself a working spine right…go you!!!

Figure 15

CHEERS

B.

16th Aug2011

Building 3 Joint Chains With Aim Constraints

by bbentley81

In the previous post I talked about the proper setup for a three joint chain. In this lesson I will show a more precise way to create this setup.

As mentioned before the previous setup is clean but what happens when you HAVE to have your pivots on exact locations, like with mechanical rigs. To position a joint chain using the previous technique would be rather painful. Lets look a a different way to do this, using an aim constraint to find the normal vector to the the plane formed by the three positions in space we are trying to mach.

The sounded like a lot. We’ll take this one thing at a time. Any three points will make a plane. Think of a piece of paper. If you can place three dots on that paper and move it around in space. The dots are our joints and the paper is the plane that they make. Now take three push pins and poke them though each dot. These are your normals to that paper plane.

If you look at the paper on edge you will see the all the shafts of the push pins are parallel! And because I had neither paper or pushpins as I am writing this I am using the magic of 3d to illustrate this idea to you.

Figure 1

Figure 1

So here is how we go about finding the “pushpins”, which is the z axis in this illustration. We use aim constraints. To see more about aim constraints check out my post on them.

So lets say you have three locations in space that your joints have to hit exactly. (posA, posB, posC)

Figure 2

Figure 2

STEP 1:

use the joint tool and go into an orthographic view and draw three joints in a straight line. It doesn’t matter now long the chain is, just that the joints are there.

Figure 3

Figure 3

STEP 2:

point constrain the the first joint to the posA object

STEP 3: (this is were the magic happens)

Open up the aim constraint option box. Set the “ world up type” to “object up” and put the name of posC object in the field (in my case it was called loc3), and make sure maintain offset is off. Select the posB object and then the first joint and pres apply.

Your first joint should now be aiming at the posB object. But why did we use the last position as an up object? What that gives us is the two vectors we need to define our third (see aim constraint post).

To check and see if you are on the right track, create a polygon plane and parent it under the first point. Now zero all the transformations. You may have to put 90 in the aiming axis (x in my case) but that is ok.

If you scale up the plane big enough you will see it now passes directly though the center of all three positions!

Figure 4

Figure 4

STEP 4:

Point constrain the second joint to the posB object. If you have done this correctly you should now only have values in the aiming channel (in my case it is x):

STEP 5: (more magic)

Open the aim constraint option box again. This time change the “World up type” to “Object rotation up” and put the name of your first joint in the field. Also put zeros in all of the up vector fields except the ones that would be be the “pushpins” from earlier (in my case it is z). Do this also for the “world up vector” option.

Now select your posC object and your second joint and press apply. If you have done this right you should have rotations in only one channel (z in my case).

Figure 5

Figure 5

STEP 6:

Point constraint your last joint to the posC object and zero out its rotations, jointOrients, and rotateAxis values if it has any.

STEP 7:

Delete the plane and all the point and aim constraints you have made. Select the top joint and run modify > freeze transformations to move the joints rotation values into the jointOrient.

Figure 6

Figure 6

DONE!

 

You may be asking yourself, “why go to all this trouble? why not just point snap the joints and be done with it?” Hers is why, your joint orients will not be clean if you just point snap your joints into place.

 Here is what I am talking about:

Figure 7

Figure 7

The sad part about this is that no amount of gratuitous use of the joint orient tool will fix this travesty. If you do run into a situation were you absolutely cannot change the orientation of your joints, I would suggest building a clean chain. Place nulls under each joint that have the exact same orientation as the joint with wonky rotate axis and then point and orient constrain them to these nulls.

This way you keep your strangely oriented joints and you have a clean chain to put ik or other controls on. I hope this helps!

 CHEERS

B

 

 

 

 

16th Jul2011

Demystifying the Aim Constraint

by bbentley81

Out of all the constraints in Maya the aim constraint seems to give beginners the most headaches. This is most likely due to the fact that there is little explanation of this concept of “Up”. The best way to think of “Up” is not the physical direction but as a vector in space.

Anything that rotates is Maya (and all 3d apps for that matter) gets this rotation from three vectors. These three vectors all have a length of one and are at 90degree angles to one another These vectors are calculated In such a way as to produce the rotation of the object.

Illustration 1: a locators three axis of rotation

Illustration 1: a locators three axis of rotation

In Maya you can visualize these vectors in several ways;

 

Through the main menu:

display > Transform Display > Local Rotation Axis

Illustration 2: visualizing local rotation axis with the Maya menu

Illustration 2: visualizing local rotation axis with the Maya menu

Through the attribute editor:

In the attribute editor under the Display tab. Toggle “Display Local Axis”

Illustration 3: visualizing the local rotation axis with the attribute editor

Illustration 3: visualizing the local rotation axis with the attribute editor

you can also do this though commands:

mel:

setAttr “locator1.displayLocalAxis” 1;

 python:

cmds.setAttr(“locator1.displayLocalAxis”, True)

What we mean when we say “Up” is really “what axis should we use for the cross product”. What is the cross product you ask? By taking the cross product of two vectors that are a length of one and are at 90 degrees to one another we get a third vector that is also one unit in length and 90 degrees to both input vectors.

That was all pretty heady lets look at some examples:

here is the aim constraint option box:

Illustration 4: the default aim constraint options window

Illustration 4: the default aim constraint options window

This is a lot of info so we will step through it one at a time. Aim Vector is the axis we want to point at our target. The first field is x, second y third z. (this is true for almost all three field inputs in Maya). The up vector field is what we’ve explained previously. It is the axis that we will use to define the third axis vector. So Maya defaults to aiming the x axis at the target and uses the y axis to calculate the z axis.

The next three fields work together to place the up vector. Think of this as telling what is in the “Up vector” field were to go.

Here are the default settings. We are aiming the x axis at our target and telling the y axis to point up in y.

Illustration 5: aiming with the default settings

Illustration 5: aiming with the default settings

here is another example were we are telling our y axis to point in x:

Illustration 6: changing the "up" position from y to x

Illustration 6: changing the "up" position from y to x

Now what if we want to change were out “Up” is pointing. In these two examples the up placement is static. By using the “Object Up” and  “Object Rotation Up” options we can define the position of our up vector.

I this example we use “Object Up” and specify an object in the scene. The “up” vector will now always aim to this object. The rotation of the object in this example is irrelevant.

Illustration 7: using another objects position as the up

Illustration 7: using another objects position as the up

I the next example the “Object Rotation Up” is now being used with the same object. We can see here that the orientation of the y axis of the aiming object now matches the x axis of “World up object”. The position of the object in this example is irrelevant.

Illustration 8: using another object's rotation to determine up

Illustration 8: using another object's rotation to determine up

 

By effectively controlling the “up” of an aiming object you have options that far exceed the capability of the more simple point, orient and scale constraints.

 

CHEERS

B.

 

17th Oct2010

Keeper and The Wraith

by bbentley81

Finished Principal animation on my short film!

It is the story of The Keeper who takes care of ancient statues and the villain who wants to destroy them.Thank you to the wonderful animation and design team. Hopefully I’ll get this rendered sometime this century. The main subject in interest as far as rigging goes on this would be the flapping wings and the facial setups with stick on clusters. Hopefully I’ll be putting vids up on how I did those.

ENJOY!