Monday, February 24, 2014

Project 3 checklist


  • everything from project 1 and 2
  • skinning - best possible deformations
  • IK / FK switch on both arms
  • curve controls for FK arms
  • facial rig
    • jaw and eyelid bones
    • blendshapes:
      • mouth wide, purse
      • brow raise, purse for both sides
    • face UI

Monday, February 10, 2014

IK/FK switch tutorial

IK/FK arm setup

1. make sure scene and rig are keyframe-free
2. pick a side to work on (in this example, left)
3. duplicate left arm (JT_arm_L) from arm joint down.
4. on the duplicate, make sure translate channels are unlocked, and unparent (shift-P) from clavicle. Isolate the selected joint in the viewport menu [show>isolate select]
5. in the hyper graph (or the viewport), select the roots of the four finger joint chains and the thumb chain of the duplicated arm chain. Delete them. This chain should now contain the arm, elbow, wrist and wrist end joints. 
6. Rename the joint JT_arm_FK_L, and rename the first three children (easiest to do from the hyper graph): 
  • JT_elbow_FK_L, 
  • JT_wrist_FK_L, 
  • JT_wristEnd_FK_L
6. select JT_arm_FK_L and assign it to a new display layer called "FK", and exit out of isolate select mode. 
7. duplicate JT_arm_FK_L. Rename the joint JT_arm_IK_L, and rename the children: 
  • JT_elbow_IK_L, 
  • JT_wrist_IK_L, 
  • JT_wristEnd_IK_L
8. Assign JT_arm_IK_L to a new display layer called "IK".

Setup IK controls

1. turn off the  visibility of "FK" and "rig" display layers. the JT_arm_IK_L chain should be the only joints visible.
2. create an IK handle [solver: rotate plane, sticky] from JT_arm_IK_L to JT_wrist_IK_L. rename the ik to IK_arm_L
3. create another IK [same options] from JT_wrist_IK_L to JT_wristEnd_IK_L. rename to IK_wrist_L. 
4. create a nurbs circle. this will become the IK controller. play with the options in the channel box and/or adjust the vertices to reshape the curve if you wish. move the curve with V held down (snap to point) to snap the controller to the JT_wrist_IK_L joint. 
5. rename this object CTL_arm_IK_L. freeze the transformations [modify>freeze transformations]. 
6. duplicate the object and move it with V held down, snapping it to JT_elbow_IK_L. from there, move it straight backwards on Z about 5 units. rename this object CTL_arm_PV_L, freeze the transformations. 
7. select CTL_arm_PV_L; shift-select IK_arm_L. Constrain> Pole Vector.
8. parent the two IK handles you just made to CTL_arm_IK_L (select them, select CTL_arm_IK_L last, and press P).
9. turn off the visibility of the two ik handles in the channel box. highlight all the channel names in the channel box, right click, and choose lock and hide selected. 
10. Assign the new ik-related CTL objects to the "IK" layer. 

Setup FK controls

1. turn off the  visibility of "IK" layer. the JT_arm_FK_L chain should be the only joints visible.
2. create a nurbs circle. rename it CTL_arm_FK_L. Group it by itself (ctrl+g) and name the group GRP_CTL_arm_FK_L.
3. select the JT_arm_FK_L joint, shift select the GRP_CTL_arm_FK_L node (find it in the hyper graph). constrain> parent[maintain offset = OFF]. the group and circle should pop up to the JT_arm_FK_L joint. 
4. find the constraint you just made in the hyper graph. delete it. 
5. select CTL_arm_FK_L, and rotate it so it orbits the upper part of the arm, then freeze the transforms. 
6. duplicate GRP_CTL_arm_FK_L, and rename "arm" to "elbow" for the GRP and CTL within. Using the above constrain and delete process, align the GRP to the JT_elbow_FK_L joint. adjust the CTL, freeze its transforms if needed. Repeat once more for the wrist joint. 
7. Parent GRP_CTL_wrist_FK_L to CTL_elbow_FK_L. Parent GRP_CTL_elbow_FK_L to CTL_arm_FK_L.
8. using the connection editor, connect the output rotation of CTL_arm_FK_L to the input rotation of JT_arm_FK_L. Repeat for the JT_elbow_FK_L and JT_wrist_FK_L joints.


Constrain the real arm skeleton to the FK and IK chains

1. Make the "rig" "FK" and "IK" display layers visible. You should be able to see all three arm joint chains.
2. Select the CTL_arm_FK_L, and rotate it so it is not in its neutral pose, such as -45 rotate y.  Move CTL_arm_IK_L in the opposite direction. 
3. Create a nurbs circle and rename it as CTL_IK_FK_L. move it so that it floats above the hand geometry. freeze the transforms. parent constrain [maintain offset = true] this node to the original wrist joint, JT_arm_L. 
4. With CTL_IK_FK_L selected, add a new attribute (modify>add attribute...)
5. Name the attribute "FK_IK" and give it a minimum of 0 and a maximum of 10. 
6. Turn the "IK" and "FK" display layers on. 
7. Select JT_arm_FK_L; shift select JT_arm_IK_L, JT_arm_L.
8. Constrain> orient [maintain offset = false]
9. JT_arm_FK_L should rotate to a position between the FK and IK joint chains.
10. With the joints still selected, press the down arrow key. The selection should migrate down to the elbow joint, but will still include the FK, IK, and original joint chain. Constrain>orient again (or press the g key to repeat let command).
11. Repeat step 10 one more time for the wrist joint. 


Use Set Driven Key to blend the constraints

1. Find the constraint nodes in the hyper graph.
2. Go to animate>set driven key
3. Load the constraint nodes in as "driven"
4. Load the CTL_IK_FK_L node in as "driver", with the "FK_IK" attribute selected.
5. With the "FK_IK" attribute on CTL_IK_FK_L set to 0, go to each constraint and lower the IK bone weight to zero.
6. Key each pair of constraint weights to the "FK_IK" attribute in the set driven key window.
7. Go back to CTL_IK_FK_L, change "FK_IK" to 10, and swap the weight values on each constraint. 

8. Key each weight pair once again.

Sunday, February 2, 2014

Circle control generator

This script:

generates a string variable containing all the currently selected joints, and for each joint selected...

  1. creates a circle 
  2. finds the shape node of the circle
  3. renames the circle as "selected joint" + shape
  4. creates a new variable for the renamed shape, and parents it to the selected joint
  5. deletes the transform node of the circle

You can run this script by copying this into the script editor and executing it. You can then either copy the circleAtJoint command to your shelf and run it from there, or type it into the script editor and execute the function name. Feel free to modify certain flags in the circle creation command, such as -r (radius) and -s (subdivisions).

global proc circleAtJoint()
{
 string $selectedJoints[] = `ls -sl`;
 for ($joint in $selectedJoints)
  {
  string $circle[] = `circle -c 0 0 0 -nr 1 0 0 -sw 360 -r 3 -d 3 -ut 0 -tol 0.01 -s 6 -ch 0`;
  string $circleShape[] = `listRelatives -s $circle[0]`;
  string $newShape = `rename $circleShape ($joint+"Shape")`;
  parent -r -s $newShape $joint;
  delete $circle[0];
  }
}