Saturday, 13 December 2014

Lesson 5 - Skinning

With all the joints created for each part of the body, you can parent them together. 
  • Join the base of the spine to the top of the leg joints
  • Join the 2nd from top spine joint to the shoulders
  • Join the top of the spine to the base of the head

You'll have a complete skeleton! Now we need to attach weights to the skin so that the joints affect the correct part.
To begin with, select all the joints (This can usually be done by selecting the pelvis joint) followed by the mesh.Go to Skin > Smooth Bind and open the skin options and change to these settings.

Once you bind the skin, you can enter 'Paint Skin Weights Tool' by holding right click on the mesh to access the Marquee menu.

Here you'll get a tools setting window which looks like this:

In this window you can select the joints in the top part of the window. Once you do this you'll see white and black regions on the skin.

White = 100% weighted
Black = 0% weighted

It is possible to blend between these to change the percentage of influence.

The paint operations control how the brush or paint applies.

Replace = Removing previous weighting for new weight value
Add = Layers current weight value on top of the old weight value
Smooth = Blend weight values between vertices

The Value option is what current skin weight value you're using is. In the example it's 0 meaning black.

Here you can see an example of the weights painted on and how it fades from white to black at the end of the joint. In this case the influence is being changed on the Lft_Leg_Hip joint.

You can switch between painting black and white by holding Ctrl. Paint the weights onto the skin for each joint and you'll have a functioning rig.

Lesson 4 - Face

The head is a very simple part of the model. There are no IKs to do and it's possible to not need any SDKs either.

Start by create a neck joint that extends from the spine to the top of the head.


Then add a jaw bone and parent it to the centre joint of the neck seen below:


It's as simple as that! You can start adding in extra bones and parenting them back to that centre joint for elements of the face like lips and eyes as seen here.



There are two methods to go about editing the face. The one shown above is joints however another method is Blend Shapes. These take an edited copy of the mesh and the original and 'blend' between the states. For example...



Here are 3 stages of blending between blinks. The first image is what the original models eyes were like. The second image is the edited mesh on the duplicated model. Finally, the third image shows a blend between these. It's possible to link the blend to a controller and move anywhere between the two stages of blends.

While this is an easier way of going about creating animation, it's also very computationally expensive.

As stated, the other way of animating the face is joints and controls. An easy way to do this is to constrain an simple circle curve controller to the joint it will control.

 You can see an example of it here. The joint on the chin is constrained to the Y axis of the controller infront of it. When I drag the controller on the Y, the jaw will move too.


This process requires the mesh to be skinned. We'll cover this in the next post.

Lesson 3 - Spine

Much the same as the previous examples, the spine is a combination of IKs, Joints and Controllers. Some aspects have changed from the arms and legs so I'll explain the process in closer detail as we get to them.

Start by creating a spine using joints. Use around 6-7 joints in the chain starting from the pelvis heading up towards the spine. It might be easier to snap to the grid to make it straight.

It can be easier to visualise the spine by adding a mesh around the joints. In this case, I used a cylinder. Next we'll add an IK to the joints however we'll use an IK Spline Handle instead of a normal handle. Open the options tab and change the settings to these:


Place the IK from the bottom joint to the top. In the outliner you should now see a curve. Isolate the curve and right click it until you get the Marquee menu. Go to 'Control Vertex'. You'll now see 4 points across the curve.

Highlight the top two and go to 'Create Deformer > Cluster'. Do the same with the bottom two. You should see small 'C's on the curve. These are Clusters, they are useful for collecting objects to move together. Move the pivots of these clusters. The bottom cluster should be on the bottom joint and the top just below the pecs.

At this point, add the mesh around the spine. Just a cylinder will do in this case.

Now we'll skin the torso. This means making the bones affected certain parts of the mesh. We'll cover skinning in a later tutorial. For now go to Skin > Smooth Bind.

Create two controllers, attach them to where the clusters are pivoted. Freeze and name. Next, parent the clusters to the corresponding controller.

Add an attribute to the bottom controller called Twist. On the IK Handle is an attribute called 'Twist'. SDK this to the attribute (Have -10 and 10 as Min/Max values).

For the other controller, the cluster should be controlled by the rotation of the controller.

You should now have a spine that affects the mesh!

Lesson 2 - Arms

Many of the concepts in making the arm are similar to the leg. As such this will be a brief overview on how to use the same features for it.

First with the joint tool create an arm. Forget the fingers for now. Start with the shoulder, move to the elbow then the wrist. Remember to add a slight bend. Name these joints.



Next we'll add an IK however this time it will be a 'Rotate-Plane Solver' type. Open the option box on the IK Handle tool and set it in the drop down.


Set the options to the ones above and add the IK from the shoulder to the wrist. Now, add a controller (A simple circle curve with suffice) and snap it to the wrist. Freeze and name it then orient constrain it to the wrist joint.

Here we'll begin adding fingers. First, create a controller (It can look like a hand or just a text curve). This is what we'll add the finger controls to. Add an attribute for each finger (Little, Ring, Middle, Index, Thumb) with minimum at -1 and max at 10.

Create a finger using the joint tool. Each joint here relates to a phalanx bone. Parent the first joint of the finger to the wrist joint by pressing 'P'.


  
  
Now add a SDK to control the curve of the finger. Load ALL the joints of the finger as the driven and the finger controller as the driver. Now select the attribute corresponding to the finger you're editing (In this case it's the Index Finger).

Key the attributes value to the side rotation, in this case it's Z. Once the min/max is keyed it should be able to clench.




Lesson 1 - Leg

Now I'll move onto the character rig. I'll be demonstrating the setup separated from the character then showing how this was implemented at the end.

The first important point is to remember to set your tool set to Animation at the top left. Then on the Skeleton drop down menu select the Joint tool. This can also be accessed from the Animation tab on your shelf.

Start out by clicking where the start of bones would be in the shape of a leg. From the top you have hip, knee, ankle, ball and toe bones. It helps to do this in side view. While doing this try to add a bend in the leg, later on this will be important.



After this, orient the joints by going to Skeleton > Orient Joint. Set your options to these:


This sets the Y axis down the bone, the Z forward and the X sideways. This allows you to rotate along the X axis for the legs which is the same as the world axis.


Next, create a controller for the foot. Make it look like a foot, much the same as the car. Freeze the transforms and name it. We'll come back to this later.

Now we'll add IK handles. Again, go to Skeleton > IK Handle Tool or activate it from your animation shelf. Click on the hip joint then the ankle joint. You'll see a line connecting them. This means they are now in a joint chain. Do the same from the ankle to the ball joint and finally the ball to the toe joint. The reason we added the slight bend in the leg is Maya determines which way the leg bends and if there isn't enough bend, it can become confused and break the leg.


You should have a leg similar to this with 3 IK handles attached. Rename these handles e.g. IK_Ankle, IK_Ball, IK_Toe. Eventually you'll need to label these Lft and Rgt since you'll need two legs.

At this stage we need to group these IKs together so they function correctly with one another. We'll name these groups and move the pivots as this is where the controller comes into play. For this we'll assume you are starting with the left leg, if not adjust the prefix Lft to Rgt. 
  • With your Ankle IK selected, Ctrl+G to create a group and rename it to Lft_Ball_Lift. 
  • The second group is the Ball and Toe IK handles, group these together and name it Lft_Toe_Lift. 
  • The next group is the two groups you just made. Select both the groups and group them again. Call it Lft_Toe_Roll. 
  • Lastly, select the group the Toe_Roll group and group it again calling it Lft_Ankle_Grp
 This now means each IK has their own independent pivot. We now need to move the pivot point to the corresponding joint. Highlight a group and press Insert to move the pivot. Snap it, by holding V, to the joint labelled here.



Now we'll be adding the constraints from the controller to the groups. Point and Orient constrain the controller to the Lft_Ankle_Grp. Remember to keep Maintain Offset on.
Next add some attributes to the controller, like we did for the car. Modify > Add Attribute...
Add a Ball Lift attribute, set minimum to -10, maximum to 10 and default to 0. Then add a Toe Lift attribute with the same values.
Here we start to add in SDKs. For the Ball Lift, set the Driver to the Ball Lift attribute on the Controller and the Driven to the Rotate X on the Lft_Ball_Lift group we made earlier.
  • Key 0 to a standing position. 
  • Key 10 on Controller to the highest elevation you feel it should go to. 
  • Key -10 to the lowest.
Do the same with the Toe Lift. Driver is Toe Lift attribute on the controller and the driver is the Lft_Toe_Lift group.

Now by typing numbers in between your min/max values on the controller, you're able to move the leg.