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.


Wednesday, 12 November 2014

Lesson 6 - Lights and Set Driven Keys

Finishing up the car, we are going to add some lights and control them through the use of Set Driven Keys or SDKs.

To start with, place some spotlights around the area where the headlights are and set the colours. White at the front and Red at the back. Now, create a controller for the light. I tried making mine look like a lightbulb.


On the controller, we want to add some attributes. In my case, I have Headlight Switch and Brakelight Switch although you could have more or less.

To add attributes, select the controller and go to Modify > Add Attributes...




Give your attribute a name that describes what it will do. Here it's "Headlight Switch" as it will control only the headlights being on or off. Forget everything else until the 'Min/Max' values. Here, put 'Min' as 0. This will be our 'Off' number. Set 'Max' to 1. This will be our on number. Default is the number you want it to start on. In this case, 0.

Add this attribute and now, in the Channel Box you should see your new attribute beneath all the transform information. Currently, changing this number doesn't do anything since we haven't linked it. We need to use an SDK.

Firstly, SDKs allow for an event to happen when another event elsewhere occurs. In the case of the light we will have them turn on when the attribute on the light_control is set to 1 and off when set to 0

Select the light_control and go to Animate > Set Driven Key > Set. This will open the Set Driven Key window.

You will have 'Driver' and 'Driven'. Since we want the attribute to control the light we need the control to be the Driver. Press 'Load Driver'
  

Now, we want to load the 'Driven'. In this case, the lights. Load the lights in as the 'Driven' by selecting them and clicking 'Load Driven'.

NOTE: By grouping the lights, you can set the visibility of the group to 'off' instead of the individual lights.
 
By default the Light controller is set to 0 so in the Channel Box, set the visibility of all the lights to 0. Now in the SDK window, select the Light_control's Headlight Switch and the Headlights visibility.


Press 'Key'. Next, set the light_control Headlight Switch attribute in the Channel Box to 1 and turn on the Headlights visibility. Key this again.

Now whenever you type '0' or '1' in the Light Control Channel Box, the Headlight group visibility will turn on and off creating working headlights.




Using all these techniques throughout the tutorial allowed me to add some smaller details such as the bonnet, boot and doors opening. See what else you can add.

Lesson 5 - Move Control

A move control is a controller that allows the user to move the entire rig and objects around without them seperating or breaking. This is useful when it needs to be placed in a scene or moved out of the way.

Start by creating a large controller under the car. This can be as simple as a square or circle. Don't forget to freeze, center and delete.

The large cyan arrows are the main control.
Next, in the outliner, highlight the wheel group, all the controls and then the main control. When parenting it's always Child before Parent which is why the main control is last.


Press 'P' to parent them together. The result should be as follows:






Finally, the Rear_suspension_control and Front_suspension_control need to be parented to the Main_suspension_control.



The final outliner should look like this.

Now when you move the main control, the whole car should move along with all the controllers. 

Lesson 4 - Suspension

The next stage is the suspension of the car. For this we will need a rear, front and full body suspension. Start by creating three CV curves and place them at the front, back and middle of the car to act as the controllers, remember to make them look like the action they control. In this case I used double headed arrows.

Next group the geometry of the car (minus the wheels) twice. You should now have 3 groups for the car like below:


The highlighted groups are the body geometry. Notice the wheels are seperate.


Rename the groups similarly to how they are in the example. To make it so the car rotates when the controller is translated up, we have to use an expression.

Select the "Front_suspension_group" and open the Expression editor (Window > Animation Editor)  then select the "rotateX" attribute. Add the following expression:

Front_suspension_group.rotateX
=
Front_suspension_control.translateY

;

It should look like this:


What does this do? This links the "Front_suspension_group" with the "Front_suspension_control". Furthermore, it states that when the controller translates on the Y axis, the group will rotate on the X.

Do this for the rear suspension too.

NOTE: One of your suspension controllers will rotate the car when moving down the Y instead of up. To fix this add *-1 as seen in the above example. This will reverse the direction.

Lastly, we need a controller for the full body suspension. This is a simple point constraint from the main_suspension_control to the Body_grp.

Don't forget to limit the controllers if you need to.

Locking Controllers

Limitting controllers allows you to control how far a controller will go before it stops meaning it can be restricted. Locking controllers is different.

Locking allows you to disable certain axis and tools from being used allowing you to essentially block anyone from breaking the rig by doing things they aren't supposed to.

To lock a controller, click it and go to Window > General Editor > Channel Control. Switch to the Locked tab at the top and in the Non-Locked section find anything you want to restrict.


Here, I've selected the main_suspension_control  and since it only needs to move on the Y to control the suspension, I've chosen to lock the Rotate and Scale tools and also the other translate axis. This now stops you from moving the controllers.

Keep in mind. This will also lock you out so make sure you do this at the end of the rig.
 

Wednesday, 22 October 2014

Lesson 3 - Tyre Controls

The first part of the rigging process on the car is to make sure everything is named in a way that an end user would recognise the pieces. The end user can then use the outliner to quickly select the pieces they need should they have to.

Clear naming scheme allows users to know each groups contents.

 
After naming the groups, create three controllers using the CV Curve tool. One will control suspension on each tyre (4 total), one controls the steering on the front two tyres (1 total) and the last will control the rotation of the front and back tyres (2 total). Try to make the curves look like the action they will be doing as shown below:

Don't forget to freeze transforms, delete history and center pivots.

Be sure that the pivot for the wheel group are at the center of the wheel (on the axle). Using two orient constraints on a single tyre overwrites the previous orient therefore the workflow for the wheel is a little different. First, select your steering controller followed by the tyre so both are highlighted. Then in the Constrain menu, add a normal 'Orient' constraint in the 'Y' axis. Be sure that Maintain Offset is ticked.

The wheel should now turn when the controller is rotated in the Y axis. Next, select the drive controller and then the wheel again. This time use a 'Parent' constraint. This allows you to use two orients and the same time. Parent the rotation to the 'X' axis and untick all other Translate and Rotation boxes.


The wheel can now rotate and turn without overlapping each other. The last stage is to attach a Point constraint to the suspension. Select the suspension control and then the wheel and attach a 'Point' constraint in the 'Y' axis. The tyre can now move up and down when you move the controller.

The final stage of the tyres is to limit the controller. This stops it moving after it reaches a certain point. To limit the controls movement, go to the attribute editor and look in 'Limit Information'. Find the action needed to move the controller (In the example I use the steering controller meaning I need to limit the rotation) and enter 'Min/Max' values. Current should be set to 0.
Now if you try to rotate the controller past 45 degrees either way, the controller will stop and the wheels won't move past it either. Later we'll lock the axis so they can only be moved in the desired direction.

Repeat the rotation process for the 2nd front tyre and put the suspension and drive on the rear tyres.

Sunday, 28 September 2014

Lesson 2 - Constraints

Constraints are similar to parenting objects however, whereas a child will inherit all movements of its parent object, with constraints the object will only take on the movement of the type of constraint. For example, orient constraints make objects inherit rotations. Point constraints are for translations. Scale constraints are for scaling.

For the most part, we will use point and orient constraints.

Above is a simple test of constraints. We have two orient constraints on each tyre attached to two controllers. These controllers allow a user to grab and manipulate them in order to move the objects.
One orient controls tyre rotation and the other controls steering.

The controllers can be drawn using CV Curve Tool (Create > CV Curve Tool).


Start by making two tyres and put each one in its own group. Move the GROUP pivot to the middle of each tyre respectively. To do this open the outliner, click the group and press 'insert' to move the pivot. Press 'insert' again when it's in the right position.

Next, draw a double headed arrow controller using the CV Curve Tool. This one will be used to control steering.

 Select the controller followed by either tyre, in this case I'm highlighting the left tyre, then open the Orient Constraint tool menu (Animation tool set > Constrain > Orient > click the small box).

You want 'Maintain offset' on otherwise the object will move itself. Set 'Constrain axes' to 'Y' as we want to turn the tyre only on the 'Y' axes. This means if we rotate the controller any other way than 'Y' it won't affect the tyre. Apply these settings.

Notice the red exclamation point in the outliner. This is your constraint. If something went wrong just click it and press delete and try again. Now when you rotate the controller on the 'Y' axis, the tyre should move with it. Do the same with the right tyre so they both move together.

Try doing this for the tyres on the 'X' axes now which will allow the tyre to rotate forward and back.