After seeing David Lenaerts excellent Broomstick example, I’ve been eager to find a workflow to bring motion capture data into Flash. It took a while to work out, not being familiar with the MD5 format at all, but it turned out those nice guys at Away3D had already done all the hard work. I was thinking I’d have to map the bones of MAX’s Biped to some other custom “MD5 scheme”, but to my delight I discovered the parser is extremely generic and works with any bone structure I throw at it. I’d like to share my findings, not least in case I forget them before I need to do it again :O)
First a quick demo to show where we’re headed…
This file format allows renaming the segments of a BVH file to match the convention used in Autodesk 3D Studio Max. The name defined by the user is associated to the predefined label for the biped segment. Humerus = L UpperArm.
3D character animations in Biped format for 3D Studio Max and other 3D software that accepts.bip file format. Mobility - Rifle - Pistol - Zombie - Ninja - Punch - Archviz.Compatible with 3D Studio Max and other 3D Software packages that accept.bip file format. May 17, 2011 Now it's time to load some Motion Capture (or Mocap) Data. Select Bip01 (easiest by pressing the H key and selecting it from the list of scene objects) and then under the motion panel, press the Load icon and find a.bip file from your harddrive. If you don't have any.bip files, here's one from the Max Tutorials. If you have a lot of character studios rigged bipeds and need to load the same animation (walk loops, conversation.) on all of then, so this script might help you. It's a.mzp file that you can just drag and drop into 3ds Max or run through the MAXscript menu.
(Click image to open, Flash 11 or incubator is required.)
- Rigged model, downloaded free from TurboSquid
- Copy of 3D Studio Max (My copy is Max 9, others should work just as well)
- MD5 Export Script http://www.doom3world.org/phpbb2/viewtopic.php?t=1914
>Normally you use Max’s Physique modifier together with Biped. This is a quite advanced system using muscles and tendons. The MD5 format doesn’t support that system directly, so we need to use a Skin modifier instead.
(Click for larger image)
Where it says Bones, press the “Add” button and assign all the bones of the Biped to the Skin modifier (this will be all the objects in the scene). Then you modifier stack should look like this:
Now it’s time to load some Motion Capture (or Mocap) Data. Select Bip01 (easiest by pressing the H key and selecting it from the list of scene objects) and then under the motion panel, press the Load icon and find a .bip file from your harddrive. If you don’t have any .bip files, here’s one from the Max Tutorials.
So now we should have an animation when you press play. The Soccer player should move in perfect synch with your Biped. You might notice a few odd bulges, especially round the legs and feet.
To make it easier in 3D Studio, and other 3D programs, the bones are assigned an Envelope. This simply means a sausage shape around the bone’s core that encapsulates the vertices. If in 3D studio, we select the soccer player again and “Edit Envelopes”, when we select a bone from the list, the envelope of that bone is shown in the viewport.
Note, your own viewport may not look exactly the same, depending on the settings under “Display”.
3d Studio Max Bip Files Motion Activated
For some reason the texture coordinates get reversed between md5 and Broomstick. I guess this may change in future builds, but for now the work around was simply to reverse the number on the players shirt in Photoshop.
(They are compiled against the github version, 24th may.)NOTE: A difference in the coordinate space between MD5 format and Flash results in all models and animations being mirrored on the x-axis when viewed in Away3D 4.0
To see animations and models as they appear in MAX, simply apply a scaleX = -1; after import to Away3D.
Enjoy! And please comment with your successes, failures, comments and tips!
Free.bip Files Download
UPDATE: In response to the high demand, (from MatOfLink at least) here’s a method for putting guns in hands, shoes on feet, hats on head, etc.
When your MD5 mesh has loaded, add a Loader3D to it. This is where your prop will appear.
gunholder = new Loader3D();
gunholder.addEventListener(LoaderEvent.RESOURCE_COMPLETE, adjustGun);
_mesh.addChild(gunholder);
So far so good. When the gun loads it will likely be twisted in relation to the rest of the model, depending on which format it is and which software it was exported from. For obj files coming from Max I’ve found this simple routine aligns the object the same way as in Max. At the same time you can apply materials.
private function adjustGun(evt:LoaderEvent):void {
Free Bip Files For 3ds Max
var i:int;
var gunMat:BitmapFileMaterial = new BitmapFileMaterial(“assets/images/gun.jpg”);
for (i = 0; i < gunholder.numChildren; i++) {
var m:Mesh = gunholder.getChildAt(i) as Mesh;
m.rotationX = 90;
m.rotationY = 90;
m.material = gunMat;
}
3d Studio Max Bip Files Motion Sensor
}
Now your gun should be in the viewport. You need to know the index of the particular bone you want to follow. This you can either read in the debugger, by trial and error, or via the jointIndexFromName from name function on the skeleton class (later…)
Once you know the index of the bone (called “joint” in Away3d) you want to follow add this to your rendering loop:
3d Motion Studio
gunHolder.transform = (_mesh.animationState as SkeletonAnimationState).globalPose.jointPoses[26].toMatrix3D();
3d Studio Max Bip Files Motion Download
And that’s it! You basketball player is now armed and dangerous.
If I get round to it I’ll post an updated source. Otherwise shout out below for help!
Now let’s see some games…