Haytch has done a very nice conversion of this tutorial to PDF for those that want to work with it off-line. Thanks Haytch!
http://blenderunderground.com/files/use ... artIII.pdf
This is part III of the MakeHuman threads. If you haven't looked at Part I and part II, please do so now to get up to the point we are at in this tutorial. Part I can be found here:
http://blenderunderground.com/forums/vi ... php?t=1038
Part II can be found here:
http://blenderunderground.com/forums/vi ... php?t=1046
If you remember, we left off in part two with an imported Collada / Wavefront mesh that we applied the UV images to. I need to go over some minor details that came out of that tutorial. First, for transparent UV Alpha images as well as the eye reflection image, don't forget to click the "NORGB" button in the Map To panel or you will get dark splotches for eyes and eyebrows. Next, the iris image mapping has to be scaled up to cover the entire iris. For some reason, MakeHuman import doesn't do that right. That taken care of, we will continue with the final mesh cleanup and rigging. So here we go...
An armature is a non-rendered device used to deform a mesh object. Armatures consist of bones much like the human body has bones that control how the muscles move. Added to the bones are constraints that dictate how the bone behaves when moving them. Consider your knee. It moves along one axis only and is further constrained to not move forward much beyond 180 degrees. If it did, you couldn't walk or even stand upright. Blender's armatures can be set the same way.
If you used the WaveFront importer, you don't have the advantage of an armature already there unlike the Collada importer. All this means is that to rig it out you have to add your own armature and bones. It is beyond the scope of this tutorial to teach you how but may come up in another tutorial if enough interest is expressed in the comments...
If you used the Collada importer, you already have the armature in but you need to rename the bones to something meaningful. Below is a depiction of how I named the bones in my armature. It follows standard conventions of naming bones on the left side of the character (right side as you are looking at it in front view) with .L and the right side as .R. The left shoulder would become Shoulder.L while the right becomes Shoulder.R. This is important because many of the functions in Blender animations rely on this convention.
Anatomy of a bone:
A bone in Blender has three parts. The head, body and tail. The default behavior when you add bones is to connect the new bone's tail to the sleeted bone's head creating a chain of bones. A bone, just like a mesh, can be separated to form two bones. They can also be duplicated but it should be noted that duplicating bones also duplicates any constraints you have with the bone.
Bones can be scaled, rotated, extruded, posed, constrained, connected and disconnected.
One thing you will notice is that I added a bone where the neck joins the head and called it "Jaw". This bone will be used to control jaw movement allowing you to open and close the mouth. Other bones can then be added to the jaw to control the tongue. I did not choose to go into that at this time but they are all added in the same fashion. To add a bone simply TAB into edit mode and select where you want the bone to be added to in the armature either by positioning the 3D cursor where you need it or selecting the head of an existing bone. Hit the SPACEBAR and select "Add" then "Bone". Alternatively, you can use the extrude function to add the new bone. A new bone will be added pointing up if you added or along the extrude path if you extruded. Grab and drag the bone head down along the jaw line.
| | |
| | |__Head
| | |
| | |__Jaw
| | |
| | |__Bicep.L
| | |
| | |__Forearm.L
| | |
| | |__Wrist.L
| | |
| | |__Pinky_3.L
| | | |
| | | |__Pinky_2.L
| | | |
| | | |__Pinky_1.L
| | |
| | |__Ring_3.L
| | | |
| | | |__Ring_2.L
| | | |
| | | |__Ring_1.L
| | |
| | |__Middle_3.L
| | | |
| | | |__Middle_2.L
| | | |
| | | |__Middle_1.L
| | |
| | |__Index_3.L
| | | |
| | | |__Index_2.L
| | | |
| | | |__Index_1.L
| | |
| | |__Thumb_3.L
| | |
| | |__Thumb_2.L
| | |
| | |__Thumb_1.L
| | |
| | |__Pinky_2.R
| | |
| | |__Pinky_1.R
| | |
| | |__Ring_2.R
| | |
| | |__Ring_1.R
| | |
| | |__Middle_2.R
| | |
| | |__Middle_1.R
| | |
| | |__Index_2.R
| | |
| | |__Index_1.R
| | |
| | |__Big_Toe_1.L
| | |
| | |__Index_Toe_1.L
| | |
| | |__Middle_Toe_1.L
| | |
| | |__Ring_Toe_1.L
The Collada Importer does a pretty good job of bringing in the armature but one area where adjustment is needed is the toe bones:
You will want to align each toe bone so that the bone heads rest on a "knuckle joint" (an area where the mesh will bend) and the tip of the last bone is just poking through the end of the toe:
Also, make sure you check the alignment of each bone to make sure it is centered in the proper place on the mesh. You do this by selecting the head (or tail which ever may be more appropriate) in edit mode for the Armature, and using the G-KEY grab and move them as needed. You may find it easier to see the joints if you ALT-Z to solid mode. Also, make sure you check it from all angles to ensure centering.
Weight Painting preparation:
Now that we have the bones named and cleaned, it is time to do the last bit of mesh cleanup. Switch to front view in the 3D window (NUMPAD-1 KEY). Select all (A-KEY) and apply scale and rotation (CTRL-A). Choose "Scale and Rotation to ObData" from the resulting menu. This will apply the rotation we put on the Collada imported objects since we did rotate it 90 degrees after we imported it. If you skip this step, strange things can happen when you pose your character. Next, we need to make sure our bone angle is pointing in the right direction. Select the armature and TAB into edit mode. Select all the bones with the A-KEY and press CTRL-N. Finally, choose "Clear Roll (Z-Axis Up)" from the resulting menu. TAB back out of edit mode. Again, like the scale and rotation, if you skip this step strange things can happen when you pose your character. We are almost ready to apply the default weight painting to the armature just one last cleanup item left. As it stands now, you have a head and body that are separate. If you applied the bone heat now, when you rotated the neck the mesh would separate at the seam. To prevent this, we will join the head and body allowing a smooth deformation of the mesh. Also, the eyelashes and eyebrows would stay put when you posed the head. To fix all this, select the head and SHIFT-select the eyelashes, eyebrows and lastly the body in object mode. Press CTRL-J to join them. Next, tab into edit mode for the body and press W-KEY and select "Remove Doubles" from the resulting menu. TAB out of edit mode. Lastly, join the eyes and iris together and remove doubles like you did for the body. Leave them separate from the body. We will be dealing with them later.
Weight painting is the process of assigning a portion of a mesh to a bone and telling Blender how much influence that bone has on the mesh. The way this is done is by parenting the mesh to the armature. In Blender versions before 2.46, you had to fiddle with the envelopes and weight paint tools to get just a default rig setup. Blender versions 2.46 and greater have simplified this process by creating a new way to achieve the default. The Blender devs have also revamped the weight paint tools to make life easier on the rigger. With that said, lets apply the bone heat to the mesh and see what it does. Select the body mesh then SHIFT-select the armature. Press CTRL-P and choose "Armature" from the resulting menu. Lastly, select "Create from bone heat" from the last menu. You should see the body disappear from the outliner leaving the following:
The body is still there though but now it is under the Armature:
Lastly, we need to "make real" that modifier we just applied. In the editing panel (F9) Modifiers tab hit the "Make Real" button:
What you now have is a real armature assigned to the mesh and this brings you up to speed as if you did this the old way using envelopes.
At this point, we have a fully rigged body that can be posed as is. Of course, the eyes, tongue and teeth are still hanging in space but the body is ready for FK (Foreward Kinetics, more on this later) poses.Now to check the weight painting that Blender has calculated.
Select the body mesh and enter Weight Pain mode:
Blender 2.46 has added a few tools to weight paint mode that does not exist in previous versions. Most notably is the Painting Mask (F-KEY).:
When you turn this on, it overlays your mesh wireframe allowing you to not only see the structure of the mesh but restricts your painting to selected areas. By default, all areas are selected. Use right-click (SHIFT-Right-click for multiple selection) to select which cells you are painting in. No more painting on the front only to have the back get selected by mistake! You can also use select all A-KEY just like in edit mode.
I find it useful to keep an outliner window open with the vertex groups dropped down to allow easy selection of bones while painting.
Another helpful aid Blender has had for a while is the ability to pose the figure while in weight paint mode so you can see the effects of your painting immediately. This feature is so handy, as we'll see later, that the mesh will tell you if any verts are painted wrong.
Weight Painting is a color coded feature. Dark blue represents the weakest influence while red represents the strongest. Rainbow gradients in between are values of increasing influence. It should be noted that you need enough geometry to allow a smooth transition in the deformation of the mesh or your weight painting will have little effect. This can be seen quite clearly if you select the back bone and SHIFT-NUMPAD-1 to view the back of the model.
To see the influence in action, turn off the Painting Mask (F-KEY) and Right-Click the back bone. Make sure the paining mask is off or this won't work. Now, using the R-KEY rotate the back bone and notice what happens.
If you applied the rotation (left-clicked it that is) you can clear the rotation with ALT-R. It is a good idea to always clear your rotations and locations (ALT-G) before continuing your painting. That will return your model to it's "default" pose. IT IS IMPORTANT TO CLEAR THE ROTATION IN WEIGHT PAINT MODE OR POSE MODE. Doing the clear in Object mode will move your objects to their origins.
The weight paint toolbox is gotten to in the same way as the transform properties tools are gotten to N-KEY. This will display the toolbox in your 3D window:
You can also get to it using the F9 button panel Paint tab:
The tools are as follows:
Weight: The bone deformation to assign to a vertex group. The scale is from 0 to 1 with 0 being the least and 1 being the most.
Weight Presets: The buttons below the weight slider is pre-selected settings for the weight slider. The choices are 0, 1/4, 1/2, 3/4 and 1. These pre-selectors allow quick definition of those weights.
Opacity: The amount of "pressure" applied to the brush. This will adjust how long it takes to go from dark blue to red allowing fine tuning of the weight painting. Like the weight slider, it is scaled from 0 to 1.
Opacity Presets: The buttons below the opacity slider is pre-selected settings for the opacity slider. The choices are 1/8, 1/4, 1/2, 3/4 and 1. These pre-selectors allow quick definition of those opacity.
Size: This is the size of the brush to use. The scale of the brush allows you to paint either wide areas of your mesh or fine details without hitting wrong areas. The scale is from 2 to 64. This is measured in pixels.
Wire: This turns on the wireframe for the mesh. It shouldn't be confused with the paint mask since it is informational only and doesn't serve to restrict painting.
Mix: This is the default mode for painting. It mixes the weight of the painting allowing for additions and subtractions based on the weight paint selector. This means that if you select 0 as the weight, it will subtract from the current weight taking it towards dark blue. The reverse is also true. If you set the weight to 1 it will add to the weight taking it to red.
Add: This will only add to the weight allowing the weight selector to determine the speed of change.
Sub: This will only subtract to the weight allowing the weight selector to determine the speed of change.
Mul: This multiplies the vertex colors. Personally, I don't see any change when I apply this so I have no idea what it really does. If anyone has insight into when it is used, reply to this thread and I'll add it to this tutorial.
Blur: Blurs the weight painting with surrounding areas. Basically, this allows you to smooth out a rough.painting. Meshes rarely move in creased fashion. This is used heavily in organic modeling.
Lighter: Paint over darker areas only. This will allow you to paint darker areas without affecting already lighter areas you have already painted.
Darker: Paint over lighter areas only. This will allow you to paint lighter areas without affecting already dark areas you have already painted.
As I said, Blender has already applied a default weight to each bone saving you hours of work but it still isn't perfect. If you zoom in to the jaw bone we added, you will see that it has weight painted up through the face. When you open your jaw, your nose and upper lip doesn't move much. In our model, it grabs them both and moves them. Not good!
Don't forget to clear rotation, scale, and location (ALT-R, ALT-S, ALT-G) in weight paint mode or pose mode after you pose to return to the default position.
What we need to do is undo the weight painting Blender has assigned and assign our own. Before we do this though, switch to object mode and move the eyes, tongue and teeth to a different layer to get them out of our way. Select the body again and enter weight paint mode.
To undo the assigned weight painting, select the jaw bone (RIGHT-CLICK-Select) and bring up the weight paint tools (N-KEY). Click the "Clear" button and watch it turn all blue.
Next, turn on the Painting Mask and deselect everything if it is selected (A-KEY). Make sure your toolbox setting is set to "Add" and select a cell on the jaw line. Paint all over that cell. Don't worry about the bleed over you get that is normal and in fact we will use it later on.
Continue doing the for the entire jaw line up to and including the bottom lip. What you should wind up with is similar to below.
Make sure you paint both sides and the bottom of the jaw. Now for the inside of the mouth. Turn off the Paint Mask and with the jaw still selected and your character in side view, rotate the bone down to open the mouth. You should notice that the mouth doesn't open all the way. This is because of the interior faces of the mouth and lips. This is where we use the bleed over we had while painting. Any partially painted faces that are sticking up need to be fully painted. I did most of it but left a few to illustrate this:
Notice the face sticking up on the lower lip that I have highlighted. Once painted properly, it will pop down with the rest of the jaw.
You do that until you get all the parts to look properly with the mouth open.
The last thing we do before we can call the body jaw painting done is to clear any rotation, scale and location of the bones we put on during painting (ALT-A, ALT-S and ALT-G). It's always a good habit to clear them all even if you only rotated. You never know when you accidentally moved instead of scaled or rotated. Just make sure to do it in weight paint mode or pose mode. To really clean it up, you could "feather" the neck down much like the back is feathered out. That will prevent the crisp line breaking of the jaw. I leave this as an exercise for the user. Hint...Use your 1/2 and 1/4 weight presets.
Tongue and Teeth:
If you remember, we have the tongue and teeth on different layers (I moved them to layer two). We need to get them into the action. To do this, move the armature in object mode to the layer containing the tongue and teeth. Next, select the tongue and shift select the armature. Using CTRL-P, parent the tongue to the armature and use "bone heat" again. Like the jaw, clear the weight paint Blender assigned and paint the tongue using 1/2 weight painting. The tongue should turn all green. You may need to move the teeth and eyes to yet another layer to get a good painting on. If so, simply move them in object mode and return to weight paint mode for the tongue. When done, move the tongue to the same layer as the body.
Repeat the same procedure for the teeth as you did with the tongue to parent them to the armature. After clearing the default weight, paint all the lower teeth with a weight of 1. It is very tricky to get all the teeth so to help make the task easier, we will hide all the faces of the upper teeth. Enter edit mode by hitting TAB. Select all the faces for the upper teeth and hide them (h-KEY).
Once you are sure you have ONLY the upper teeth faces hidden, enter weight paint mode again by hitting TAB and turn on the Paint Mask tool.
Select all the lower teeth now with A-KEY and paint them with a weight of 1.
TAB back into edit mode and un-hide the faces with ALT-H.Back in weight paint mode, you should now have something like this:
Last thing before we can call the tongue and teeth done as always is to clear rotation , scale and location for both the teeth and the tongue.
Now when you pose the character, the jaw, tongue and teeth are moving as expected. Some tweeking may be needed especially if you didn't feather out the weight painting on the body like I didn't.
I will leave the eyes as an exercise for the user. I recommend adding disconnected bones for each eye parented to the head bone with a weight paint value of 1. If too many of you have problems doing this, I'll create a supplement to this tutorial showing how. For this tutorial, I'll merely parent the eyes to the head bone and give it a weight of 1 which means that my model will always be looking forward. This is unrealistic and I do recommend the two bone method for moving eyes.
Kinematics refers to the way bones interact with each other in posing. There are two kinematic movements. Forward Kinematics is when each bone is posed independently to achieve a given pose. Inverse Kinematics is when one bone is used to affect a whole chain of bones. To illustrate the difference, hold your left had out in front of you. Make a fist and extend your index finger like you are pointing. With your other hand grasp your index finger at the knuckle closest to your hand and rotate it down. Do the same for each successive knuckle on your index finger keeping the position you rotated for each. This is forward kinematics (FK for short). Straighten your index finger now and grab the tip of your finger. Wiggle it up and down and notice that your knuckles will bend following the movement you apply to the tip. This is inverse kinematics (IK for short). Blender can achieve the same thing using bones that are disconnected to the rig and are identified as IK.
Our model is rigged for FK posing right now. I want to show you some IK posing and the fingers are a good area to show this.
I have taken this part of the tutorial from the ManCandy FAQ and rig. It's a great rig and character to learn from. To find out more on ManCandy, go here:
http://www.blendernation.com/2007/10/18 ... -released/
In the ManCandy rig, to get the fingers to curl, you scale a bone down. At the same time, you can rotate the finger towards the palm making a fist if you do them both. To achieve this in our rig, we are going to use the same technique. In this tutorial, I will only do one finger and the thumb to give you the procedures. The other fingers and toes are up to you to complete in the same fashion. Let's start with the left hand index finger but before we get into that, make sure that "Relationship Lines" are turned on in the View Properties panel. To get to it, select "View->View Properties" From the 3D window toolbar.
Now that we have done that, we can continue.
There are three bones for every finger. They all are named according to convention with the .L and .R for left and right. Remember, that is the character's left not the view left! The reason we want to apply an IK chain to the fingers is one of economy for the animator. As you can see, there are 16 bones in the hand including the wrist. To have to animate that many means an animator has to keep track of which bones were moved. Not an easy task when you consider the character's overall movement.
To start this TAB into edit mode and select the tip of Index_1.L. Using SHIFT-S, send the cursor to the selection.
Next, go to front view (NUMPAD-1) and add a bone (SPACEBAR->Add->Bone).
It will be quite large once you add it. You should notice that Blender defaults to keeping the tip highlighted when you add the bone. Grab it and move it down some keeping it outside of the rest of the finger.
The next step will make it an IK controller. Switch to pose mode and select that new bone. Shift-select the Index_1.L bone. Press CTRL-I and select "To Active Bone". We now have our first constraint set and our first IK-Chain set. You should notice the Index_1.L bone change color to yellow and a yellow line gets drawn indicating where the IK chain length is.
But there is a problem. The IK chain length is pointing to the center of the armature!
If you were to move the IK bone now, the whole rig would go nuts being pulled by this little bone. That isn't what we want. In the F9 Editing panel, we can see the constraint that we just added to Index_1.L. Select Index_1.L and look at the Constraints tab:
Highlighted is the chain length dialog. A value of 0 means go to the root bone. We want to limit the chain to the Index_3.L bone which is a total of 3 bones back. Change this to 3 and notice the dotted relationship line each time. The first time it went to the tip of Index_2.L. The second time it went to the tip of Index_3.L and the last time it went to what is the tip of the wrist but since it is disconnected it in reality becomes the root of Index_3.L where we want it.
At this stage, we have it done as a grab of the IK bone will illustrate when you move it. There are still problems with it the first of which is if you move the wrist, the finger will always point to the IK bone. This is because we need to parent it to the wrist.
Before we parent though, let's rename the bone "Index_IK.L". If you rename it before you parent it your outliner should look like this:
Another pitfall with our current configuration is the unpredictability of the roll of the mesh when you pose it. Namely, it can roll in unpredictable ways making poses very unnatural and difficult.
To solve this, we need to select the root of the IK chain and snap the cursor to it (SHIFT-S->Cursor to selection) and add another bone.
Select the tip of Index_1.L and snap your cursor to it. Next, right-click the tip of the new bone you just added and snap it to the cursor (SHIFT-S->Selection to cursor). What you wind up with is a bone that extends the length of the index finger.
The accuracy of the position of this bone will eliminate differences between edit mode and pose mode.Name this new bone "Index_Finger.L". This will be the bone we use to control the entire index finger. Next, select the bone and recalculate the roll (CTRL-N->Z-Axis Up). Parent Index_IK.L to Index_Finger.L (CTRL-P). It doesn't matter at this point whether you choose to keep the offset or not since we are controlling the parent and not the IK directly. Some readjustment of the finger bones in edit mode may be necessary to prevent rolling backwards. If so, give the three bones a slight curving down shape. The last things to do is to parent Index_Finger.L to the wrist keeping the offset. Next, we need to keep the finger bone on the same plane as the rest of the hand. This is done by snapping the cursor to the Index_Finger.L bone by selecting the body of the bone then SHIFT-S->Cursor to selection. Switch to front view (NUMPAD-1) if you already aren't there and add a bone. Grab the bone and move it out from the body. It doesn't matter how big this bone is since it's only job is to keep the Index_Finger.L bone from going wonky. Next, make that bone a child of the Index_Finger.L bone. Lastly, name it Index_Plane.L. We actually never manipulate this bone
The last two steps will complete the finger. We need to apply an IK to the Index_Plane.L bone to the Index_2.L bone keeping offset. Your model will deform at this point because the chain length of the IK is 0. Change it to 1 and your model will be normal again. Lastly, select the Index_Finger.L bone and bring up the transfrom properties (N-KEY) and lock the Rot Y setting preventing roll of this bone.
When you are done, scaling Index_Finger.L in pose mode should see you through to a finger that curls and bends like ManCandy's does.
You would apply the same technique to the other fingers and even the toes if you want.
This concludes the MakeHuman to Blender tutorial series. If you have any questions, don't hesitate to ask.