jueves, 20 de agosto de 2009

Rig Tutorial

Disclaimer: This is a basic rig tutorial for Maya, it’s almost certain you will encounter some problems along the way and this tutorial should only be used as a rough guide. You should have a good knowledge on the use of constraints in order to take better advantage of this tutorial.

For this rig tutorial I used a normal, toonish human character, so it should cover some of the basic parts involved in rigging. We will cover IK and FK rigging, IK elements, weight painting and etc. Hopefully this tutorial will be of some use to you.

The Leg IK

We should start by creating the legs, starting off with the Iks. First we create the joints and I should warn that it is critical to always name your joints, so as to keep a better organization of the systems and the overall rig. Second step is to orient these joints, this can be done easily by using the menu Skeleton > Orient Joints, and setting it to hierarchy. Fair warning though, you may have to re-orient some joints manually. Then you can duplicate the joints for the oposite leg by using the menu Skeleton > Mirror Joint, preferably in YZ.

IK Handles (Leg)

Once we’ve got the joints ready, it’s time to place the Iks via the IK handle tool ( look for it in the Animation shelf ) The preferences you need are: Sticky/ solver enabled / using RP solver, this last one will be helpful to control the knee. You’ll need to make 3 IK handles per leg: ankle to thigh/ (these next ones with the SC solver) ball to ankle/ tip to ball. Then we can create a controller with a curve that we can shape accordingly. All attributes must be on default ( that is in 0 with the exception of the scale ) you can either set it manually or use the Edit > Freeze Transformations. To move it around we group the controller with “Ctrl + G” and move only the group. You’ll need to remember this cause in the rig you’ll be doing this…A LOT. Also fair warning avoid grouping the controllers again and duplicating these if you are trying to make a duplicate in scaleX -1 for the opposite limb, otherwise you may regret it.

Movement attributes

Before we get to making the attributes for the leg, there’s a couple of things we need to do first: We’ll take the leg’s IK handle and group it, the group will thus be renamed as “Heel lift” and you should move its‘ pivot over to the foot‘s ball, we group the other 2 IKs and name their group “toe curl” and move its’ pivot in the ball as well. Taking both newly created groups we group them again under “toe pivot” (This will be the one for both Toe Stand AND toe pivot) with it‘s pivot at the toe, and yet again we create another group containing the previous one, with it’s pivot on the heel and rename it “heel pivot”. We place the heel pivot group as a child of your controller (Via parenting on the hypergraph or just plain old-fashioned hitting the “P” key). Now we have to connect the attributes to the control. You should prepare the control by selecting it and Attribute > Add attribute, you can create the new attributes the leg will control, but now we need to connect these attribute. I recommend using the connection editor and connect each of the newly created attributes with the group rotation axis that matches to it. Controlling the knee (specially in Maya 2009 ) is rather tricky to accomplish, for this we will need the Ikhandle of the leg and the controller and place them in the hypershade workspace (yes the hypershade, that was not a typo) once ther we create a plus/average node and connect the controllers knee attribute to the Plus/Average in input 1; normally you’d connect the offset on the next input: input[0], however Maya 2009 has some issues with this, the solution? Use the script editor look for the previous command ( should read something like: connectattibute LegCtrl.knee ) copy and paste it into the workspace of the script editor and change knee for offset and the input number and execute the new command, it should connect the offset.Now back to the hyper shade, we’ll take the Plus/Average’s output1 and connect it to the IK s’ twist. You should lock the offset attribute since you won’t be touching that one.

FK and Bind (Leg)

Now on to the FK, FK s are fairly easier than IK s, first you need another set of joints ( duplicate the IK joints and delete the duplicate IK s and effectors) since mostly you’ll just need to create the controls for each joint and position them by moving the groups. Once the control is in position, select joint and then Shift select the controller group and use Constraint > Orient without the offset, afterwards we can delete the constraint (it‘ll be in the Hypergraph ), it rotate the control to match the joints rotation then you can select the control vertices and rotate it to a position that’s more comfortable to use. Now we select the control and then shift select the joint and do another orient constraint ( With maintain offset, just to be on the safe side ) And the control for that joint should be ready. Remember to name them accordingly and to avoid confusions be sure to keep a distinction between the IK s and the FK s.

For the bind joints we need yet another duplicate of the leg joints ( you can leave the pelvis alone, you just need the one ) . Also with these joints you will have to create the toes (if your character has ‘em of course), these will be connected to the Tip. Finally we select an IK or FK joint then a bind joint then parent constrain, repeat the process with the other joints of the leg.

IK/FK Switch

You were probably wondering how we would make the Bind joints go from IK to FK, that’s where the IKFK switch comes into play. You can set this switch into a controller ( I’d recommend using the IK control ) and create an attribute for it with 0 as a minimum and 10 as maximum. Now we go to Animate > Set > Set Driven Key with the binds constraint as Driven and the controller with the switch as the driver. Now when you select the constraints you’ll notice in the attribute menu on your right they both display a 1 of value, meaning they both have full influence on the bind, so we first set the FK influence in 0 and leave the IK in 1 and with the drivers’ Switch value on, as well as the influences selected in the Set Driven key window we hit “Key”, and repeat as necessary with the rest of constraints, then we go back to the controller and set the Switch in 10 and key once more with the inverted values FK in 1 and IK in 0. Once you’ve finished the legs should be ready.

Arm IK

First of all do the standard procedure for setting joints ( Create, name, position , orient, you’ll be doing this a lot too). You should also place a joint in the forearm, easiest way is Skeleton > Insert Joint tool. Or place them in in the first place. You’ll only need one IK handle for the arm and it should go from the shoulder to the forearm. The IK s’ pivot should be placed on the wrist but to do that we need to go to Modify > Evaluate nodes > Ignore all. Now we can position the pivot on the wirst, and move the effectors pivot to the wrist too. We turn on the Evaluate All once more and we create the controller with the standard procedure ( By now you should know the drift ) and parent the IK to it, orient constrain the wrist to enable rotation and orient constrain the forearm joint but only in the X axis. To control the elbow we will use another controller, this one positioned a ways back from the joint, select the control then the IK handle and use a constrain pole vector.

Arm FK and Bind

The Arm FK is pretty much the same this time around, with the only exception being to asign the rotate in X for the forearm. We constrain the forearm joint and the wrist control in X only. For the bind We create a clavicle joint (there should be two, one for each side unlike the pelvis) and another duplicate of the arm joints, these will also have the fingers. You can control the fingers in two ways: via the regular FK system or by creating a new control for the hand, which other than having the arms’ Switch will contain movement attributes for the fingers and for some basic hand movements like Spread, or fist to name a few. You can do this with the Set Driven Key method portrayed previously. Once you’re finished with that parent the control group with the wrist joint setting the controls pivot all the way to he joint. Same as before constrain the IK and FK joints to the Bind and set the driver to the control with the Switch . For the clavicle a simple FK control should suffice, one for each side.


Place the spine joints, name and orient as always (repetitive, ain’t it?). Depending on your character will influence how you will place the spine, but in normal humanoid characters it should be curved, also go from the base ( lil higher than the pelvis) up to the base of the head, unlike with the other joint systems we won’t create a bind duplicate for the spine, we will use the IK spine for this. Also we will use a new tool for this one being the IK Spline, before you use the IK spline make sure the preferences are set to 2 spans, and set the IK from the very base all the way up to where your characters’ neck should start. If you check the hyper graph you’ll notice a curve was created as well, this will be important. Select each vertex of this new curve and with Create deformer > Cluster will create a…well “Cluster” do this for each vertex so it will be easier to move these around, we’re still gonna make controllers for ‘em though. Create 2 controllers, one for the base and one for the top. Top one is parent of the 2 topmost clusters and the bottom one will get the two lower clusters. The one in the middle you’ll parent it to both controls.

For the spine’s twist we will use an expresion, you will find the expresion editor under Window > Animation editors. This is kind of what you will need to enter : ikhandle.twist (the spine`s) = top spine controller rotateY (minus the spaces ) I wrote just an example, if you named your spines controller differently you should use that name.

Neck to Head

Remember those few joints of the spine you placed in your neck? Well in order to control the neck we should do the following, Using either the hypergraph or the connection editor connect the rotate attribute of every joint with the neck base joint. Next create and place the controller at the top most joint and orient constrain it with the base neck joint.

Connecting all together

We begin this step by connectin the pelvis to the base of the spine, using a parent constrain with the Spine bottom control, note the controller should be the parent. We parent constrain the clavicle and consequently the arms to the spin by taking the clavicle control group and the closest spine joint as the parent. Now we should create a master control right at the center and using it as a parent we put the IK control group of both legs, the control group of both arms, and the pelvis as the Master controls children. Before we finish here we should be fixin` that problem you may of noticed with the spine, create a locator and set it a ways back and up of your model and name it "roll solver" and set the Spine Bottom controller as its parent. Now we need to fix some attributes of this locator, fair warning though, while you're doing this ir may look like your rig is getting completely destroyed but it'll be perfect once you finish. In the IK Splines attributes look for IK solver and enable the twist controls, under "world up type" set it as Object up and under "world up object" just type in your roll solver's name.

Skin Binding and Weight Painting

Your rig is finally finished (Whew!) now all that's left is to bind and weight paint it. To bind all the joints to the skin you chose both Bind arm and leg joints, skipping the tips of these, as well as the spin, pelvis and clavicle, and then select your model and in the menu bar go Skin > Bind Skin > Smooth Bind, with the settings set to "selected joints" and "closest distance". Now for the weight painting, here we paint the influence for every joint to the rig and how moving the joints will affect the overall rig, I'm sorry to say this step will be most frustrating and the only real advice I can give is to be patient, you will need to move the model and animate it to see if the influences are behaving correctly and more often than not you will encounter problems for this step.

Finishing touches

Once you finally finished everything, got to the hypergraaph and group all the controls in a single group, group all the joints in a single group and group all the geometry in a single group, then take all the three groups and group 'em in a single group with your character's name, just to keep everything tidy and organized and there you have it. Hope this tutorial was useful for anybody out there. LaTerZ