bvh motioncapture-animations with blender
CAUTION: When I wrote this I was quite new to blender! It is very experimental
goal:
- load bvh file with armature
- load new bvh-file to same armature for a change on the fly
step by step:
- visit this blender-resource for bvh-animation and get the the file default_done .zip
- Enter the “Blender BVH file repository” (Link in hte upper part of the page)
- Here are listed all animations you will be able to use later. Download a couple of them (minimum one)
- unzip the default_done.zip-package and double-click default.blender to open it in blender
- if you start the animation you see that there is already a ballet-movment
- NOW comes a hack. For some reason I was not able to use the script as mentioned in the text box. Therefore I patched the bvh-importer-script. You have to know I am new to blender and that was my very first contact with python. The problem here is that if you try to load the bvh-animation’s empties the empties names are already there and therefore the current script add new empties instead of overwriting the to the armature connected empties. I just check if the empty-name is already present if yes take the corresponding object instead of using a new one. That’s it
- Open the file: \Blender Foundation\Blender\.blender\scripts\bvh_import.py in an editorĀ (This directory is NOT the one in program files but in your accounts applicationdata). DON’t forget to keep a copy of that file before you start editing.
- The script just replaces one snippet wiht the other. You can download bvh_import here! Copy&Paste is not possible cause Python uses blocks for structures and the blog destroyes it.
CAUTION: YOU USE THIS SCRIPT ON YOUR OWN RISK!!!!!!! AFTERWARDS IT IS ONLY POSSIBLE TO LOAD ONE(!) ANIMATION PER BLENDER-FILE! THIS IS JUST A FIRST HACK!
-----------------------------------------------
def add_ob(name):
ob = scn.objects.new(”Empty”)
objects.append(ob)
print name
return ob
———————————————–
and replace it with
-----------------------------------------------
def add_ob(name):
ob = “nichts”
for counter in scn.objects:
if counter.name == name :
ob = counter
if ob == “nichts” :
ob = scn.objects.new(’Empty’)
objects.append(ob)
else:
print “FOUND:”+name
return ob
———————————————
- Now we are ready to import another bvh-file
The bvh-files that are fixed for that armature/empties are already inside the blender-files of the repository-zips. Unzip one and open the blender-file. Move to the text-window that begins with
HIERARCHY
press ALT+SHIFT+F and save the file to somewhere.
- Back to our default_done-project. File->Import->Motioncapture (.bvh) and select the in the step before saved .bvh-file and use the “Import BVH”-Button. THe following display appears:
deselect “As Armature”, select “As Empties”, Scale: 1.00
Press Ok. The new bvh-animation is loaded and overwrites the old animation.
- Well that’s it. Now you can use vertex-groups to glue your model to the armature. For that use the Rest Postion (In Buttonsview: Armature->DeformOptions->Rest Posiiton)
Have a look here for that.
Finally I have to say that this is for sure not a clean solution. But that was for me as a blender-beginner the easiest way to achieve my requirements. Maybe someone out there as a better approach. don’t hesitate to contact me.
Other good resources: