This Cyber Monday Envato Tuts+ courses will be reduced to just $3. Don't miss out.
Building and texturing a model could be the end of the journey for most game assets. If you're creating artwork for the environment, props or essentially anything which is lifeless and doesn't need to deform, the first four parts in this series will be all you need to focus on.
That is of course until you come to generate the Level Of Detail models (LODs), but more on those later in the series. However, if you are working with something more organic, or which needs to move and emote, there is much more you can do.
In part five of this series you will take the Kila model you have lovingly crafted so far and give her the ability to move. To do this you will first create and configure her base skeleton before attaching it to the model, allowing it to then drive her movements.
1. Skeleton Limits
Yep, here we go again, another technique which comes complete with even more restrictions. I'm sure you are used to them by now as each stage so far has involved working within specific limits, be them polygons, pixels or UVs.
This time it’s the skeletal joints, and not just the amount you use, but also how they are handled by the game engine. The more joints you use the more data is then exported, this then has to be stored and used by the game engine. This goes even further if the joints are animated, and even the number of vertices each joint influences will have a hit on memory and processor power.
The number of joints you choose to use in your character comes down to what they are going to do, and how they will be seen in game. A hand is a good example of an area where joints can be easily sacrificed if needed.
- A character that is to be close to the camera and also be expressive will require a fully poseable hand. This will usually consist of around fifteen joints meaning each finger as well as the thumb, can be moved individually.
- If the hand only needs to achieve a few basic poses, this number can be reduced to ten joints by making the middle, ring and pinkie fingers all use the joints of a single finger. This is most commonly used with the “mitten” style hand model.
- The lowest extreme would be to remove all the finger joints leaving you with just a wrist. This would be useful on characters who are far from the camera, or whose hands do little movement.
Each vertex on your model can be driven by a number of joints at any one time. The amount of joints affecting each vertex can be dictated when you come to connect, or Bind them to each other.
The more joints influencing each vertex, the more data needs to be stored, so it’s important to only use what is needed.
The elbow for example only needs to be influenced by two joints, the upper and lower arms. Any more influence in this area could be seen as a waste, or even be too subtle to see.
One more area to consider is how each joint can be animated, or more to the point, which attributes can be exported and used by the game engine.
Traditionally the rotation of each joint was all that could be used, so this had an influence on how the skeleton was constructed to achieve the best movement.
These days all of the major attributes can be exported, so Translation and Scale are also a factor. With this in mind you could use these to your advantage to simplify areas, or even enhance the way the character animates.
It’s a good idea, before you commit yourself to a hierarchy, to check which attributes can be used in the engine.
2. Build the Base Skeleton
Just like the anatomy of any creature, be them real or fictional, Kila will need a main skeletal structure which will be the driving force behind her movements. This skeleton will control the rotation and position of each section of her body, so each bone, or joint as they are called, has to be in the correct place for the best possible movements.
With that in mind, and remembering any joint limits which you may need to work to, let’s start building.
- Go to the Skeleton > Joint Tool and open the options.
As you can see there are many areas you can adjust to tailor how your joints are created, but for now leave the values at their default settings. We will come back to the Orientation Settings later in the tutorial.
- In the Side viewport, use the model as a guide and place seven joints running from her pelvis up to her head, just below her ear.
- Place an eighth joint out in front of her head.
- Make sure you rename these joints appropriately, so from the first call them Root, Base_Spine, Mid_Spine_01, Mid_Spine_02, Upp_Spine, Neck, Head and Head_Tip.
Next create the joints which will represent her limbs.
- Still in the Side viewport, add five joints for her left leg, calling these L_Hip, L_Knee, L_Ankle, L_Ball and L_ToeTip.
- Now switch to the Front viewport and edit the position of the new leg joints, so they lie down the center of the leg geometry.
Tip: The best way to edit joint positions at this stage is to press the Insert key. This will allow you to manipulate them independently of their hierarchy, making adjustments easier.
Note: It’s important that the leg is straight when viewed from the front, so the knee lies in-between the hip and ankle. This will ensure the leg bends correctly when we add the rig in Part Six.
- Do the same for the arm now, placing four joints down its length while in the Front viewport. The arm should begin with the L_Clavicle and then include the L_Shoulder, L_Elbow and L_Wrist.
- Switch to the Top viewport when the initial placement has been made and adjust the joints positions so they lie down the center of the arm model.
Note: It’s important to keep a slight bend in the elbow of the arm, don't be tempted to build it completely straight when viewed from above.
At this stage you could also include two more joints in the arm, as shown below. These are the Bicep Twist and Wrist Twist joints which allow the arm to rotate or twist at the correct areas.
If you rotate your own wrist, you will notice that the actual rotation isn't restricted to the wrist area, it gradually blends up the forearm as your Radius and Ulna bones move around each other. The same can be said of the shoulder, with the arm twisting more around the bicep than the shoulder.
Adding these joints will allow you to mimic these rotations, but it’s important they lie directly in between their child and parent joints. If not, the twist will cause an offset making the arm look broken.
Below I have added a section of MEL script which will speed up this process for you by working out the position between the two selected joints and adding another for you.
string $selJnt = `ls -sl`;
string $ins = `insertJoint $selJnt`;
float $position = `joint -q -r -p $selJnt`;
joint -e -co -r -p ($position/2) ($position/2)($position/2) $ins;
rename $ins "NewTwist";
- Simply copy this into your script editor, select the two joints which will be either side of the new one and execute the script.
- Remember to rename your new joints afterwards.
Note: Before adding these joints be sure you can allow for them in your overall budget.
With the arm complete, you can now continue on to add in the joints for the fingers. Simply repeat the same process which you have used so far.
- Create and position each joint so it lies at the knuckles, meaning the fingers will bend correctly. Don't worry about how they actually rotate for now, position is key.
Tip: Remember to use the Insert Key to move each joint individually, without it effecting its hierarchy.
- Once complete you can now parent the L_Clavicle joint to the Upp_Spine joint, and then parent the L_Hip joint to the Root joint at the base of the spine.
This will give you the center and left side of the skeleton but don't worry, the right side can be created quite easily with the help of the Mirror Skeleton Tool. But before you do that you need to attend to each joints rotational axes.
3. Rotational Axes
Placing and positioning your joints is just the first step in the skeletons construction. Each joint you created will have a Rotational Axis which will need your attention before you proceed.
The Rotational Axis is essentially the joints main pivot and dictates how a joint will rotate around its main axis. By default, Maya will direct the X axis down the bone towards its child joint while attempting to point the Y axis up and Z axis forwards. Unfortunately these can easily become misaligned when joints are being manipulated after their initial creation, which can lead to unpredictable rotations.
With that fresh in your mind let’s look at how to edit your Rotational Axis.
- To make the Rotation Axes visible, and therefore editable on your skeleton, first select the Root joint and then the full hierarchy by going to Edit > Select Hierarchy.
- Now go to Display > Transform Display > Local Rotational Axes.
With the axes visible, you should now be able to spot any trouble areas, but what you might find is that most appear to look good already. It’s still important to go through and double check to make sure, especially in areas like the hand, spine and wrist. Even a slightly misaligned axis can cause havoc later in the pipeline.
To quickly fix and adjust the Rotational Axes you can use the Orient Joints Tool.
- First go to Skeleton > Orient Joints and open the options.
These options may look familiar to you because they also appeared in the main Joint Tool. What this tool allows you to do is go back in and edit each joint's rotation axis, either on an individual basis or throughout the skeletons hierarchy.
Let’s work through a few key areas to get you started.
We will use the default settings for now, but keep in mind that the Primary Axis is the axis which points down the bone, and the Secondary Axis will attempt to point up.
- First, select the Root joint and then click Apply in the Orient Joint Options window. This will reset the joints, giving them all the same settings, while also fixing any which have become misaligned.
Note: By default the Orient Joint Tool will also work through the skeleton hierarchy.
- With the Root still selected now add the spine, neck and head joints to that selection.
- In the Orient Joints Options window, check the box marked Orient Joint to World and uncheck the Orient Children of Selected Joints box.
- If you now click Apply this will reset the Rotational Axes of just the selected joints.
The clavicle and arm should be fine, but if you look at the wrist, the X axis has become a little confused about which joint to point down. If this were now rotated, the hand would tilt the wrong way.
- Select the wrist and with the same settings reset its Rotational Axis.
- The rest of the hand should be OK, but to be safe quickly rotate each digit to ensure it moves in the right direction.
Note: Remember that your thumb doesn’t rotate around the same plane as your fingers. Instead this should curl under the palm of the hand when rotated.
Finally we come to the leg and you will see that the default axes are a little off on the hip and knee. Remember, we want the Z axis to point forwards, so as you rotate the leg it bends forwards and backwards.
- In the Orient Joint Options window, go to the Edit menu and Reset the options.
- Now set Secondary Axis and Secondary Axis World Orientation to Z and click Apply.
- Finally select the Ankle joint and change Secondary Axis World Orientation back to Y and click Apply.
The axes on the skeleton have now been adjusted and realigned so each joint will rotate as expected. The way you configure your axes is of course up to you and you may want a different approach, but as you can see using the Orient Joint Tool gives you a quick and easy way to edit each joint.
4. Rotation Orders
With your Rotational Axes realigned, it’s now time to look at your Rotation Orders.
The Rotation Order controls the hierarchy of your three axes. By default, Maya arranges them using the XYZ setting which gives priority to the Z axis. What this means is if the Z axis is rotated, the Y and X axes will move with it. If Y is rotated only the X axis will follow, while rotating the X axis will have no effect on the other two.
Changing the Rotate Order can help to reduce Gimbal Lock which occurs when two axes become aligned. As you can see in the example below, rotating the Y axis has caused the X and Z axes to almost overlap.
The Rotate Order attribute can be found on most objects in Maya under the Transform Attributes tab in the Attribute Editor.
For the majority of your joints the default setting should be fine, in fact you may feel you don't need to edit this attribute at this stage. It is always worth checking though to see which axis will be used the most on each joint.
Note: While doing this you should change the Rotate Mode under the Rotate Tool to Gimbal.
Obvious joints to adjust are ones which will only be animated around a single axis.
- The new Wrist and Bicep Twist joints you added earlier will only rotate around the X axis, so change the Rotate Order on these to YZX. Now when X is rotated the other axes turn with it.
- You can do the same with the elbows. These will need to have their priority set so Y is the dominant axis, so use ZXY or even XZY.
We could go through and list suggestions for each joint, but the best way to judge which Rotate Order fits with which joint, is to go in and play around with them. Test each joint, rotating as they would if animated, and configure them to suite your own personal needs.
5. Mirroring Joints
That’s one side of the skeleton complete, so now let’s quickly create the opposite side to make it whole. Fortunately this is easily accomplished with the help of the Mirror Skeleton Tool.
- Open the Mirror Skeleton Tool’s options by going to Skeleton > Mirror Joint.
- Set Mirror Across to YZ as this will mirror the selected joints from +X to –X, so from left to right.
Mirror Function will dictate how each joints orientation will be treated.
Behavior will mirror the joints while also inverting their orientation. Which in this case will keep X pointing down the bone, which is what you want.
Orientation will retain the exact same rotational axes as the source joints.
- Set Mirror Function to Behavior.
- In Search For put L_ and in Replace With type R_.
This will search for L_ in each joints name and replace it for you with R_ eliminating the need for you to go in and manually rename each joint.
With the options set you can now start mirroring.
- Now select the L_Clavicle joint and click Apply.
- Finally select the L_Hip joint and click Apply again.
What you now have is a full skeleton, but before you continue I would advise double checking the Rotational Axes of the newly created joints, just to make sure they are correct, as sometimes they can become misaligned when mirrored.
Now the base skeleton is complete, feel free to add in any other joints you need. For Kila also include a Jaw bone, a joint for each eye and also one for each breast. This will allow for a little more flexibility when animating. If you're feeling brave, why not also add a few joints for her tongue?
6. Attach Your Skin
With the skeleton ready it’s now time to attach it to Kila. Binding the mesh to the joints will allow it to deform, following each joint as it is manipulated.
Attaching a mesh to a series of joints is easily done, first you need to select the joints.
- Select the whole skeleton hierarchy, leaving the joints at the end of the fingers, toes, head and chest.
Note: Remember you are working to a tight budget, so don't select any joints which won't actually influence the mesh.
- Add the Kila model to the selection and go to Skin > Bind Skin > Smooth Bind and open the options.
There are many options to play around with here, and if you are using a recent version of Maya, I would suggest you try the Heat Map Binding Method. With that said, you may want to keep Kila's hair as a separate model as the Heat Map won't play well with the geometry in that particular area.
For this tutorial we will stick to the basics to cover most versions of Maya.
- Set Bind To to Selected Joints.
- Set Max Influences to 2, restricting how many joints are able to influence each vertex.
- Adjusting Drop-off Rate to 10 will give you a tighter falloff, which is easier to work with.
- When done simply click Apply to bind the skin.
You can now quickly test the bind by rotating the joints. If the model deforms then the bind was a success, but don't worry if the model stretches or looks wrong, you can address that next.
7. Paint Skin Weights
Now that Kila is moving with the skeleton you have probably noticed that some, if not most areas are not deforming well. Just rotate her head, jaw or even her shoulder and you will see she soon becomes some hideous creature.
This is because all you have at this stage is a default bind, so Maya has applied a very basic set of weights to each joint. It’s now your job to go in and edit these weights so she deforms in a much more natural way.
- Select the Kila model and go to Skin > Edit Smooth Skin > Paint Skin Weights and open the options.
The window you are presented with may look a little intimidating, but don't worry. You will only be using a small selection of these options for now.
You will also notice that your model has turned black, with a white or grey area around a specific joint. What this is showing you, is that joints influence on the model. The whiter the polygons the greater the influence it has.
By working your way through each joint you can interactively paint the way each influences the model.
Let’s see this in action.
You can select which joint to work on in two ways, either through the Influences tab in the Paint Skin Weights Tool, or directly by Right Clicking on the joint in the viewport and selecting Select Influence.
- Using either option, select the left shoulder, or L_Shoulder joint.
At present you can see the influence, but not really how the model is deforming when this joint is rotated.
- Take a step back and rotate the shoulder, lowering it slightly.
Now you can see that the side of her torso, beneath her armpit is collapsing, so it needs fixing.
- Select the Kila model again, and go back to the Paint Skin Weights Tool.
Note: It’s important to state that there are many ways to approach painting or editing weights in Maya, so I would urge you to play around and see what works best for you. Below is just my preferred approach.
- Under Tool Settings select a softer brush next to Profile. This will allow you to paint in a more gradual way, building up the influence slowly.
- Skip down to Paint Operation and set it to Replace. This will simply overwrite the values with each stroke.
The Opacity and Value options aren't fixed and you will need to adjust these as you work.
Value is the maximum amount the brush will paint. 1 is fully influenced, 0 is no influence. You can vary this with Opacity which will paint a percentage of Value. This way you can gradually paint in an area to work up the influence, rather than it being a defined value.
- Set the Value to 0 and Opacity to 0.5.
- Now paint under the arm, releasing the influence the shoulder joint has on these vertices.
- Set the Value to 1.
- Next select any other joints which may be effecting this area and rework their weights. In this case they will likely be the L_Clavicle and Upp_Spine joints.
- Continue to work on the area, filling out the upper torso and also softening the shoulder to achieve a better looking deformation.
Tip: Make sure you keep going back and changing the pose of the joint you are working on to ensure the weighting works in all situations.
As you can see the process for adjusting weights is quite simple, so repeat these steps to rework the weighting, concentrating on just the left side of Kila.
You can see another example of this below, where we have correctly weighted the head and jaw joints.
8. Input Skin Weights
Interactively painting the weights onto the model is an intuitive way to adjust the values on each vertex, without having to go in and manually input those values.
Unfortunately there are times when painting just won't work, and in some situations you need definite values so you know just how much a joint is influencing those vertices. This could be to gain control, or a rouge vertex which the brush just won't touch, or to simply lock an area to a joint, and remove all other influences.
The eyes are a good example of this.
- Select all the vertices on Kila's left eye.
- Go to Window > General Editor > Component Editor.
- Select the Smooth Skins tab along the top.
What this is showing you is how much each joint is influencing each vertex, so in this case, the Head, R_Eye and Tongue_Main joints are also effecting the eye model.
- Under the L_Eye column, change all the values to 1.
You will see that all the other influences have now vanished, meaning the L_Eye joint is the only joint influencing the eye geometry.
9. Mirror & Cleanup
Once you are happy with the weighting on the left side of Kila, you can simply copy this across to her right side, essentially meaning you only need to do half the work.
- Select the Kila model.
- Go to Skin > Edit Smooth Skin > Mirror Skin Weights and open the options.
As you can see, there are a few options as to how you project the weighting information from one side to the other. The default settings are usually good enough for a character like Kila, who has almost symmetrical geometry and a fully symmetrical skeleton.
- Simply click Apply, and then check your models weights.
Note: It’s important to check the weighting to make sure it’s been mirrored correctly. Also investigate the center of the model for any weighting irregularities.
Now the skeleton has been built, and the skin weights adjusted you should have a nicely deforming model. Before you move on, you should quickly clean up the scene and your weights to ensure no rogue values have gone astray.
- Select the Kila model once again.
- Go to Skin > Edit Smooth Skin > Prune Small Weights. This will eliminate any tiny values which may be lingering on your model.
- Now go to Skin > Edit Smooth Skin > Normalize Weights. Again, as a final step this will ensure each weight is locked between the values of 0 and 1.
When Kila is exported to a game engine and stray weights may be stripped out, or simply ignored meaning those vertices will look incorrect in game and may even end up being influenced by a random joint.
Doing these last checks could eliminate these issues early on.
So, Kila now has her very own skeletal system so she can be posed and animated. The problem is animating her in her current state could be a nightmare, especially if you need to plant her feet or pose her fingers.
In Part Six we will continue preparing Kila for animation by building a fully functional character rig. This extra layer of controls will work on top of her skeleton making animation easier, and much more intuitive.