Simple Game Rigging
This tutorial is for people that already know a little about rigging. I won't cover everything here.The goal of this tutorial is to show you how to make the most simple of simple game rigs. This set up is by no means perfect. What it is though is very simple to make, and it will cover the basics for those of you not completely familiar with rigging just yet. In making rigs your goal is rarely ever to make it perfect.Your goal is to get it to do the job needed as quickly as possible. Some times this is per a shot or per an action even. While this rig may not be the easiest to use necessarily, it does the job for animation as well as teaching you in this case.Remember. I don't have all the right answers. Often there isn't just a single right answer. The right answer is what ever works. The best I can offer is suggestions towards solutions.
Skills we will cover in this tutorial:
- How to set up your file.
- Joint Placement Procedure
- Orienting the Local Rotation Axis (LRA) of joints.
- Positioning and Displaying selection handles.
- Skinning procedure
We'll start off using this model. You can download a copy here if you like to follow along. There is also a finished rigged version you can download at the end of the tutorial to see the results.
I usually start off by making sure my model is set up the way I like. While this isn't something you don't have to do to make a rigged character, these are steps I find help. You can see my model in this case is symmetrical. The edges down the center line right up, and I've centered the model along the Z axis. I've also put the feet to the origin of the Y axis. I've scaled the model to the size I want it as well. These few steps can make things easier in the long run.
I'll start off by making 6 joints up the center of the model in the Front view starting at the hips. I'll grid snap these in X. As a rule when I place joints I never rotate or scale them into place. I only translate them into place. This ensures I have a clean rotation and scale when I start skinning and can easily reposition everything back to 0 and back into the original bind pose. If you had rotations on the rig when you started skinning, if you ever need to get back to the bind pose for some reason to make adjustments, you would have to know what position those joints were originally in when you first skinned.
Now don't think I just randomly decided 6 joints were a good number of joints. These joints were chosen and placed specifically. Starting in the center of the hips I place one joint for the Center of Gravity (COG), then one right above that for the twisting of the hips. The next one up is for the twisting of the torso. The one above that for the base of the neck and shoulders. Then one more joint for the neck, then the base of the head and then we end at the top of the head.
If this was a more complex rig, with a more realistic spine and IK, I would make it sCurve like a real spine would. But since it's FK I'm going to keep the spine straight from the sides. This will make it easier to twist the body while animating. If we had a sCurve spine, if we twisted the torso in X it'd twist the body at an angle, tilting it back at the same time.
Next we'll make 5 joints in the side view for the leg. One for the hip, one for the knee, heel, ball of the foot and toe.
If you now look at this joint chain in the front view, you can see that it was made down the center. Now position.
Keep note of how straight the leg is. If the leg isn't in too much of a straight line the legs may not bend the way you expect them too.
Next, while still in the front view we'll make 5 joints for the arm. One for the clavicle, one for the shoulder, one for the elbow, then the forearm then the wrist.
Next I position the joints in the perspective view, with the model in wire frame. I tend to just go into perspective rather than placing them in the orthographic views because I can get a better sense of their placement from all angles floating around the model.
As you can see in the next image I place the wrist joint right on top of the forearm joint. This isn't something you have to do. This is something I do so we can make the forearm be able to twist, but have the wrist bend independently of the geometry of the arm. If you use the same joint for both bending the wrist can collapse the arm on simpler models. I find you can often get away with only one joint on simple models like this. But when it comes to higher poly models I pretty much always need two joints, if not a third joint in the middle of the arm to better transition the twist.
Next in the top view we'll place joints for the hand. Of course there's a joint for each joint in the fingers. There's also a joint for each finger near the base of the hand to accommodate the spreading of fingers and cupping of the palm. Most people seem to neglect these joints in the hand.
Again, we'll have to place these in the perspective view.
Next, we'll parent the joints for each finger chain under the wrist joint we made earlier on the arm.
As well as attaching the fingers to the rest of the skeleton, we'll attach the arms and legs too. Parent the hip joints of the legs under the COG and parent the clavicle under the shoulder joint of the spine.
As you can see we're only building one side of this rig right now. There's no reason to spend time building two sides of a symmetrical character. After we properly set up one side of this rig we're going to mirror over the other half.
For this character I'm going to rig up the ears as well. These joints will be parented to the top of the head.
Orienting the Local Rotation Axis (LRA) of joints.
The LRA of a joint it the way the Rotate gimbal will be oriented on the joint. If you've ever used a rig where say the y axis didn't quite bend the knee the right direction so you had to use multiple axis' to rotate a hinge joint one direction, it's likely because the LRAs were never oriented. By default when you first make and place a joint, the LRAs are oriented. This usually means that the X axis of the joint is aimed at its child. But if you later translate those joints to reposition them, the LRAs stay aimed where they were. You can only position LRAs through rotation.
To see the LRA of your joints, first select the joints, then go into component mode and turn on the "other" filter (the one that looks like a "?")
We can now select and modify the LRAs while this is turned on.
This is a close up shot of the arm below. You can see how the X axis of the shoulder isn't aimed at the elbow. We want to aim the Z axis towards the child of each joint for the whole skeleton. There's an easy way to do this, but we need to be back in object mode for a second to do it.
With the COG selected we're going to select Orient Joint from the Skeleton menu in the Animation set. This will aim all the LRAs like how we want.
So now at least any hinge joints we have will bend on a single axis. But we want just a little more logic to our rig. Like say all our hinge joints bend on the Y axis. Let's look at the leg in this case. Here I have Z facing one direction in the knee and facing another in the heel. So next we're going to rotate all these LRAs so they're oriented the same way. In this case Z facing forward or up, and Y to the side. Make sure to have your rotate tools settings set to Local.
So once you've gotten all you're LRAs oriented the way you want we can go ahead and mirror the other half. We'll start by selecting the hip and mirroring it first.
Depending on which direction your model was built and placed and which direction you chose to orient your LRAs (Y up or Z up) your settings in here may change some. You may have to play around with it to figure out which is the right mirror axis for you're case.
You can see after mirroring the new side has it's LRA's reversed and the X axis is aimed away from its child. We'll have to reverse them back by hand (We could use Orient Joint again, but then we'd still have to rotate the LRAs by hand again to get Y and Z pointed the right direction.) So we'll use the MEL script for rotation to get a precise rotation back into place.
Select each of the LRAs you want to rotate and use the script rotate-r -os 0 -180 0;Think of the numbers as rotate -r -os xAxis yAxis zAxis; In all honesty I'm never too keen on which direction to rotate them back. It may be Z it has to be rotated back. You may need to rotate Y 180 then Z another 90 after that. What ever it takes to get it looking like the other side again.
When you're done you should have a rig that looks something like this. Notice how all the Y and Z face the same way. Yes the body does seem oriented differently than the arms. But think of how it'll look with the arms down to the side.
Next in the side view, we're going to build the last of the joints for the nose and the tail.
Again, the LRAs in the tail and Nose need to be adjusted.
So myself not being the biggest fan of FK rigs, I'm going to add a little IK to this rig for the legs and arms.
We have two types of IK we can use in this case. SC and RP. SC IK is Single Chain Inverse Kinematics. This is fine for something like a toe or some other single stretch of joint. But what we have here is a chain with something like a knee or elbow in the center we need some control over. Otherwise when we bent an arm we'd have no control over which direction the elbow pointed. That's where RP IK comes in.
Rotation Plane IK controls that middle joint. It makes a rotation plane which is like a dial. Where ever that dial points, those in between joints will point. That's the type of IK we'll use.
With the IK tool activated click on first the shoulder then the forearm joint.
Make an IK for each arm and the legs. It should look something like this.
So a simple rig like this is great and all. But you really want to be able to animate it with the skin on. The dilemma is you can't select the joints if the skin is over them blocking them. Sure, you could put the skin on a layer and set it to render only but you still can't see the joints and where they are to easily select them. We'll start on the tail with one of the joints selected.
We're going to go into component mode again and turn on the "Marker" selection mask. The one that looks like a "+" We can now see and move the selection handles.
Select the selection handle and move it up (preferably some where outside the skin of the model).
You'll notice if you go back to object mode you still can't see the selection handle. We have to select each joint and turn them on in the display menu to see them in object mode.
Place and display all the other selection handles. Place them all where you can easily select them outside the skin, but still associate them with their corresponding joints.
Here's what you should end up with.
Next is a big pet peeve of mine. Naming your components. You may be the only one working on this character in this case, but it won't always be the case. Often other people have to work with what you built. Often you have to go back and modify something you made a month or two ago. Naming things in a way that you or others can easily identify quickly makes a world of difference when it comes to getting anything done. Here is an example of my outline before and after naming all my components.
Skinning: This is typically the process I use for skinning. For a simple rig like this I could just select the cog to select all the joints and select the skin. But I prefer to select each individual joint. The reasoning behind this is when I build more complex rigs there are disjointed limbs and joints in the hierarchy not meant to be skinned to but rather drive other joints. So in this case this is more a matter of habit than necessity. So, working my way up the outline I select all the individual joints, and then finally the skin.
Next, we'll smooth bind the skin to the rig. Lets start with the skinning options first.
So since we have each joint selected we're going to set to Bind to Selected Joints. We're going to skin the geometry to the Closest Point in Hierarchy. 4 joints max will have influence over any vert. And the automatic fall off rate it will assign is 2.5 for now. Drop off rate in this case isn't all that important. It tends to help out more on high poly models. Low poly models are so manageable though that we'll most likely repaint everything by hand.
So next we'll edit these skin weights by painting them on. Select just the skin and let's open up the Paint Skin Weights Tool.
Text and pictures can only explain so much in this area. I'm going to use the tail and some of the head as a general example of what I'll do for the whole thing. You can see the various joints are listed here. Again, this is another good example of why it's important to name everything in a scene. You can see if I'm in wire frame I can see what joint I have selected in my paint menu if I'm unsure. To paint weights I'm going to use a solid brush with no feathering. My Paint Operation is set to Replace so I know for sure what I've added to each vert. Opacity will be all the way up to 1.
A little pointer on painting skin weights. Using your value and the replace option on you can either paint less weighting or more weighting to a vert. Each vert can only have a grand total of 100% weighting to any joints. So if jointB has 70% weighting, and jointB has the other 30% weight, if we decide to repaint jointB to 45%, it has to take that extra 15% from somewhere. So it would take that 15% from jointA, so we would have 55% weighting on jointA and 45% on jointB.
But what happens if we instead try to paint less weighting? Is we paint 25% less than what was there, how does it decide where to go? In all honesty it's not very predictable. It could put it on any of the near by joints, it could evenly spread it across other joints weighted to that vert, or it could do nothing with it so that vert isn't weighted at all 25% and sticks in space.
The same predictability becomes hard as well if say you have five joints weighted to a vert. Joint A B C and D. What if you want to take 10% off of joint D and add it onto joint A? You could try painting on the extra 10% to joint A, but how does it know which joint to take it from?
If you're trying to be specific, you can see how things get tricky. The good news is you rarely have to be specific. It's simply about painting what looks good. But having a little understanding of how the tool is working does help make things more predictable. The approach I tend to take towards it is much like painting. Block everything out fairly solid, and then smooth out the shading from there.
So what I'll do is start off by painting areas with a value of 1. Sometimes a little bit farther even than I want. After that I'll paint the verts in between the joints. Say I paint a middle edge with 50%. I know I've added 50% to one joint and took 50% from the other. From there I'll keep working my way out lower and lower in value. The most predictable way I've found to paint weights is to only replace weights and to only replace with a value higher than what was there. If you mess up, try to use the undo command rather than fix things by hand and repaint them yourself.
Make sure as your going to put your rig in the various posed it'll need to achieve. You can paint and modify the weights in these poses. Just make sure to put the rig back in its default position as you go. Again another good reason to have zeroed out rotations before you skin.
Here again is an example of how I block out the weighting on the head.
Now once you get to the arm, we want to test out positions on those as well. But we built IK onto those arms, and I bet those IK handles don't have clean translate values yet. And if you try to freeze transformations on them, they don't change. As well, when you rotate the COG the arms and feet float with the body.
The easy fix here is to group the IK handles. After that you should be able to freeze transforms on them, as well as they will stick in space. If you do want the arms and legs to stick with the COG, you can always parent the groups under the COG.
Now again, rather than paint both sides of the rig, we can simply paint one side and then mirror the other half
Again, you may need to do some trial and error to figure out which orientation is right for your case.
So we've covered the basic here as far as rigging. There are some areas I've skimmed over some here, but there are plenty of resources out there on skinning. My goal was to cover some of the items often not covered, at least from what I've seen, that as we go on become very important. Good luck