BVH Motion Capture I/O Update 04/06/08

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

BVH Motion Capture I/O Update 04/06/08

Post by ideasman » Wed Mar 24, 2004 10:27 pm

UPDATE 05/04/04
* Both Importer and Exporter should be several times faster.
Fixed a horrible bug in the exporter that compleately stuffed up exporting locations.
* Default no prefix (could muckup importing multiple files into the 1 scene)
* added 40 odd files to BVH.zip More fun examples
_________________________________

UPDATE Exporter released too! see link below
To export just select the root node of the hierarchy and run the script.
Frame rate is hardcodod until I can get it from python and length of BVH is designated by the start and end frame.
____________________________
Hi, I just finished writing my BVH importer v1.0
This imports motion capture data into blender as a hierarchy of emptys.
So you can see a humen figure move just like in real life and apply the realistic motion to a figure in blender.

This script dosent require any brain power so even if you know nothing about python you'll still be able to use it. The script is launched from the import menu so copy it into your blender scripts dir for blender to load.

bvh.zip contains a heap of free BVH files I found on the net all zipped up into one file. Its worth having a play with these- they are a bit of fun.
http://members.iinet.net.au/~cpbarton/bvh_import.py
http://members.iinet.net.au/~cpbarton/bvh_export.py
http://members.iinet.net.au/~cpbarton/bvh.zip

The script has no user interface, I prefer a simple no hassel import that dosent involve different steps.

I tried to get the existing one working but had some problems.
http://www.centralsource.com/blender/bvh/files.htm
And it seems that with each import there is some manual steps required.

TODO (for version 1.2)
* Create bones when importing
* Make an IPO jitter removal script (some noise is a problem with bvh files)
* Work out a better naming system (need to make names unique but not long and also able to re-export qeeping orig names.)


Thanks
interested in your feedback
Last edited by ideasman on Tue Jun 08, 2004 7:31 am, edited 5 times in total.

Oso
Posts: 17
Joined: Sat Oct 19, 2002 2:03 pm
Location: Massachusetts, USA
Contact:

Post by Oso » Wed Mar 24, 2004 10:44 pm

Great work, ideasman!

I've been wanting to play with the BVH stuff for a while.

Panther
Posts: 0
Joined: Tue Mar 04, 2003 7:55 pm

Post by Panther » Thu Mar 25, 2004 1:30 am

Truely great work Ideasman !!! :D

I was a fan of Revaan's original BVH work, but this seems very promising indeed.

Bob Holcomb ( http://bane.servebeer.com/programming/b ... index.html ) was looking at doing a script like this ( to add to his ever-growing collection of import / export scripts ), so maybe it's worth co-ordinating your efforts with him - Just an idea, no Flames necessary !!! :wink:

Blend on, blend well...

wwwill
Posts: 0
Joined: Fri Dec 26, 2003 5:00 pm

Post by wwwill » Thu Mar 25, 2004 3:44 am

This sounds very promising. If this script could be connected to the MakeHuman Project - http://www.dedalo-3d.com/, that would be a thing of beauty. Maybe I can do nice character animations yet

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Thu Mar 25, 2004 4:14 am

Geez MakeHumen...... didnt think of that.
Mabe automated rigging and vert weight assignment.
(rather then the nearest to bone weight assignment)

that would be speed up character animation in blender so much.

You have me tempted now :)

I originaly ment only to make blender into BVH postprocessing util, so I could open/save bvh files.

wwwill
Posts: 0
Joined: Fri Dec 26, 2003 5:00 pm

Post by wwwill » Thu Mar 25, 2004 6:37 am

I just looked at the site and they seem to have a rig in the works. Maybe you could get in touch with Manuel who I believe is the creator and coordinator of this project to see what the final rig looks like and if it will work with the BVH stuff you have implemented so far. I would hate to see MH come out with a rig that doesn't compliment your efforts thus far. I'll try to throw the link to this thread around here and Elysiun.

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Thu Mar 25, 2004 7:07 am

I did some searching, do you need actual code written for the Euler to matrix rotations, or will a pointer to an algorithm work?

I'm not familiar with Python (yet) but here is an algorithm


http://www.flipcode.com/documents/matrfaq.html#Q36

From your sample code you posted I could likely code it up for you, but it is trivial to code it yourself...

Tell me whichever works best for you....

LetterRip

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

Post by pildanovak » Thu Mar 25, 2004 12:21 pm

TODO (for version 1.2)
* Create bones when importing
Wouldn't it be good to make an option for importing a bvh on a ready armature(from compatible scripts), so you could make several actions for one armature?
this surely is the same idea like that one with makeHuman. But bvh-files can be very different, depending on the structure and naming of the bones. so if makehuman has a certain rig, it should be compatile with some of the rigs used standardly for motionCapture, so you can use at least some of the BVH files for it.

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Thu Mar 25, 2004 1:34 pm

pildanovak wrote:
TODO (for version 1.2)
* Create bones when importing
Wouldn't it be good to make an option for importing a bvh on a ready armature(from compatible scripts), so you could make several actions for one armature?
this surely is the same idea like that one with makeHuman. But bvh-files can be very different, depending on the structure and naming of the bones. so if makehuman has a certain rig, it should be compatile with some of the rigs used standardly for motionCapture, so you can use at least some of the BVH files for it.
I'll probable make a seperate script called 'Empty2bones' It will be accessable from the blender menu but the bvh importer will import the function and have a submenu with the option to make bones from the empties.

This isnt particulaly hard, if anybody would like to do an empty2bones scripts then I would be happy :) Right now Im making the BVH exporter/

As you say, the ability to use an existing rig wouold be good... will think about it.
But I think I'll make an function that takes the empties and makes use of them in different ways.
This can still be accessable from the main menu but could reside in a seperate scripts.


Seperate funcs would be
* empty2bones
* bones2emptys
* empty2existimgBones
* Ipo smoothing.

If anybody wants to write these that would be cool (mainly the 1st) otherwise I'll do it when I have the time.

- Cam

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Mar 26, 2004 7:27 am

I have the BVH exporter with everything working except the euler rotation conversion,
It loads in motion builder too- just the rotations stuffed.
anubody want to lend a hand?
- Cam

ilac
Posts: 131
Joined: Mon Oct 14, 2002 8:24 am

Post by ilac » Fri Mar 26, 2004 8:25 pm

ideasman wrote:I have the BVH exporter with everything working except the euler rotation conversion,
It loads in motion builder too- just the rotations stuffed.
anubody want to lend a hand?
- Cam
Can't the new maths python module handle that for you?

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Mar 26, 2004 10:17 pm

ilac wrote:
ideasman wrote:I have the BVH exporter with everything working except the euler rotation conversion,
It loads in motion builder too- just the rotations stuffed.
anubody want to lend a hand?
- Cam
Can't the new maths python module handle that for you?

Possibly... I couldent find any docs on mathutil, anybody know whare I can get it?

Theeth recommends using the objects matrix for getting its rotation/size/location, so I should be able to convert the matrix to a euler rotation.
Again- if anybody has a function matrix2euler rotation I would be very happy.

- Cam

theeth
Posts: 500
Joined: Wed Oct 16, 2002 5:47 am
Location: Montreal
Contact:

Post by theeth » Sat Mar 27, 2004 5:50 am

Look in there: http://www.clubinfo.bdeb.qc.ca/~theeth/vecf.py

rather old module made by eeshlo and myself to handle vectorial math.

Martin
Life is what happens to you when you're busy making other plans.
- John Lennon

ilac
Posts: 131
Joined: Mon Oct 14, 2002 8:24 am

Post by ilac » Sat Mar 27, 2004 8:11 pm

ideasman wrote:
ilac wrote:
ideasman wrote:I have the BVH exporter with everything working except the euler rotation conversion,
It loads in motion builder too- just the rotations stuffed.
anubody want to lend a hand?
- Cam
Can't the new maths python module handle that for you?

Possibly... I couldent find any docs on mathutil, anybody know whare I can get it?

Theeth recommends using the objects matrix for getting its rotation/size/location, so I should be able to convert the matrix to a euler rotation.
Again- if anybody has a function matrix2euler rotation I would be very happy.

- Cam
There are some posts related to the commit and some example snippets here:
http://www.blender.org/pipermail/bf-pyt ... /date.html
Look for the ones called mathultils (obviously! :wink: )

Then again Theeth knows what he's talking about when it comes to python. I don't. So pay more attention to his advice than mine! :D

theeth
Posts: 500
Joined: Wed Oct 16, 2002 5:47 am
Location: Montreal
Contact:

Post by theeth » Sat Mar 27, 2004 9:03 pm

No, you're right, it would be a good idea to use the new module.

Martin
Life is what happens to you when you're busy making other plans.
- John Lennon

Post Reply