Thursday, April 8, 2010

How to Rig a Stretchy Spine with Spline IK in Maya - Rigging Tutorial

This is a simple tutorial illustrating how to setup a stretchy spine with the maya Ik spline handle tool.

Step 1) Create a joint chain. I have created a chain of 5 joints, but any number of joints can be used. Now rename the joints and adjust the Local Rotation Axis.
















Step 2) Next we have to create the Ik Spline. Select Skeleton>Ik Spline handle Tool options and the Ik spilne options will pop up. Now select Auto Create Curve and Auto Simplify Curve.
Set the Number of Spans to 2.
Alternatively a seperate curve can also be used to drive the Ik Spline, but for this tutorial I have used the settings mentioned above.
















Step 3) Create clusters for the curve that was created by the Ik Spline Handle Tool. To do so select the curve, right click and select Control Vertex. Now select the bottom two CVs and create a cluster by going to Create Deformer> Create Cluster. Similarly create clusters of the top two CVs and the single CV in the middle resulting in overall 3 clusters. Create 3 nurbs circles to be used as controls to manipulate these clusters. Rename the nurbs circles and snap them to the position as in the image below.






























Step 4) Parent Constraint the controllers to the clusters with Maintain Offset checked. For this first select the controller then shift select the cluster and parent constraint. The Ik spline setup is complete and you will be able to manipulate the chain with the controllers but the only thing missing is the stretch so lets create that next.

Step 5) To create a stretching ability in the chain we must find the length of the chain as in the current/rest position. To do this we will create a curveInfo node on the Ik Spline curve. Select the Ik Spline curve and in the command line type the following
arclen -ch 1
This will create a curveInfo node on the curve with an attribute named Arc Length which gives the length of the curve.
















Step 6) Create a Condition node and a MultiplyDivide node in the hypershade found under the General Utilities tab. Rename these utilites.
















Step 7) Now to make some connections in the Connection Editor. To open the Connection Editor go to Window> General Editors> Connection Editor. Select the curveInfo node by typing the following in the command line select curveInfo1. Now load the curveInfo on the left side of the Connection Editor. Load the Condition node on the right side of the Connection Editor and connect the ArcLength to the FirstTem.
Similarly, connect the ArcLength to input1x of the MultiplyDivide node.

















Step 8) Set the second term of the Condition and input2x of the MultiplyDivide to the current length of the curve. Set the Operation in the Condition to Greater Than. Also connect outputX of the MultiplyDivide to ColorIfTrueR of the Condition.
















Set the Operation in the MultiplyDivide to Divide.
















Step 9)  Finally connect the outColorR of the Condition to the scale X of all the joints except the end joint or the last joint of the chain. Note that scaleX has been used since in my joint orientation the X axis points to the next joint (see image in step1).
















The Stretchy Spine with Ik Spline Handle is now complete.

6 comments:

shynu said...

thqs for this tutorials this was very help full to me.
can u please tell me how we can squash in this ik.

Koolhandmike said...

You are a scholar and a gentleman and any other accolade regarding the nature of such! Thanks a million!

Evan Perret said...

Set the second term of the Spline_CDN to 1 if you want the spine to squash.

If that didn't work then well... oops I guess.

Unknown said...

Excellent tut! Very simple to follow.

Unknown said...

Works great! If your joints scale on the last step (when connecting the condition node outColorR --> scale X), (which you do individually for each joint) ensure that in your multiply divide node, the input 2 x position is the same number as the input 1 x position. Worked great with Maya 2017.

川內孬 said...

Thank you for creating this tutorial. Unfortunately, I am unable to see your image explanations.