Create the neck and head controls
We'll add the controls for the neck, head and jaw joints now. So, select neckA_jnt, neckB_jnt, head_jnt, jawA_jnt and open up the createControls.py script in the Script Editor. Make sure the final line reads as:
cmds.orientConstraint(ctrl, s, mo=0)
and then Execute the script.
Now let's create the control hierarchy. Select jawA_ctrl_offset and parent it under head_ctrl. Next parent head_ctrl_offset under neckB_ctrl and then parent neckA_ctrl_offset under neckA_ctrl_offset. Lastly, point constrain neckA_jnt to neckA_ctrl and then parent neckA_ctrl_offset under chest_IK_ctrl.
To edit the shape of the controls and make them more easily selectable, go into component mode by hitting F8 on the keyboard. Select the CVs of the controls and scale and translate them to wrap around the geometry. A bit of tidying up is required now: select neckA_jnt, hit Ctrl+G and then rename that group head_jnt_grp. Select both head_jnt_grp and spine_jnt_grp and hit Ctrl+G. Rename the new group torso_jnt_grp.
Creating the controls for the neck, head and jaw
Creating the eye controls
For the eye controls, we are going to create a locator shape from a CV curve. To do this, pop into any orthographic view (I start in the Front view) and activate the CV Curve Tool with the Curve degree set to 1 Linear. Now turn on Grid snapping (or hold down the X key) and start drawing a cross. Stay in the tool, switch to the top view and continue to add a further 2 points to create what looks like a locator. Rename the shape l_eye_ctrl and then hit CTRL+G twice. Rename the top most group l_eye_ctrl_offset and the group below l_eye_ctrl_auto.
To position the control, select l_eye_ctrl_offset and parent it under l_eye_jnt. Once it pops into place, zero out the transformation values for the offset group and then hit Shift+P to un-parent it from the joint. Now pull the offset out in the Z-axis to pop it in front of the character. Select l_eye_ctrl_offset and hit Ctrl+D to duplicate it. Replace the l_ with an r_ for the control and the group nodes and then pop a minus in front of the Translate X value to get it to the other side.
Next, we'll create a control to carry both individual eye controls. Pop into the Front view and, using the CV Curve Tool, draw out a square shape. Rename it eyes_ctrl and then hit Ctrl+G twice to create the control hierarchy. Rename the top-most group eyes_ctrl_offset and the next group eyes_ctrl_auto. To get the control into place, select in this order; l_eye_ctrl, r_eye_ctrl and then eyes_ctrl_offset. Go Constrain > Point and the control hierarchy should snap into place. Now delete the PointConstraint node that lives under eyes_ctrl_offset. Edit the shape of the eyes_ctrl in component mode (F8) and then parent l_eyes_ctrl_offset and r_eyes_ctrl_offset under eyes_ctrl.
The last thing we want to do is set up the eye constraints. Select l_eye_ctrl, shift-select l_eye_jnt and go Constraints > Aim (Options). Set the Aim Vector to 0, 0, 1 and hit Apply. Do the same for the right eye and the character should be good to look around.
The eye controls in place
Eye follow setup
Start by creating 2 locators (Create > Locator) and rename them eyesHeadFollow_low and eyesWorldFollow_loc. Select both locators and parent them under eyes_ctrl. Zero out the Translation values to pop them into place and then hit Shift+P to un-parent them. Now parent eyesHeadFollow_loc under head_ctrl and leave eyesWorldFollow_loc where it is. Select in this order; eyesHeadFollow_loc, eyesWorldFollow_loc, eyes_ctrl_auto and go Constrain > Parent.
We are now going to add an attribute to the eyes_ctrl to allow us to set if the eyes should follow the head control or the world. Select eyes_Ctrl and go Modify > Add Attribute. Give it a Long name of eyesFollow and set the Data Type to Enum. Under the Enum Names, highlight Green and set the New name to Head and then highlight Blue and set the New name to World. Hit Add when ready. Now go Animate > Set Driven Key > Set. Select eyes_ctrl and hit Load Driver in the Set Driven Key window. Then select the parentConstraint living below eyes_ctrl_auto and hit Load Driven. Set the eyesFollow attribute to Head on the eyes_ctrl and then set the Eyes Head Follow Loc W0 to 1 and the Eyes World Follow Loc W1 to 0 on the parentConstraint. Highlight the eyesFollow attribute on the top-right hand side of the Set Driven Key window and the constraint weights on the bottom-right window and then hit Key. Now set the eyesFollow to World, reverse the weight values on the parentConstraint and hit Key once more on the Set Driven Key window. You should now be able to have the eyes_ctrl follow or not follow the head control.
Now, select eyesWorldFollow_loc, hit Ctrl+G and rename the new group worldFollow_loc_grp. Lastly, select both eyesWorldFollow_loc and eyesHeadFollow_loc and hit Ctrl+H to hide them.
Using the Set Driven Key window to drive if the eyes should or should not follow the head control
Creating the space switching for the head
Create 4 locators and rename them as follows: headNeckFollow_loc, headTorsoFollow_loc, headCOGFollow_loc and headWorldFollow_loc. Parent all 4 locators under head_ctrl, zero out the Translation values to pop them into place and then hit Shift+P to un-parent them.
Now select in this order; headNeckFollow_loc, headTorsoFollow_loc, headCOGFollow_loc, headWorldFollow_loc and then head_ctrl_auto and go Constrain > Orient. Select head_ctrl and go Modify > Add Attribute. Call it headFollow, set it as an Enum and add the 4 following Enum names: neck, torso, COG and world.
Open up the Set Driven Key window and load the head_ctrl as the Driver and the orientConstraint node as the Driven object. As we did for the eyes, set the Enum to the relevant mode and then turn off all but one of the relevant constraint weights. Hit key when done and then repeat for the remainder of the Enums.
Once you have created the Set Driven Keys, parent the locators under the following controls: headNeckFollow_loc under neckB_ctrl; headTorsoFollow_loc under chest_IK_ctrl; headCOGFollow_loc under COG_ctrl and headWorldFollow_loc under worldFollow_loc_grp. Then hide all the locators by hitting Ctrl+H.
Creating head space-switching in the same manner that we did for the eyes
Let's start by locking and hiding any attributes we do not want the animator to key. Select neckA_ctrl, neckB_ctrl, head_ctrl and jaw_ctrl and highlight all the Translate and Scale Channels in the Channel Box. Hold down the RMB and go Lock and Hide Selected. Select eyes_ctrl, l_eye_ctrl and r_eye_ctrl and Lock and Hide all the Scale channels.
Feel free to color code the controls by turning on Enable Overrides and using the Color slider under Display > Drawing Overrides in the Attribute Editor. Ta da – the head and neck rig is finished. Next time, we will create the shoulder and arm rig. Happy Rigging.
Color coding the controls and locking and hiding some of the attributes
Jahirul's video tutorial on how to rig the neck and head
Top Tip: Get feedback from animators
As you progress through the rigging process, try and get feedback from the animators. As we are creating this rig in stages, it would be very easy to pass each ‘chunk' of the rig to the animator and say "Hey bud. Take this for a spin and see what you think”. The earlier you can get feedback on what is working and what is not, the earlier you can make those necessary changes.
Jahirul's previous rigging tutorials can be found here:
Maya rigging: Introduction to rigging
Maya rigging: Introduction to rigging a human torso
Check out Jahirul's site