Fun with BVH Files (the code)
by Chris Calef · in Torque Game Engine · 05/14/2008 (12:35 am) · 25 replies
Okay, I should know the right way to do this by now, but I have some code that goes along with the blog I just posted, and I need to put it somewhere that only Torque licensees can access. I'm going to post a link to a zip file here, since this forum is private, but it is still stored on my server at an accessible location. Hopefully that's okay.
For anyone who came here because of my blog, the files you want are here:
www.brokeassgames.com/blogs/chris/05-12-08/BVH_Resource.zip
If you want to see the blog, it is here:
http://www.garagegames.com/community/blogs/view/14732
The file called ShapeBaseCode.cpp contains new functions and console methods which can be appended to your ShapeBase.cpp, as well as a couple of function declarations at the top that need to go into ShapeBase.h.
I've also included some sample .bvh files to play with, and the default.cfg file I used for Kork. Outside of that, you're on your own, this should be enough to get you started. The bvh files have to go into a "bvh" directory right under the directory your dts model is in.
Once you load some motion capture files onto your model, you can use the "saveOut()" console method to write all sequences out to a file called "allSeq.dsq", and then change your player.cs to include that instead of all the individual dsqs.
I have yet to write the function that saves sequences out one at a time, though will probably get to that shortly.
Have fun!
Chris
For anyone who came here because of my blog, the files you want are here:
www.brokeassgames.com/blogs/chris/05-12-08/BVH_Resource.zip
If you want to see the blog, it is here:
http://www.garagegames.com/community/blogs/view/14732
The file called ShapeBaseCode.cpp contains new functions and console methods which can be appended to your ShapeBase.cpp, as well as a couple of function declarations at the top that need to go into ShapeBase.h.
I've also included some sample .bvh files to play with, and the default.cfg file I used for Kork. Outside of that, you're on your own, this should be enough to get you started. The bvh files have to go into a "bvh" directory right under the directory your dts model is in.
Once you load some motion capture files onto your model, you can use the "saveOut()" console method to write all sequences out to a file called "allSeq.dsq", and then change your player.cs to include that instead of all the individual dsqs.
I have yet to write the function that saves sequences out one at a time, though will probably get to that shortly.
Have fun!
Chris
About the author
#22
BVH is more than just a file format, it's a bone structure standard.
Sometimes I find BVHs that deviate from that standard bone structure, it's kind of a bummer, but it can be fixed sometimes.
Attaching extra nodes is great as long as the original BVH structure is left standard.
If the orginal BVH skeleton is modified, chances are that the anims you find won't play as orginally intended.
So extra spine nodes, etc. can degrade the art fast, even if you can delete and rename nodes.
Sometimes with time and effort you can get things lined up perfect, but it better be a damn unique anim for the effort!
IMO it's really important to keep the standard pure.
Besides all the mocap systems that support it, I really like Poser, MilkShape and FragMotion. ;)
I'm pretty sure Max and Motion Builder support it as well, but being a broke indie, I can't afford either.
Pretty much I'm just trying to say: "Keep BVH pure, perfect mocap anims are abundant."
05/15/2008 (3:46 am)
BVH is more than just a file format, it's a bone structure standard.
Sometimes I find BVHs that deviate from that standard bone structure, it's kind of a bummer, but it can be fixed sometimes.
Attaching extra nodes is great as long as the original BVH structure is left standard.
If the orginal BVH skeleton is modified, chances are that the anims you find won't play as orginally intended.
So extra spine nodes, etc. can degrade the art fast, even if you can delete and rename nodes.
Sometimes with time and effort you can get things lined up perfect, but it better be a damn unique anim for the effort!
IMO it's really important to keep the standard pure.
Besides all the mocap systems that support it, I really like Poser, MilkShape and FragMotion. ;)
I'm pretty sure Max and Motion Builder support it as well, but being a broke indie, I can't afford either.
Pretty much I'm just trying to say: "Keep BVH pure, perfect mocap anims are abundant."
#23
Are they, though? I have yet to find a perfect front kick. They need better actors for these things. Hook me up! :-)
05/15/2008 (10:58 am)
"perfect mocap anims are abundant"Are they, though? I have yet to find a perfect front kick. They need better actors for these things. Hook me up! :-)
#24
G.I.G.O.
05/15/2008 (12:46 pm)
Ok, ok, so maybe some of the actors need to be taught to "keep their hands up" (easily fixable if I could meet them) and some tips on form, but the data is clean. :pG.I.G.O.
#25
Can't wait to play around with it! Also, if anyone's interested, I've found a few links where you can get your hands on free motion capture files (bvh or asf/amc - converter to bvh link included):
www.animazoo.com/Free_downloads.aspx
www.truebones.com - commercial, $1 apiece + 20 free (demo) bvh-s
mocap.cs.cmu.edu/ HUGE collection in ASF/AMC format, here's a converter to BVH
www.charactermotion.com/products/motion_capture/index.html - 4 files, including a banana slip similar to the one seen in A:FX. - has commercial packs for $1 per motion.
gl.ict.usc.edu/animWeb/humanoid/ - as mentioned on the page, some captures have quality issues, might also want to check the programs section for a Maya importer and a bvh/asf viewer/editor.
www.mocapclub.com/ - "gigs" of mocap data, although in point and not skeletal format - I am not sure if it is possible to convert between them without the use of animation software.. it'd be interesting to know how it could be done
Check for licenses in case you want to use these, just to make sure...
You might also want to get familiar with bvhacker.
Edit: fixed typo in url
05/22/2008 (5:29 am)
This is an awesome resource, thank you Chris! Can't wait to play around with it! Also, if anyone's interested, I've found a few links where you can get your hands on free motion capture files (bvh or asf/amc - converter to bvh link included):
www.animazoo.com/Free_downloads.aspx
www.truebones.com - commercial, $1 apiece + 20 free (demo) bvh-s
mocap.cs.cmu.edu/ HUGE collection in ASF/AMC format, here's a converter to BVH
www.charactermotion.com/products/motion_capture/index.html - 4 files, including a banana slip similar to the one seen in A:FX. - has commercial packs for $1 per motion.
gl.ict.usc.edu/animWeb/humanoid/ - as mentioned on the page, some captures have quality issues, might also want to check the programs section for a Maya importer and a bvh/asf viewer/editor.
www.mocapclub.com/ - "gigs" of mocap data, although in point and not skeletal format - I am not sure if it is possible to convert between them without the use of animation software.. it'd be interesting to know how it could be done
Check for licenses in case you want to use these, just to make sure...
You might also want to get familiar with bvhacker.
Edit: fixed typo in url
Associate Chris Calef
BrokeAss Games
Yeah, that's what the cfg file is for, you can have whatever ordering of nodes you want in the dts file. As long as you map them to the nodes in the bvh file correctly, everything will be fine.
Arm chains being parented off the wrong spine nodes is a little messier, though. Worst case is you'd have to lock more parts of the spine and associate the abdomen bvh node with "spine2" or whatever, but it should be possible to make something work.
That's cool about bvhacker being able to delete nodes -- hadn't gotten that far with it yet. That might be a decent workaround until the importBVH function gets fixed to handle skipping unused bvh nodes.