This Cyber Monday Tuts+ courses will be reduced to just $3 (usually $15). Don't miss out.
Animation can be a nightmare if you don't have an easy to use, well-made rig to work with, and in this tutorial Donato Marotta shows us how to create just that using joints, locators, custom attributes, set driven keys, expressions and constraints in Maya!
Additional Files/ Plugins:
The tutorial is laid out as follows :
- From Step_1 to Step_6 I explain how to setup the scene before we start rigging.
- From Step_7 to Step_26 we will create all controls, joints and the parental structure.
- From Step_26 to Step_49 I will connect all joint and controls using constraints and expressions.
- From Step_50 ti Step_66 we will insert the stretch and squash control, and finally skin the bottle!
Note: Click images to access high-res versions.
Create a new scene and import the bottle with stopper. Select the stopper, then hold down shift and select the bottle. Press P to parent the stopper to the bottle.
We need to move the bottle's pivot point, so select the bottle in the front view and press ins on your keyboard. This allows us to move the object's pivot using the transform gizmo. Move the pivot to the bottom of the bottle and when you're happy with it's position, press ins again. Finally, press W and move the bottle so that it rests on Y=0 as shown.
Press R and scale the bottle proportionally so that it is eight units high, as shown.
With our bottle in place, select Freeze transformations from the Modify menu.
With the bottle and stopper selected, create a new layer and rename it to Bottle_Layer. Then add the selected objects to our new layer by clicking the button shown.
Click on the center square on the Bottle_Layer to template the bottle, which allows us to see it, but not select it.
In the Animation menu click on the Skeleton/Joint Tool.
Press hold X to enable grid snap, and create eight Joint from the bottom to the top of the bottle - one on each of our grid squares. When you're happy, press Enter to drop the tool.
In the Create menu select NURBS Primitives >Circle.
Create a circle with a Radius of 15.
Press Ctrl+A to activate the Attribute Editor for the object, and then go to Object Display > Drawing Overrides > Enable Overrides and choose the Red color.
Now we're going to modify the circle a little bit! Right click on it and select Control Vertex. Now grab the vertices one by one and move them into place (you can create any shape you want!) When you're done, rename the circle as Ctrl_Bottle.
Now create another nurbs circle in the center of axis, with a Radius of 10. Then go to the Attribute Editor and make it yellow.
Move the last created circle to 8 on the Y axis, and rename it as Ctrl_Spine1.
Duplicate Ctrl_Spine1 twice, and move the first to 16 and the second to 24 on the Y axis.
Select menu Create > Locator.
Scale the new locator proportionally to 8, move it to 16 on the Y axis and rename it to locator1.
Duplicate the locator, and move the duplicate to 24 on the Y axis, to match the position of the circle. Rename it to locator2.
Now select Ctrl_Spine3, duplicate it, and scale it proportionally to 0.5.
Color the last duplicated Circle to match the color of it's locator and rename it to locator_circle.
Now select all of the created controls except locator1 and locator2, and go to Modify > Freeze Transformation (Options). In the options, select Translate Rotate Scale and then click on Freeze Transform.
Select Ctrl_Spine3, and holding down Shift select locator_circle. Now press P to parent them together.
Select locator_circle, and again holding down shift select locator2. Press P to parent them together.
More parenting! Select Ctrl_Spine2, hold shift and select locator1 and then press P to parent.
Now select locator2, hold shift and select locator1, Ctrl_Spine1 and Ctrl_Bottle. With all 4 selected, press P to parent. If you open the Hypergraph, it should look very similar to the image below.
Now with our controls in place and set-up, we'll start work on the joints. Select joint1, hold shift and select Ctrl_Bottle and press P to parent all of the joints to the main control, Ctrl_Bottle.
Select Joint4 and in the Channel Box select Rotate Y and at the top of the Channel Box go to Edit > Expressions to open the Expression Editor.
Add the following expression to rotateY and then click on Create :
Now select rotateZ in the Expression Editor and add/create this expression :
Select joint2, and then select rotateY in the Expression Editor. Add/create this expression :
Select rotateZ and add/create this expression :
Select Ctrl_Spine1 and shift select joint3. In the Animation menu select Constrain/Orient.
As you can see to the image below, rotating Ctrl_Spine1 correctly rotates the joints. Now it's time to repeat the process for the other controls.
Select joint6 and then select Rotate Y in the Channel Box, open up the Expression Editor as before, and add this expression to rotateY, remembering to hit Create when you're done :
Select rotateZ in the Expression Editor and add/create this expression :
Select locator1 and then in the Expression Editor select rotateX and add/create this expression :
Select rotateZ and add/create this expression :
Select Ctrl_Spine2, shift select joint5 and select Constrain/Orient from the Animation menu.
Select joint5, shift select locator1 and choose Constrain/Point (Options) from the same menu.
In the Point Constraint Options, select Maintain offset and Constraint axes (All) and click on Add.
As you can see in the image below, we can now rotate Ctrl_Spine1 and Ctrl_Spine2 separately, although the second is influenced by the first.
Now select joint8, bring up the Expression Editor, select rotateY and add/create this expression :
Select rotateZ and add/create this expression :
Select Ctrl_Spine3, shift select joint7 and select Constrain/Orient from the animation menu.
Select locator2, open the Expression Editor, select rotateX and add this expression :
Select locator2, then rotateZ in the Expression Editor and add/create this expression :
Select locator_circle, and add this expression to rotate X :
Select rotateZ and add this expression :
Select joint7, shift select locator2 and select Constrain/Point from the Animation menu.
Select locator1 and open the Attribute Editor (Ctrl + A). In the Object Display Panel turn off the Visibility. Now do the same thing for locator2 and the circle_locator.
In the Layer Editor, click twice on the middle box on our BottleLayer make the bottle selectable.
Select the bottle and, making sure you're viewing the Animation menus, go to Create Deformers > Nonlinear > Squash.
Select Ctrl_Bottle and in the Channel Box click on Edit > Add Attribute.
In the Add Attribute dialog, for Long name write Stretch Squash, in Data Type choose Float, in Numeric Attribute Properties insert a Minimum of -10 and a Maximum of 10, and finally add a Default of 0. Click on OK to add our new attribute.
Now we have our new attribute, we need to make it do something! In the Channel Box select Stretch Squash and go to Edit > Set Driven Key.
Select the Ctrl_Bottle and in the Channel Box click on our new Stretch Squash attribute. In the Set Driven Key window click Load Driver to add our Ctrl_Bottle in as our driving object. In the now-populated Driver box select Ctrl_Bottle and then Stretch Squash.
Now we need to choose the driven object. So select the Bottle and in the Channel Box select squash in the INPUTS section. Now click Load Driven in the Set Driven Key window to populate the driven section. Click on squash in the Driven Box and then select Factor. With our driver and driven attributes setup, we can now click Key to create our first connection.
Now select Ctrl_Bottle and set the Stretch Squash attribute to 10. Select squash in the OUTPUTS section of the Channel Box and change the Factor value to 0.7. Back in the Set Driven Key window, click on Key to create another connection.
Set the Ctrl_Bottle's Stretch Squash attribute to -10, select squash in the OUTPUTS section and change the Factor value to -1.3. Now create our final key by clicking Key in the Set Driven Key window.
Set the Stretch Squash attribute back to 0 and close the Set Driven Key window. Go to Window > Animation Editor > Graph Editor.
Select squash in the OUTPUTS section of Ctrl_Bottle to update the Graph Editor. Select all of the animation keys and press F to smooth them as you can see in the below image.
With that done, now select just the middle key in the Graph Editor and, using the bezier handles sticking out of the key itself, adjust the animation curve to smooth things out fully as you can see below. Close the Graph Editor.
Select the squashHandle and press Ctrl + H to hide it.
With our rig in place, and our squash/stretch complete, we now need to connect the rig up to the bottle geometry itself. Go to the front view and press 4 to switch to wireframe view. Select joint1 and Shift select the bottle.
In the Animation menu click on Skin > Bind Skin > Smooth Bind (options).
In the Smooth Bind Options windows set Bind to to Joint hierarchy, Max influences to 5, and then click on Bind Skin. Finally select Ctrl_Spine1, in the Channel Box, right-click Rotate Y select Lock Selected to disable editing for this channel, as it will be affected by our rig. Now repeat this lock for Ctrl_Spine2 and Ctrl_Spine3.
And that's it, you're ready to animate! Play around with the rig and see what you can come up with! I hope you enjoyed the tutorial, and if you have any questions just let me know in the comments.