Animating Characters With BVH Motion Capture File

by Jean-Baptiste PERIN





bvhanim



This tutorial demonstrates the use of BVH motion Capture File to create realistic characters animations.
It shows how to  use Motion Captured data (contained in bvh files) in conjoncton with Blender's powerful IKSolver ..



bvh_import_result
The first step consists in importing motion capture data.

To do so .. just use the menu File->Import->Motion Capture ... (.bvh)

A file selector windows is displayed .. in which you can choose the bvh file you want to import.
Once selected .. click on Import BVH.

You should be asked to enter a scale parameter which allow you to size the resulting structure.

Once the scale is selected .. press OK ..  the script will then build a hierarchically structured heap of empty such as the one shown beside.

The newly created structure should be facing the sky .. and lying on X-Y plan.

To see it properly ... switch to a top view (NumPad 7) .. and zoom out  (- minus key)

You can press Alt-A to play the bvh animation.




In following steps, the first frame of the bvh animation will  be used as the rest position of our armature.

In order to have it suit our model, it might be interesting to adapt this rest position at our model position .. (which might have arms set in horizontal position instead of lying along the torso)
At frame one, select a shoulder empty (RMB-click on it ) and rotate it 90 degrees (R key, mouse move, while maintaining Ctrl key pressed).
Do the same with other shoulder empty to get something similar to what's shown beside .

Now select both shoulder empties (RMB-click on them while holding Shift-key pressed) .. and insert a Rot Key (press I and select Rot in the displayed menu).
set_rest_pos


create_armature
To create an armature, select the hip empty .. the one at the center of our charater .. it should be named "_Hips" (RMB click on it)

Open a script windows and run the bvh2arm script (go into the Scripts->Animation->Empties to Armature menu)

A Graphical User Interface is then displayed .. allowing you to configure


The HipBoneName field must be filled with the name of the main empty of the structure. It is automatically set to the name of the selected empty if it is a root Empty (ie: if it has no parent).

The startframe and endframe fields can be used to configure the  It is recommanded to use the frame number 1 as the first frame because it's going to be the rest position of our armature. By default, these fields are set to your animation parameter (defined in the anim tabspace of the scene panel (F10))

The FrameDecimation field allows to select the frequency at which position key are going to be inserted into the armature object's ipo.

Once all parameters are set ... Press Create Armature button.
bvh2arm_gui


add_IKSolver
The previous action should lead to the creation of an armature. In blender 2.37, the armature created by BVH2ARM script is fully animated but in Blender 2.40 ..this feature is no longer available ... and only the armature's position and orientation are animated (not individual bones)
So we are going to use Blender's  powerful IKSolver to perform bones'animation for us.

Select the armature and enter PoseMode (RMB-click on it and press Ctrl-Tab).
Select a hand empty (RMB-click on it) and select the armature again (RMB-click on the armature while keeping shift key pressed) .
Insert an IKsolver Constraint on the bone (Press Ctrl-I and choose To Selected Object entry)

This is going to  make our arm follow the hand empty .






default IK chain len


The figure above shows the ikSolver constraint as set by default after the Ctrl-I action. As we can see .. all bones are going to be
involved in movments .. In reality .. our human body doesn't use so many DoF .. For our animation to be more realistic we set up the IKSolver chain len parameter to 3 so that the IKSolver will only operate on arm's  bones rather than on the whole squellet (see figure on the right).

The chain len parameter can be reached in the constraint tabspace of the Editing Panel (F9) when armature is in Pose Mode (Ctrl-Tab).

Put similar IKSolver constraint on every end effector bone (hands, legs and head). For the head bone constraint, a 2 bones-long chain len should be good enough.
set_chain_len


final_armature
The figure beside shows the final armature once all constraint are in shape ..

Note that we added rotation restriction on several bones of the torso in order to make our armature move in a more realistic way .

The resulting animation is below ..
We can see that Blender's IKSolver  manage to produce an animation that is similar to what was captured by the mocap equipment ..


result

There are only small differences between the bvh animated empties .. and bones animation made by IKSolver..




visitors since creation on december the 20th of 2005.
visitors since creation on december the 20th of 2005.
(C) 2005 Jean-Baptiste PERIN - released under Blender Artistic License - www.blender.org