Import/Export all BVH formats into SL
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
06-28-2004 00:00
Originally, I set out to figure out how to do character animations in Blender. What I found is the method to convert all bvh files into a format that will work with SL! The problem is that Poser outputs and SL expects nonstandard root and joint keywords. To import a standard non-Poser bvh file into SL, one must simply replace the standard root and joint skeleton names with those expected by Poser and SL. Additionally, it is possible to read and modify animation files in Blender, using an add-on python script. I'll provide a link at the bottom of the page. First, here is a perl script which will convert generic bvh files (confirmed with blender output) into SL- and Poser-compatible bvh files. #!/usr/bin/perl
while(<>){ s/Hips/hip/; s/Chest/chest/; s/Neck/neck/; s/Head/head/;
s/LeftUpLeg/lThigh/; s/RightUpLeg/rThigh/; s/LeftLowLeg/lShin/; s/RightLowLeg/rShin/; s/LeftFoot/lFoot/; s/RightFoot/rFoot/;
s/LeftCollar/lCollar/; s/RightCollar/rCollar/;
s/LeftUpArm/lShldr/; s/RightUpArm/rShldr/; s/LeftLowArm/lForeArm/; s/RightLowArm/rForeArm/; s/LeftHand/lHand/; s/RightHand/rHand/;
print; }
That's it! It's just a substitution of root and joint skeleton keywords. I suspect that this or a slight modification of this will fix the inability to import any bvh file into SL. To import and export bvh files in blender, do this: 1. Download blender from http://blender.org2. Download Reevan McKay's Blender python script here3. Run the above perl script on the bvh output If you like this, send me some cash in world! jj.  ~Ulrika~
|
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
|
06-28-2004 00:03
Cool. Nice job, Ulrika 
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
06-28-2004 16:24
There's a rumor that some programs require that the floats in a bvh file be truncated down to two decimal places. That can be accomplished by adding the following line right before the "print;" statement. It's probably not needed but if you have problems give it a try.
s/(\d+\.\d{2})(\d+)/$1/g;
By the way, these are perl regular expressions. They are wickedly powerful for manipulating text quickly and easily.
~Ulrika~
|
Chage McCoy
Aerodrome Janitor
Join date: 23 Apr 2004
Posts: 336
|
06-29-2004 06:58
ARRRGGHHHH
I am going nuts because I cannot finmd the Blender module for python. Any hints?
|
Goshua Lament
Registered User
Join date: 25 Dec 2003
Posts: 703
|
06-29-2004 18:08
I am really inept at scripting. Could someone please explain how to run the python script on the bvh output? Thanks.
_____________________
Flickr Second Life Photo GalleryI no longer regularly login to SecondLife, but please contact me if an issue arises that needs my attention.
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
06-29-2004 18:48
To import and export bvh files in blender, do this: 1. Download blender from http://blender.org2. Download Reevan McKay's Blender python script here3. Run the above perl script on the bvh output The python script is provided by Reevan McKay. Everything you need to import, modify, and export bvh files is there. He even provides sample bvh files. For a quick start grab the default_done.zip file and open it in blender. The bvh should be right there for you to select in blender. If you can't get this far, then this technique is too complicated. It's OK! Poser is vastly more capable for doing animations than blender is at the moment. This technique is really for the very resourceful and computer savvy only. After you export a bvh file, it can be converted with a perl (not python) script into the correct SL format. Take the code in the top post, save it as a text file called "bvhconvert", and make the file executable. To convert bvh files in Linux, MacOS, or Unix one simply does this: ulrika@home> bvhconvert < old.bvh > new.bvh In windows you have to install perl (or a real operating system) first, then run "command" (it gives you a DOS terminal), and finally execute the same command given above. For unix users, using a perl script is trivial. For windows users who feel a little confused right now, I'd just skip it. It's OK! At the moment this is a kludge to get things working for the ambitious. In the future expect a modification of the python script to eliminate the perl script. Maybe I'll even create a web-based converter. For now though this is it.  ~Ulrika~
|
Gaudeon Wu
Hermit
Join date: 5 May 2003
Posts: 142
|
06-29-2004 19:24
For those with windows that wish to install perl visit http://www.activestate.com/Products/ActivePerl/. ActivePerl is free. Great walkthrough Ulrika 
_____________________
All under heaven...
|
Chage McCoy
Aerodrome Janitor
Join date: 23 Apr 2004
Posts: 336
|
06-29-2004 21:43
I know that ulrika  but when I run the bvh.py, I get it exiting with "missing Module: Blender" :\
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
06-30-2004 12:33
When you have a software problem, it's important to send verbose information. Your first (and for that matter second) post doesn't help anyone: From: someone I am going nuts because I cannot finmd the Blender module for python. Any hints? You need to send your operating system and version, your version of blender, what files you are opening specifically, and what the exact error is. One cannot debug software in a vacuum. Realistically, I'd skip asking technical blender questions here and instead direct them towards the creator of the python script or even to the blender website. ~Ulrika~
|