This post is going to quickly go over the two methods I used to actually get the animations into Source.
Method 1: BVH
Ipisoft exports to the BVH format, which is one of the standard motion capture formats. It stands for Biovision Hierarchy, and it was developed by Biovision, who went bust a while ago. This is the best format in my opinion, because it is very easy to read and parse.
A BVH file has two parts:
- the hierarchy itself, which describes the skeleton and initial pose.
- The transformations that the skeleton goes through to animate it.
The hierarchy starts with the ROOT node, which for humans is usually the centre of gravity. The hierarchy itself is recursive: each node contains data relevant to it (like position, rotation), and further subnodes.
The position of the node is defined by it’s offset from it’s parent, not an absolute position in the world. If it was absolute, it wouldn’t move when it’s parent moved. You’d move your arm, but your hand would remain on the desk.
The rotation of the node is defined as the rotation relative to it’s parent.
There exist a massive amount of tools for reading and manipulating this data, so I didn’t really need to write another one. It was a good job too – I was struggling with the XSI Mod tool.
XSI Softimage is the suite that Valve origianlly used for modelling & animating Half-Life 2. In 2004, when Half-Life 2 was released, XSI had a free, cut down version of the tool for Modders. It was called the XSI Mod Tool.
Valve also created a whole bunch of addons for it, to export stuff to the Source Engine.
Since Softimage got bought out by Autodesk, the free versions are less and less useful, the tools are out of date and features get locked off. You can find the old versions around, but it’s difficult and they are not supported much.
I’ll do a quick tutorial on it here anyway.
Autodesk Softimage Mod tool 7.5
You’ll need to find the ValveSource addons for Softimage, which are either on the net, or in the Source SDK folder.
Open the XSI Scene file “SDK_Male_reference.scn” which can be found in “C:\Program Files (x86)\Steam\steamapps\USERNAME\sourcesdk_content\hl2\modelsrc\humans_sdk\XSI_scn_files” or similiar.
You should get this chap:
He’s very low in IQ and poly count, but he’s lovable just the same, because he’s ideal for testing stuff out.
Press “8” on the keyboard to bring up the scene expolere, and middle click on the “Valve Biped” node.
Middle clicking recursivley selects everything inside the node.
Go to Animate->MOTOR->Tag Rig
This will bring up the tag rig dialogue. It defaults to a human biped, and has entries for all the major bones.
You need to go through each diagloue, click the bone name button, eg “cog”, and select the corresponding bone on the human skeleton.
Here is an example:
I’ve chosen centre of gravity (cog) as Bip01_Pelvis. Most of them are easy enough to work out, but get it wrong and the animation will be….funky.
Once you’ve finished tagging the rig, SAVE it…it will save you a vast amount of time.
You then need your BVH.
There is a large library of free ones here.
Tagging the BVH rig
Go to Animate->MOTOR->Mocap to Rig
You’ll get this dialgoue:
You need to
- Select BVH as the format
- Select a BVH file
- Create a tag template This will launch the same window as previosuly. This time, you want to tag the BVH you’ve just loaded. Once done, save this one too.
- Select Target Model This should already be the ValveBiped, if not, select it from the Scene Explorer.
I’ve uploaded my Valve Biped tag file and by BVH tag file here, as well as a mocap file I took from the site mentioned earlier. Link: http://daft-ideas.co.uk/rnd/Clear%20Skies/mocapeg/
Now, by the power of greyskull, you’ll animate the Valve Biped:
This is rendered from Softimage, because while making this post I couldn’t be bothered to export the skeletal animation into the Source Engine.
I’ll cover how to actually get this into game next post. This was meant to be quick, but oh well. I still need to cover the other method I used 🙂