Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1059205 Posts in 43057 Topics- by 35006 Members - Latest Member: barbaraholland

October 31, 2014, 12:29:21 AM
TIGSource ForumsDeveloperTutorialsBlender Rigging Tutorial Series
Pages: [1]
Print
Author Topic: Blender Rigging Tutorial Series  (Read 7705 times)
xrabohrok
Level 0
***


ahahahaAHAHAHAAHA


View Profile WWW Email
« on: April 11, 2012, 02:46:46 PM »

Intro
   So, you designed your character, you made them look fancy and awesome, you unwrapped and colored them in, what are you missing?  Well, the ability to move, of course!

   Modeling is fun, and making scenes and statuettes is good and all, but your model becomes useful and reusable if you give a model some ability to move.  On top of that, you can add animation to the rig so you can give your character the illusion of life.  Seeing your character run for the first time is heart stopping, to say the least!
 
This tutorial assumes that you can model in blender, and can competently manipulate the viewports.  While button placement and vocabulary will vary from program to program, the process is mostly the same in other 3D software.  This tutorial is valid for the 1.58+ family of Blender releases (done in 1.61alpha).   

Some terms you will see over and over:

Armature (aka “the rig”): The entire collection of bones, rules, and transforms that are linked to the mesh. 

Empty: An object whose only purpose is to contain transformation information (location, rotation, scale).  Useful as targets for constraints and rules.

Bone: A special type of empty that is specifically made for armatures in mind.  On top of transformation information, it may also have length and built in movement restrictions. 

“The Hierarchy”:  Bones and sets of bones can be “parented” to other bones.  Parents of bones move all child bones down the hierarchy.  The Root bone is the bone highest on the hierarchy.  Moving this bone moves the entire rig, and thus the entire character.  To help visualize this: your foot would be parented to your shin, and the shin parented to your thigh.  Moving your thigh also moves the shin and foot, moving the shin moves just the shin and foot, and moving the foot only moves the foot. 

Constraints (aka rules): Constraints limit the movement of parts of the rig in useful ways.  There are many constraints, but one example would be to limit the hand bone from going farther than the lengths of the two arm bones away from the shoulder bone.  Another would be to keep the eyes rotated toward something. 

Weights: How much a vertex of a mesh is affected by something.  In an armature context, we talk about how much a vertex follows a bone around. 

Forward Kinematics (FK):  The Hierarchy’s default operation.  Like in the definition of Hierarchy, the topmost bones affect everything below it.  Posing with this style would involve working down the hierarchy chain. 

Inverse Kinematics (IK): A stark reinterpretation of the hierarchy.  Where Forward Kinematics has the poser work up or down the chain, using IK means the poser choses the orientations of the topmost and bottommost bones of a chain, and an IK solver figures the rest out.  An arm with the IK solver applied means the poser merely needs to determine the position of the shoulder and hand, and the arm bends appropriately to match. 

“Circular dependency”:  Programmers are intimately familiar with these.  This happens when a bone chain somehow becomes dependent on aspects of itself.  One way you know this happened is that blender’s console will tell you, another way is that THE MODEL WILL COMPLETELY WIG OUT.  Yeah, those are bad and should be avoided whenever possible.
   
And now, a moment:

There is a distinct difference between an armature and a skeleton.  An armature dictates how the skin of something will move, a skeleton dictates how the limbs of something move.  An armature includes muscles, a skeleton does not.  Do not reproduce the human bone structure in armature form.  It is pointless and looks bad.  Good armatures save work, bad ones create work. 
Skeleton:
http://www.merriam-webster.com/art/med/skeleton.gif
Armature:
http://www.armaverse.com/images/P3_4_5%20header.jpg
SKELETON:
http://www.sciencequiz.net/jcscience/jcbiology/gapfilling/images/skeleton.gif
ARMATURE:
http://www.youtube.com/watch?v=HyNh3AXegxw
Let us begin!
Logged

A picture is worth a 1000 words, so naturally they save a lot of time.
xrabohrok
Level 0
***


ahahahaAHAHAHAAHA


View Profile WWW Email
« Reply #1 on: April 11, 2012, 02:59:19 PM »

Tutorial 1: Basic Character
    You will quickly learn that no character is truly basic.  But some characters require more than others.  For this demonstration, I offer a WIP mad scientist I’ve been using for my Unity projects.  He may spontaneously get better as the tutorial goes on, that is the nature of using a character that isn’t quite done yet.
 
   This guy is just about as basic as they come.  He has no modeled eyes (sunglasses), and is less than 2k faces all together.  His face was built with no expectation of emotion, so I won’t rig for it (this time). His hands are really just mittens. About the only complicating factor is his cloak, I’ll discuss why as the demonstration goes on. 

Part one: setup
   The first thing we need to do is add an armature.  To do that, center the 3D cursor somewhere near his middle, press spacebar, and type “ADD ARMA”.  “Add armature” should be one of the few options that remain, so choose it by pressing enter.

 
   You will now have an armature with a single bone in it.  The armature really refers to the collection of bones, so we still need to add all the other bones to the armature.  What this entails is editing the armature, so press tab while the armature is selected to enter edit mode.  Whenever you edit the base armature, do it in edit mode.  Changes in other modes may be lost.
   We are going to use that first bone as a root bone, so move it behind him somewhere and just forget about it for now.  Once it is out of the way, position the 3D cursor somewhere at the bottom of his spine, press spacebar, and type “ADD BON”.  “add bone” will become the only option, once again press enter to add the bone.
   It is worth mentioning that, while I am working in wireframe display, it is easier to work with solid shading.  However, you can’t see your bones through the mesh anymore.  In order to solve that problem, click on the armature tab, and select X-Ray under the display drop-down.

 
   It is worth mentioning that the bone has three parts: two endpoints, and a body.  Each one can be manipulated in similar fashions as one would an edge. They can be scaled, rotated, moved, or just one end can, or the whole thing, etc.  In our case, we want to extrude one of the ends into another bone.  Click on the top point, and press ‘e’ to extrude the point into a new bone. You will want to do this in view perpendicular to his facing (the left or right view).  Make it so it looks like mine:



This is probably more bones than realistically needed such a low poly character, but I do want the flexibility required for some of things he will be doing. 
   Since we are doing the spine, let us just continue on to the head.  I do two neck joints and then a bone for the head.
 
   This next part is pretty cool.  Blender will do half of the work for us, if we let it.  What we want to do is work on half his arms and legs, and blender will mirror those operations on the other side.  We will need to bring up the toolbar, so press ‘t’ if it is not already up.  Check the box that says “x-axis mirroring”.

 
Now, when you hold shift and go a direction, a mirror version will emanate from the equivalent bone in the opposite X direction.  So we will do that with his shoulders, arms, hips, and legs.  Click the joint that is located at the kink of the spine, hold shift and press e to extrude both of his shoulders at the same time. 

 
Repeat the process for the arms, the palm, and the mitten finger.  You only need to hold shift for the first extrusion.  Once you are done extruding, add some bend to his arms by bringing the elbows back a little and shoulders forward.  This will assist in some of the rules we apply later. 


 
   We quickly add the thumb by duplicating the end bone of the arm chain (shift +d).  Try to align the bone with his thumb as well as possible.  The changes will also be mirrored. 


 
Now we do the same for the hips.  Shift+e extrudes both of the hips at the same time, like before. 

 
Go ahead and extrude out the legs and feet as well.  The process is the exact same as the one used for the arms.  You will want to make the feet as two bones: heel and toe.  This will better represent how a foot works. 

 
We are going to add some bones that make no sense at this point in the process.  For a lack of a better term, these bones are “handles”.  They help constraints conform in such a way that allows for better manipulations.    One should go out the heel, and another should jut out the toe.

 
While we are at it, let us add the others to the hands, back and spine as well.

 

   So far, our armature has been a rough approximation of his skeleton.  This next part will give bones to the guy’s coat some bones.  Why?  Unity’s cloth simulator is expensive, and for such a low poly character, it would look bad anyway.  If I don’t rig his coat, his legs will go through it and look funny.  In lieu of designing a new character without the coat, I’m going to approximate the movement of his coat by hand.  I will need bones to do that right. 
I duplicate the hips and extrude them out to make some coat control bones, this is to take advantage of the mirroring already in place.  Then I duplicate the hip handle bone and use that as a middle chain for the coat.  When making the chain, overshoot by one.

 
   Now for the desperately unfun part.  We need to name every single one of these bones something recognizable.  Blender will try to help by making the mirror bones something similar, but in my experience it tends to fail.  Try to keep to a convention, here are my names:
 

 
The actual names are unimportant: I don’t care, and blender doesn’t care.

We have two choices on how to proceed and none of them are wrong, it is a matter of preference.  I like to meld the skeleton to the armature before proceeding to constrain it, but constraining the skeleton helps evaluate its usage in animation.  I’ll do the constraints first for this next part.


Logged

A picture is worth a 1000 words, so naturally they save a lot of time.
xrabohrok
Level 0
***


ahahahaAHAHAHAAHA


View Profile WWW Email
« Reply #2 on: April 16, 2012, 06:48:04 AM »

Part 2: Rigging

We have a skeleton, and it is more or less ready for setup.  For this part, I’m going to hide the mesh (h), since I will not need it.  
   With the mesh hidden, select the armature and go into edit mode once more.  There is still a little bit of setup needed, and I’m going to explain why.  
   The inverse kinematics finder is a special constraint that brings with it some special rules and pitfalls.  Like described earlier, a IK chain only needs the beginning and end points defined to work properly.  In general, this saves a lot of work, but this comes at the price of control.  We lose the ability to add kinks to chain, or have a zigzag sort of chain, or anything that is not the standard arch shape.  To get around this, we break up one long IK chain into several smaller ones at strategic points.  This is precisely what we are going to do to this figure: break the chain up into several smaller ones.
   Remember those weird bones I had you scatter through the armature?  We are going to need to give those some attention now.  Right now, just go ahead and delete any parent they might have.  This is REALLY important.  Do this for ALL handle bones (wrist, heel, neck, hips, shoulders, toes, skirt).  
 
   Let us do a foot first.  Confirm that the heel and toe-tip handles have NO parents.  We will apply the first IK constraint to the foot itself.  Go into the pose mode, then select the tip of the toe, and the next bone up.  Then, press Shift+i .  The IK constraint will be applied, but it needs to be modified some.


  
If you go to the bone constraints tab, you will see that the “chain length” is set to zero.  This is Blender speak for “this chain affects the whole armature”.  This is undesirable.  Set the length of the chain to “2”.  


 
Now just the foot is affected when you mess with…the foot.  Now we are going to do the rest of the leg, which is a similar process.  Select both the heel handle and the shins (in that order), and press Shift+i again, and then set the chain length once again to two.  
   If you grab the heel handle and move it around in pose mode, the rest of the leg acts as you would expect it to.  Yet, the toe handle is left behind, and the rest of the foot is left pointing at it.  Lets fix this right quick by parenting the toe handle to the heel handle.  The result should be a fully functioning leg.  
   Repeat the exact same process for the other leg.
   The spine is a similar but slightly different process.  There is some preliminary stuff we need to do with the hierarchy.  Parent the hips to the hip handle, and parent the shoulders to the shoulder handle.  In pose mode, select the shoulder, then the top spine, and add the IK constraint.  Set the chain length to however many spine bones you have (other than the yellow one).

    
   Since the head counts as the spine, I follow up with its own IK.  I set the chain length to two, then parent the head to the shoulder handle.  Moving the shoulder handle should bend his back and move the head, making him “duck”.  
   The arms are similar to the hips.  Parent the palm hand bone to the handle, and then add an IK by selecting the palm and the forearm.  Set the chain length to two.  

 
   The skirt bones are trivi…oh wait.  These are going to be anything BUT trivial.  Huh.  I’m going to mess around a little bit, and come back to this at a later time.  Just ignore those associated bones for now.
   The last step in this phase is to take all the handles and parent them to the root bone (that very first bone that came with the armature).  You know you have done it right if you move the root bone in pose mode and the whole armature moves with it as is.  
   That concludes the armature first pass of constraining the rig.  You can pose him by grabbing the handles and moving his limbs around.  You should be able to get some alright poses, save them by pressing Shift+L -> add new while the bones are selected.  You may notice that the knees and elbows are fighting you or looking stupid, we’ll fix that soon.  

Logged

A picture is worth a 1000 words, so naturally they save a lot of time.
xrabohrok
Level 0
***


ahahahaAHAHAHAAHA


View Profile WWW Email
« Reply #3 on: April 16, 2012, 06:51:30 AM »

Part 3: Fixing
Ok, yeah, those knees are really bugging me.  Let’s fix that right now. 
Duplicate the shins so that they are floating in front of where the knees are.  Scale them down and delete the IK constraint on these duplicates, and the parents.  Name them something logical (like knee.l and knee.r). 
Once this is done, click on a yellow shin, then click on the bone constraints tab.  The IK constraint should be displayed.  We are going to make the pole target the bone we just made.  Choose “Armature” in the list that comes up, then the knee bone that corresponds to that leg.


 
Lifting his leg will probably make you cringe; fix it by playing with the pole angle (it is usually some multiple of 90 that you want). 

 
Now his knee will point to wherever the knee bone is.  In this way you can have greater granular control with his IK joints.  The process for his elbows is exactly the same.  Remember to root the knee bones.

 

Logged

A picture is worth a 1000 words, so naturally they save a lot of time.
xrabohrok
Level 0
***


ahahahaAHAHAHAAHA


View Profile WWW Email
« Reply #4 on: April 16, 2012, 08:25:28 AM »

Part 4: Attaching

Attaching the armature to the mesh is done through a modifier on the mesh.  This modifier is called “Armature”.  Right when you add the modifier and tell it which armature to use, it attempts to automatically attempts to weight the  mesh to the bones based off a envelope around the bones.  As you can see…
 

…this tends to fail.  He looks like James Woods from Videodrome
I’m not going to do this part step by step, as it is kind of like coloring.  Instead, I’m give the general process, and things to watch out for. 
First, you will want to put the armature into pose mode.  You can then click on the mesh to select it.  With that done, go into weight paint mode.

 
In weight paint mode, clicking on the mesh will add or remove “weight”, which adds or removes influence that a bone has on a group of vertices.   You can change how much weight is added on each click by messing with the strength, and you can change the brush size by holding f and moving the mouse around.
 

The brush settings, while resizing the brush.
 
You can select another bone to work on by holding alt and clicking that bone.  The current bone you are modifying the weights to will be outlined.  At any time, you can move the bone by pressing g, and rotate by pressing r.  You can see how the mesh moves with the armature when you do this.  To reset their position/rotaion, hold alt and press g/r respectively. 

 
Vertices with 100% weight to a bone will glow red when that bone is selected.  Vertices with 0% weight will be blue.  The color gets warmer the more weight is applied.  Two or more bones can claim weight on a vertex, in which case the bones will split the weight proportionally (so 50/50 if two claim 100%). 
It is worth noting that applying any amount of weight data to a vertex disqualifies that vertex from using the automatic bone envelope setup.  All vertexes need to be 100% weighted to something, or they will get left behind when the character starts walking around.   
You may run into what I call “Raggedy Ann-ing” when weighting the joints.  This is a special problem that even professionals don’t really have a standard answer for. Essentially, instead of the joint simply bending, the joint itself caves in, and you are left with gross looking joints.  The best fix involves an extra edge loop around the elbow and a bone whose sole purpose is to preserve elbow volume, but this is a 2k poly model, and I’ve already UV’d the thing so I don’t want to edit the geometry.   We are instead going to kind of wing it.



 

What we are going to do is reduce the amount of influence each bone has on the opposite side by 50%.  This will be closer to what we want.

 
Please note that this is merely passable.  If I truly cared greatly about this, I would have actually have made the geometry fall together differently. 
Beyond that, if you are questioning whether or not you should attach a vertex to a bone, ask yourself:  do I want that moving with this bone, and does it look good?  Make sure to continually pose your model to try and detect any issues, otherwise you will not know until it is in your game/animation. 
Go ahead and paint the bones for the skirt to the skirt itself, I’m going to show how to rig it up ahead. 
Logged

A picture is worth a 1000 words, so naturally they save a lot of time.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic