Join us in Outworldz at www.outworldz.com:9000 or follow us:

Part II of BVH Animation Converting for OpenSim and Second Life

This is Part II of BVH Animation Converting for OpenSim and Second Life. Go Back to Part I

This article is about how to use Blender to convert BVH files for Opensim and Second Life

Blender Setup 

Start Blender and Navigate to the User Preferences Screen. I am using Blender version 2.76 in this demo.

Blender User Preferences Screen

Click the Search box and type "BVH". Make sure the Import Export button for BVH files is checked, and click "Save User Settings"

Importing

You should now have a BVH animation Import option in the File-Import menu:BVH_Import_Option

I am going to do the Mutant Jumping attack:

Mutant_Jumping_Attack_BVH

You will see a screen with a large set of animation bones:

Mutant_attack_screen

You can click the Play button at the bottom of the screen to see it moving:

Play

You will need to set the animation Start at "1" in the menu at the bottom. The green line should be at the number 1 when you do this. You can slide the green line with the left mouse, or click the Start: dialog box, and enter the value 1.

Set Start to 1

Add the Avastar

I am using Avastar 2.0.   Your screen may be slightly different here, but it works the same.  Press Shift-A and select Avastar, and if you have 2.0, select "With Triangles". If you have the "Sparkles Pro" plugin, ,you could choose the Quads version of the Avastar.

 Avastar 

 A very tiny Avastar will  appear where the cursor was.  Don't panic!  It does not really matter where the Avastar is, and the size will be fixed in a few more clicks.

A_Tiny_Avastar

Hove the mouse over the 3-D window and press the letter T.   A menu will appear on the left.   Go to the Animation Tab on the left.

This menu appears when there is one Avastar and a second armature in the 3d window.

animation tab

The first 3 boxes should be already filled in.  The first one has the name of the animation you are converting from, in my case "jump_attack". The second should have the name "Avatar". If they are backwards, you will need to reverse them so the copy goes from the BVH to the Avatar.

We will cover "Guess Map" soon, but first lets click the "Match Scale": button and see it shrink the BVH armature down in size.

Match scales

Avastar will usually fill in the Source and Target boxes.

Click the first 4 buttons

I ended up with this.   Go ahead and position both of yours so they are in the same start position. 

Both avatars shrunk to scale

Let's put them both in the standard T-pose by left-clicking each avatar in the Properties window and then setting them to "Rest Position" in the Object Data Tab

Set Rest Pose

They should both (more or less) line up now.

Lined_up

Now click the X-ray and Names buttons on the Object Data window so we can see the bones.

X-Ray

Now right click the BVH armature, or left click it in the Outliner to select it. Go into edit mode on the BVH armature. Change the Object Mode to Edit, or press (T)ab key,

Object   =>  Edit Mode

Now move the bones to match the Avastar.   In my case, I used the B (box) key to draw a box around the upper part of the body, and then used G and Z keys to (G)rab it and move it upwards on the (Z) axis.

Exit the Edit mode, and go into Pose mode.

Hover the mouse over the 3-D window and press "A" several times until the BVH armature is glowing.  In the bottom window, you will see each frame of the animation lit in yellow.

Left click the last yellow line, and press "E" for "End" ( "S" moves the Start).   In my case, the last line of the animation was on frame 115:

You can use the scroll wheel to zoom in.   You can also manually set the start frames (1) and end frames by typing in the dialog boxes:

We are almost set to copy the animation from the Mixamo armature to the Second Life armature!

Rest Pose

We need to Rest Frame for the imported BVH.   Right-click the BVH armature, make sure it is in pose mode, and set the Object Properties to Pose Position

Pose_postion

Move the green line by left clicking it to the Animation frame 0, You can also type in a zero. Any frame outside the animations can be used, but zero is typical.

Now over over the 3-D windows, click A to select all the bones in the armature, then select Pose-Clear Transform-All

Clear Transform

Press "I" while hovering over the 3-D windows to insert a Keyframe.   It will prompt you for the type of recording to make. Select "Rotation".

Insert Rotation

Now you have a T-pose keyframe at position zero.

Mapping

The BVH file does not match the Second life/Opensim armature. If it did, we would not have to go through all this mess.  There is a button I mentioned earlier, "Guess Mapping".  It's on the left, in the T windows.

Click the button to the left of Guess Mapping to expose the suggested conversions:

The to-from list normally does not include the foot bones.  This is normal for Second Life armatures. Mixamo animations work fine with the guessed mapping.   You can adjust these as necessary.

Transferring the Animation

The transfer process will only copy animations that are between Start and End in the timeline.  Check that they are set correctly. Both avatars should be in Pose Mode, and in a T-pose when the animation timeline is at 0

Press Transfer Motion and wait a few seconds.

Now click Play in the timeline. I have set the original BVH armature to hidden by right-clicking  it and typing "H".

Save the animation

You have now converted the animation to SL and Opensim format.  To export it,  navigate the System to the Render menu by clicking the camera in the properties window and scroll to the bottom:

You should be able to delete the original BVH armature now, load a new one, adjust the start and T-pose in a few more clicks and click Transfer to get another one ready to upload.

-end-

Back to the Best Free Tools in Second Life and OpenSim.