weight painting & setting up constraints

wc_screen01 leave edit mode and disable wire frame drawing for the mesh. select the armature and disable envelopes in the armature button panel. also switch to stick draw mode there. during weight painting sticks have the advantage of being less occluding.

select the mesh and then the armature. with both selected press [ctrl-p] and choose (parent to armature) and then (name groups). this will create an empty vertex group for each bone. after weight painting each bone's vertex group will contain the list of vertices the bone affects. (it would also be possible to create groups with weights generated from previously adjusted bone envelopes but i find refining these weights often is more work than painting them from scratch.)

select the armature and switch to pose mode in the 3d view window header (or with [ctrl-tab]). while in pose mode select the mesh and switch to weight paint mode in the window header. enable x-mirror mode in the paint button panel. now a bone can be selected with [rmb click] and its vertex weights can be drawn with the [lmb]. in the paint button panel i most of the time use mix mode, opacity 1 and weight 1 or 0 as drawing settings. on the mesh blue means that the bone weight is 0, green that the weight is 0.5 and red that the weight is 1. every vertex with a weight above 0 will get added to the vertex group.

draw the bone weights for each bone on the character's left side. if your character mesh is exactly symmetrical the opposite bones will automatically get the same values. at joints you can let the bone influences overlap to get better deformations. to see where the vertices are it can be helpful to turn on wire in the paint button panel.

if a vertex has more than one bone influence it will get transformed by a mix of the influences. for example if a vertex gets influenced by bone1 with weight 1 and by bone2 with weight 1, the vertex will get transformed 50% by bone1 and 50% by bone2. if one weight is 0.5 and the other 1 the percentages would be 33% and 66%. if there is only one influence with weight 0.5 the vertex will get transformed 100% by that bone.

(if you want to export to a game engine format which doesn't support weighted skinning you should try to avoid multiple influences! it can be quite tricky to achieve good deformations without weighting though.)
wc_screen02 some parts of the mesh can be tricky to paint. for example the head with its cavities for the eyes and mouth where parts of the mesh intersect each other.

there is an alternative way to add vertices to a bone's vertex group. switch from weight paint mode to edit mode with [tab] (or in the window header). disable z-buffered selection mode by clicking on the cube icon (next to the vertex/edge/face mode icons) in the 3d view window header. lasso select all vertices of the head.

in the vertex groups section of the link and materials button panel select the head group, set the weight to 1 and click on assign. the head vertices are assigned to the head bone's vertex group now. return to weight paint mode if you want to continue with painting other bone influences (btw. [tab] always toggles between edit mode and the last active mode).
wc_screen03 once all bones have some painted influence the deformation at the joints should be tried out.

rotate various bones to bring the character into a pose like on the screenshot where the deformations of the important joints can be seen (use [r] to start rotation mode and [x], [y], [z] to select an axis then). during refining the weights also experiment with colors between blue and red.

if you want to use the rotate widget you have to switch to object mode, rotate the bones there (the armature will be in pose mode) and then switch back to weight paint mode. i am not sure why no widgets are available in weight paint mode.

by pressing [alt-r] (or window header -> pose -> clear transform -> clear rotation) the rotation of a bone can get reset again.

the weighting doesn't have to be perfect yet. sometimes deformation problems aren't visible until the character gets animated. it's possible to return to weight painting at any time to refine problematic areas.

weight painting - flash animation ~ 3.5mb
wc_screen04 now the legs will get an ik (inverse kinematics) setup.

switch the armature to edit mode. select the two upper leg bones and duplicate them with [shift-d]. move the copies forward about one meter (if you do this in a 3d view best [rmb click] after starting the duplication movement and use the move widget then to move them).

rename them to ik_knee.L and ik_knee.R. clear their parent link with [alt-p](clear parent). scale them down along the z-axis a bit. select one of them and move it slightly along the x-axis to get them a bit more apart.

switch to pose mode. select ik_knee.L and then additionally leg1.L. press [ctrl-i] and click (to active bone) to make ik_knee.L an ik target of the upper leg bone. don't worry that the character is in a weird pose now. in the contraints button panel set the ik chainlen to 1. repeat this for the other leg.

the knee ik targets will constantly pull the knees into the correct direction during animation. since they won't be animated for a walk cycle they can be hidden by selecting them and pressing [h] ([alt-h] (or window header -> pose -> show/hide bones -> show hidden) would unhide them again in case you need this. btw. the next blender version will support layers for bones. this certainly will come in handy.).
wc_screen05 switch to edit mode again. in side view select foot2.L, duplicate it ([shift-d]) and move it down a bit. clear its parent with [alt-p]. name it ik_1.L.

duplicate ik_1.L and move it to the ground plane behind the heel (you could use [shift-s](selection->grid) after moving it). name it ik_leg.L.

select the base of ik_1.L and extrude ([e]) a bone approximately parallel to foot1.L. name it ik_2.L. from there extrude another bone like on the screenshot and name it ik_3.L.

select ik_1.L then additionally ik_leg.L and press [ctrl-p](keep offset). select ik_2.L then additionally ik_leg.L and press [ctrl-p](keep offset).

select the tip of foot2.L and snap the cursor to it with [shift-s](cursor->selection). select the tip of ik_1.L and snap it to the cursor with [shift-s](selection->cursor). repeat this three times (ik_1.L base -> foot2.L base, ik_2.L base -> foot2.L base, ik_2.L tip -> foot1.L base).

select the 4 ik bones. (this probably is easier in the outliner since the two bones are overlapping at the front. split the 3d view window. set the type of the left one to outliner in the window header. switch to outliner mode (window header -> view -> show outliner). expand the tree like on the screenshot and select the 4 bones by [(shift+) lmb click] on the bone icons.)

move the 4 selected bones 2-3 centimeters in +x direction. press [shift-d] and place the copies with some offset. press [w](flip left-right names). select the other 4 ik bones with .L postfix again and move them slightly back and forth a few pixels along the x-axis so that the opposite bones snap into the right position.
wc_screen06 switch to pose mode.

select ik_3.L then additionally leg2.L and press [ctrl-i](to active bone). in the contraints button panel set chainlen to 2. the ik chain must go up to the hip only instead of all the way to the root.

select ik_2.L then additionally foot1.L and press [ctrl-i](to active bone). in the constraints button panel set chainlen to 1.

select foot2.L. in the constraints button panel add a copy rotation constraint. enter "OB:Armature" and "BO:ik_1.L" as target.

repeat this for the right leg.

the legs are set up for animation now. the ik solvers calculate the needed rotation for the leg bones to let them follow the ik targets. only ik_1, ik_2, ik_leg will be needed for animation so the other leg and foot bones can be hidden.

try to move ik_leg around. try to rotate ik_1 and ik_2 around the x-axis. try to move the root bone up and down. this is how setting the poses for animation will work. by selecting all bones and pressing [alt-g][alt-r] the pose can be reset again.

setting up constraints - flash animation ~ 3.5mb