3D World

Build a flexible RIG: part 1/3

Learn how to build an advanced rig in this three-part series

- Antony Ward Since the early 90s Antony has worked for many of today’s top game and VFX studios, as well as written three technical manuals and many online tutorials. www.antcgi.com

In this three-part series, Ant Ward teaches us how to build an advanced rig with his step-by-step guide

When it comes to making a character move in 3D you are only limited by your knowledge and imaginatio­n. A rig can be as simple or as complex as you need it to be and can take anywhere from a day to a month to build, some even longer.

Once you start digging into the world of rigging you may find it easy to become overwhelme­d by how complicate­d the process can be. With constraint­s, utility nodes, expression­s and a whole host of other Maya tools thrown into the mix, it can make your head spin and might put you off even attempting it.

With this three-part series we will focus on building a rig for a cute robot character, generously supplied by the editor of this magazine Rob Redman. In doing so I aim to strip back the rigging process and divide it into manageable chunks, giving you the option of three levels of rigging, each increasing in complexity and functional­ity.

In this, the first part, we will build a basic rig with IK and FK functional­ity as well as stretchy limbs. This can then be used to pose or even animate your character, but ultimately it will act as the foundation that we will expand upon with more complicate­d systems through parts two and three.

01 build the limb joints

The foundation to most rigs is the skeletal structure. Whether this deforms the mesh directly or manipulate­s other controls which in turn drive the model, it’s always present and very important. So, let’s begin by building yours. At this stage you just want a very basic structure without any extra joints for the bicep or wrist twists. They will come later. Using the Skeleton>create Joints tool, build the base joints for each arm and leg using just three joints for each and make sure you name them appropriat­ely, for example l_shoulder, l_elbow, and so on.

02 ADD the spine joints

For the spine, neck and head repeat the previous step adding three joints through the torso and one for the neck, which for this character will also move the head. You can also add an extra joint or two for the antenna, so this can have some secondary animation added. Make sure you name these spine_lower, spine_middle, spine_upper, neck, antenna_lower and antenna_middle. It’s important when building any rig that you stay on top of your names. To help add extra control to the lower body also add a root joint in the same place as the spine_lower joint, parenting the spine_lower joint to it.

03 Adjust the joint orientatio­ns

With the structure created you now need to go in and ensure each joint is orientated correctly. You do this so that they will rotate in a predictabl­e manner when animated, plus having the wrong orientatio­ns can cause issues further down the line when you start to build your rig. For each joint chain use the Skeleton> Orient Joint tool. The default options are fine for this rig, just change Secondary Axis World Orientatio­n to Z to keep the Y axis facing forward.

04 end joint orientatio­ns

With the end joints for the arms and spine, use the Orient Joints to World option so they align correctly with the parent joint. With the ankle joints you need to tackle these slightly differentl­y, because these will need to align with the world to make sure the foot controls are flat with the floor and not rotated. With these, simply unparent the joint before you apply the Orient Joints to World tool so they inherit the world axis, not the parent joint. When done simply parent them to the knee joints again.

05 ik AND FK skeletons

You can now start to think about adding some functional­ity to these joints in the form of both IK and FK control options, and the ability to blend between them.

These next steps are identical for the other limbs, so rather than repeat them here we will focus on just the left arm. You can come back and follow the process again for the right arm and legs. All you need to do is duplicate the limb joint chain three times and rename each joint to represent its new role. So simply add _ik, _fk or _stretch to the end. The new IK and FK limbs don’t currently influence the main joint chain, so let’s do that next. Select the l_shoulder_ik joint and then add the l_shoulder_fk to the selection. Finally add the l_shoulder joint and then go to Constrain>parent to constrain the shoulder joints movement to the l_shoulder_ik and l_shoulder_fk joints. (Make sure Maintain Offset is disabled in the options). Repeat this for the elbow and wrist joints, constraini­ng them to the IK and FK chains too.

07 ADD control icons

Now the joint chains are connected you need to create a few controls that the animator will use when they come to animate. These can be as simple or as complex as you require but can be built from simple NURBS curves. I’ve supplied some with the tutorial files to get you started, but you need to have seven icons named as follows: L_ arm_root, l_arm_ctrl, l_arm_ik_ctrl, l_elbow_ctrl, l_shoulder_fk_ctrl, l_elbow_fk_ctrl, and l_wrist_fk_ctrl.

08 create offset groups

As an added step, group each of the icons and name the groups the same, but with ‘_offset’ after the name. This will allow you to maintain the icons’ orientatio­n, while ensuring the transform and rotate values are kept at zero which makes for a cleaner rig. For the FK controls you also need to adjust the hierarchy so they move correctly, so next parent the l_wrist_fk_ctrl_ offset group to the l_elbow_fk_ctrl and l_elbow_fk_ctrl_offset group to the l_shoulder_fk_ctrl icon.

09 change the control positions

You now need to reposition the controls. First select the l_shoulder_ fk joint and then the correspond­ing offset group and go to Constrain> Parent. This will snap the offset group and the control icon to that joint’s position and correct its orientatio­n. Repeat this for the elbow and wrist groups too. Also constrain the l_arm_ik_ctrl_offset group to the l_wrist_ik joint and the l_arm_root_offset group to the l_shoulder_ik joint. Finally, constrain the l_elbow_ctrl_offset group to the l_elbow_ik joint. You only needed the parentcons­traint nodes temporaril­y, so you can delete them before you move on.

10 ik AND FK control connection

Now you have the controls let’s make them drive the correct joints, and to do this we will simply use more parentcons­traints. Select l_shoulder_fk_ctrl and then the l_shoulder_fk joint and go to Constrain>parent, repeating this for the elbow and wrist FK controls too. With the IK arm we only have the one control, but we only need to worry about the rotations, so this time select the l_arm_ik_ctrl and then the l_wrist_ik joint and go to Constrain>orient.

11 ik FK blending

The next step is to create the option to choose whether the base arm follows the IK or the FK arm, so to help you need a new attribute to control this. Select the l_arm_ctrl icon and go to Modify>add Attribute. Set the Long Name value to Ik_fk_switch, the Minimum Value to 0 and the Maximum Value to 1 and click Add. You now need to dive into the Node Editor to connect everything up, so go to the Window menu and open it.

12 connect the ik control Arm

At this point all we need to control are the parentcons­traint nodes on the main joints, so select those in the Outliner and using the middle mouse button, drag them into the Node Editor. Now select the l_arm_ctrl icon and drag that in too. Expand both the l_arm_ctrl and parentcons­traint nodes so you can see all the attributes and make a connection between the IK_FK_ Switch attribute on the l_arm_ctrl

icon to each ikw0 attribute on the parentcons­traint nodes.

13 reverse the ik FK Attribute

At present the Ik_fk_switch attribute only controls the IK joints’ influence. What you ideally need is when one attribute on the parentcons­traint node is set to 1 the other is set to 0. To do this you can use a Reverse node, which will take a value and invert it. Press Tab in the Node Editor and begin typing reverse until you see the word in the box below. Select this to create a new Reverse node and rename it to l_arm_ikfk_reverse.

14 connect the FK control Arm

Expand the l_arm_ikfk_reverse node so you can see all available attributes, and drag a connection between the Ik_fk_switch attribute on the l_arm_ctrl to the Input X attribute on the Reverse node. Now drag another connection, but this time from the Output X attribute on l_arm_ikfk_reverse to the fkw1 attributes on each parentcons­traint node. If you adjust the IK_FK_ Switch attribute you will now see the main arm joints blending between the IK and FK joints.

15 Adjust the control visibility

The base arm now blends between the IK and FK control arms, but the controls for each are still visible which can be confusing to the animator. What you can do is use the existing nodes to also control their visibility. Back in the Node Editor connect the Ik_fk_switch attribute to the visibility attribute on the l_arm_ik_ctrl_offset and l_elbow_ctrl_offset groups. Next, connect the Output X attribute on the l_arm_ikfk_reverse node to the visibility attribute on the l_shoulder_fk_ctrl_offset groups.

16 ADD ik control

The FK controls now work with the base skeleton so let’s next look at setting up the IK arm. Go to Skeleton>create IK Handle and open the options. Make sure Current Solver is set to Rotateplan­e Solver and then select the l_shoulder_ik joint followed by the l_wrist_ik joint. Rename the resulting IK handle to l_arm_ ikhandle and then parent it to the l_arm_ik_ctrl icon. Now when you move the l_arm_ik_ctrl control the IK arm follows.

17 ADD elbow control

You now have control over the arm, but you also need the ability to position the elbow. You can do this using another type of constraint, the Pole Vector constraint. Select the l_elbow_ctrl icon and then the l_arm_ikhandle and go to Constrain>pole Vector. Finally, select the l_elbow_ctrl_offset group and move it back so it’s behind the arm and not on the elbow.

18 build stretchy limb support

You are now going to attempt something a little more advanced so that the limbs can squash and stretch. To achieve this, you need to create a network of nodes which will work out the length of the arm and compare it to where the arm IK control is. Once the arm is straight and the IK control moves away this network will see the difference and offset the joints, so they maintain a relative distance from the control. To begin with, go back into the Node Editor and create two distancebe­tween nodes. Call one l_arm_upper_dist and the other l_arm_lower_dist.

19 connect the scale joints

Bring the scale joint chain you created earlier into the Node Editor too. Connect the worldmatri­x[0] attribute on the l_shoulder_scale joint to the inmatrix1 attribute on the l_arm_upper_dist node, and then connect worldmatri­x[0] on the l_elbow_scale joint to the inmatrix2 attribute on the l_arm_upper_dist node. The l_arm_upper_dist node will now give you the distance between these two joints. Repeat this process but this time connect the l_elbow_scale and l_wrist_scale joints to the l_arm_lower_dist node,

giving you the distance between these two joints.

20 get the Full Distance

You now have two distance nodes giving you two values but ideally you need just the one which covers the distance of the whole arm. Create an adddoublel­inear node called l_arm_fulldist and then take the distance attributes from both the distancebe­tween nodes and connect these to the input attributes. This node now holds the full distance of the arm so next you need to figure out how far away the l_arm_ik_ctrl icon is.

21 ik control Distance

Create a locator by going to Create>locator and rename it to l_arm_stretchend. Snap it to the position of the l_wrist_ik joint and then parent it to the l_arm_ik_ctrl icon. Create a third distancebe­tween node called l_arm_stretch_dist and this time connect the worldmatri­x[0] attribute on the l_arm_root icon to the inmatrix1 attribute on the l_arm_stretch_dist node. Follow this by connecting the worldmatri­x[0] attribute on the l_arm_stretchend locator to the inmatrix2 attribute on the l_arm_stretch_dist node. This will give us the distance of the IK control from the root of the arm, so we can tell when the arm should stretch.

22 ADD A condition node

Now you have two networks giving you the distance details you need, so let’s use these to work out if the arm is stretched. Create a new Condition node called l_arm_ condition. A Condition node works much like an IF statement, so you can check if one distance goes over another, and if it does you trigger the stretch.

First, connect the distance attribute from the l_arm_stretch_ dist node to the First Term attribute. Next take the Output attribute from the l_arm_fulldist node and connect it to the Second Term attribute. Change the operation to Greater Than, which will check if the value in the First Term goes above the value in the Second Term attribute.

23 stretch the joints

You now need another node which will work out the scale value of the joints. This time create a multiplydi­vide node called l_arm_multi and set the Operation to Divide. Connect the distance attribute from the l_arm_stretch_ dist node to the input1x attribute on the multiplydi­vide node, and the Output attribute from the l_ arm_fulldist to the input2x attribute on the l_arm_multi node. Now connect the Outputx attribute on the l_arm_multi node to the Color If True R attribute on the l_arm_ condition node. Finally, connect the Outcolorr attribute on the l_arm_condition node to the Scalex attributes on the l_shoulder_ik and l_elbow_ik joints.

24 tidy up the scene

You now have a stretchy limb which will blend nicely between IK and FK controls, but before you proceed let’s tidy up the scene. Group the l_shoulder_ik, l_shoulder_fk and the l_shoulder_ stretch joints, calling the new group l_arm_grp. Parent the l_shoulder_ fk_ctrl_offset group to the l_arm_ root icon and then select the l_arm_ root icon and the l_arm_grp and

go to Constrain>point Constraint. This will make the arm follow the l_arm_root control so you can move it from both ends. What you can also do is select the l_wrist joint and then the l_arm_ctrl_offset group and do another Point Constraint.

25 repeat

Repeat steps to 4 to 23 to create the rigs for the right arm and the legs. You won’t be using the IK, FK or stretchy rigs for the spine as with this version of the rig we can use a simpler setup. When done, create three groups called controls, systems and skeleton. Place the base joints into the skeleton group, the remaining offset groups into the controls group and the groups containing the IK, FK and Stretch joints into the systems group.

26 the spine controls

When it comes to this version of the spine we only need a few simple controls to make it move, so create five new icons. Name these cog_ctrl, hip_ctrl, chest_ctrl, shoulder_ctrl and neck_ctrl making sure you also place them into offset groups, as you did with the other icons. Using parentcons­traints, constrain the cog_ctrl_offset group to the spine_lower joint, the chest_ctrl_offset group to the spine_middle joint and the shoulder_ctrl_offset group to the spine_upper joint. Also constrain the neck_ctrl_offset group to the neck joint and the hip_ctrl_offset group to the root joint. Make sure to go through and remove all the new parentcons­traint nodes.

27 connect the spine

You now need to make these controls move the spine and neck joints. So, using parentcons­traints again, this time constrain each joint to its control. Do this for each control except the hip_ctrl, which will instead drive the root joint and will enable you to sway the robot’s hips, independen­tly of the rest of his torso.

28 spine hierarchy

The hierarchy of the spine controls needs to be adjusted now so that they all work together to give you the best poses. Parent the neck_ctrl_offset group to the shoulder_ctrl. The shoulder_ctrl_ offset group to the chest_ctrl and the chest_ctrl_offset group to the cog_ctrl. Also parent the hip_ctrl_ offset group to the cog_ctrl. We don’t nestle this in with the other spine controls because we want to be able to move it independen­tly.

29 connect the limbs

The body now moves with the new controls, so what you need to do next is make the limbs follow it too. This is easily done as we have been organising things as we went along. All you need to do is parent the r_leg_root_offset and l_leg_ root_offset groups to the hip_ctrl, and the l_arm_root_offset and r_arm_root_offset to the neck_ctrl. Now when you move the torso, the limbs follow and what’s more, if you rotate the hip_ctrl, you can make the legs move without affecting the rest of the body.

30 Fingers AND toes

Now you have a good idea of how to build a basic rig, why not take this further and add some finger and toe controls. These just need to be FK driven for now as we will look at more advanced controls in part three of this series. If at this stage you are planning on skinning this character I would suggest following the accompanyi­ng videos, as there are a few more steps you will need to take to make this version of the rig skin-ready. •

 ??  ??
 ?? rigging A robot In this three-part series, learn how to create both a basic and complex rigging system that can be used with any character ??
rigging A robot In this three-part series, learn how to create both a basic and complex rigging system that can be used with any character
 ??  ?? Author
Author
 ??  ?? Control icons can come in many shapes and forms and can be created easily using NURBS curves
Control icons can come in many shapes and forms and can be created easily using NURBS curves
 ??  ?? 08
08
 ??  ?? 01
01
 ??  ?? 05
05
 ?? symmetrica­l joint creation Speed up your joint creation by enabling Symmetry in the Create Joints tool. ?? 03
symmetrica­l joint creation Speed up your joint creation by enabling Symmetry in the Create Joints tool. 03
 ??  ?? 02
02
 ??  ?? 06
06
 ??  ?? 04
04
 ??  ??
 ?? preserve position If your joints move when you parent or unparent them, make sure you have Preserve Position checked in the options. ?? 14
preserve position If your joints move when you parent or unparent them, make sure you have Preserve Position checked in the options. 14
 ?? repeat common operations Pressing G will repeat the last action, so use this when constraini­ng multiple times to save going into the menus. ?? 17
repeat common operations Pressing G will repeat the last action, so use this when constraini­ng multiple times to save going into the menus. 17
 ??  ?? 13
13
 ??  ?? 15
15
 ??  ?? 18
18
 ??  ?? 16
16
 ?? lock down It’s important to lock down any nodes and attributes the animator shouldn’t have access to, as this helps to reduce the risk of the rig being broken. ?? 20
lock down It’s important to lock down any nodes and attributes the animator shouldn’t have access to, as this helps to reduce the risk of the rig being broken. 20
 ??  ?? 23
23
 ??  ?? 22
22
 ??  ?? 24
24
 ??  ?? 19
19
 ??  ?? 21
21
 ??  ?? 26 squash and stretch With this setup you can change the operation attribute on the Condition node to alter how the limb reacts when moved; you can make it squash as well as stretch.
26 squash and stretch With this setup you can change the operation attribute on the Condition node to alter how the limb reacts when moved; you can make it squash as well as stretch.
 ??  ?? 30
30
 ??  ?? 29
29
 ??  ?? 25
25
 ??  ?? 28
28

Newspapers in English

Newspapers from Australia