Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Pages: [1] 2 3 4

Author Topic: BVH File Import into Anim8or  (Read 106077 times)

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
BVH File Import into Anim8or
« on: March 20, 2011, 09:07:09 am »

Attached below is a working BVH file import program for Anim8or.  For those that are not familiar, BVH is a motion capture file format that describes a skeleton made up of joints (points) and a timeline of XYZ Euler angles that describe the rotation of the joints.  See http://www.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html for an overview of the description.

Anim8or differs widely from the BVH file format in that Anim8or's Figure Mode uses bones for the skeleton where the orientation of the bones is described by a quaternion.  The Sequence Mode uses XYZ Euler angles to describe the change in orientation of the bone relative to the initial orientation of the bone set in Figure Mode.  In Anim8or, the rotation of the bones, when unconstrained, goes from -360 to +360 degrees.  Conversion to and from quaternions and Euler angles requires the use of trigonometric functions.  The atan2 function, for example, goes from -180 to 180 degrees.  A small change in angle in the BVH file across one of these trigonometric limits can trigger Anim8or to flip the bone 180 degrees.

Anim8or has bugs in calculating the frames between keys.  Sometimes it will interpolate wildly. 

Scene Mode has a bug (or maybe it is intentional) where the root bone orientation is completely ignored.  Since the root bone orientation is the orientation of the entire figure, the bug is overcome by keying the root bone orientation into the orientation controller of the figure in Scene Mode.

Sequence Mode has no translational motion abilities, so the BVH translation is keyed into the position controller of the figure in Scene Mode.

The program can currently read in a BVH file and create an Anim8or project file (an8).  This means it generates a skeleton in Figure Mode, a sequence that uses the skeleton, and a scene containing the figure and the sequence.  It keys the orientation and position for the figure directly in scene mode.  For reference, the program also generates a simple line object in the same position as the skeleton.  I found this useful for getting the size and posture of the object to be skinned close.

BVH files sometimes have issues as well.  Most of the Carnegie-Mellon BVH repository files have zero-offset joints.  This introduces some small error when these zero-offset joints have rotations.  Many BVH files have skeletons of very small scale.  I have added a scaling function to the program to allow you to modify the overall scale of the skeleton.  Many of the BVH file have frames-per-second (FPS) of 30, 60, or 120.  I have added the ability to change the FPS.  Please realize that the recalculation of the FPS requires computational interpolation of the motion.  I am using simple linear interpolation in that calculation that introduces some error.  To reduce the number of keys (to reduce file loading time), the program allows you to choose how often to key the original motion as well as put in a tolerance factor to not key when there is change less than this tolerance factor.  In BVH files that have a lot of fast motion, you will need to key more often.  One martial arts BVH file I tested required every frame to be keyed or significant motion error occurred.  Loading that 650 frame Anim8or file takes about 4 minutes on my computer.  Some BVH files have a first frame that is zero motion (original skeleton pose).  There is an option in the program to skip this frame in the sequence and scene.

Some minor tweaking in Anim8or is often necessary due to the fact that trigonometric functions change rapidly near the limits.  This relatively easy to do.  A BVH file I tested that had a runner turning a 90 degree turn worked fine except the right upper arm was slightly off.  A small adjustment in Figure Mode was all that was necessary.

While the program works pretty well for what it does, the results of the program are not readily portable or incorporated into existing projects.  The final product is in Scene Mode.

The program is written in VB6, so you might need to download some runtime libraries if your computer does not already have them.

Please play with the program and give me your feedback and ideas on how to make this more useful to Anim8or users.

Some hasty examples done with figures from BobIt's figure plugin are posted on youtube:

Chinese Martial Arts:  youtube.com/watch?v=KG9hBBvjoDo[/youtube]]http://www.


Hooker Walk: youtube.com/watch?v=3_AjJkl6qzk[/youtube]]http://www.


Thank you.
Logged

neirao

  • Sr. Member
  • ****
  • Posts: 624
  • Neirao
    • View Profile
Re: BVH File Import into Anim8or
« Reply #1 on: March 20, 2011, 01:30:51 pm »

hi Nicke  :)

good idea

im try but in open in anim8or has "Error reading file" importing/open..
 
can you show me "step by step" how maker this?

thanks
Logged

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: BVH File Import into Anim8or
« Reply #2 on: March 22, 2011, 12:40:26 pm »

wowwee....checking it out.
Logged
!

daniel99

  • Sr. Member
  • ****
  • Posts: 322
  • Me : Anim8or RULLZ \m/
    • View Profile
Re: BVH File Import into Anim8or
« Reply #3 on: April 02, 2011, 07:33:45 am »

Very usefull tool. Since I also use anim8or at my work, not only for personal project, this could be gold.
Btw, very usefull would be to have the possibility to import/export the camera, would be great for after effects, for example.
Logged

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: BVH File Import into Anim8or
« Reply #4 on: April 09, 2011, 09:38:47 pm »

tried a few bvh files but all movements were a bit chaotic.
then i tried this one
and it imported into anim80r, the arms dont do what they should but its still great.
i tried to convert the bvh exported by the latest version of make human alpha 1 - 6.
but it says 'runtime error 11   division by zero' ..dont know if thats of any interest,

 
Logged
!

daniel99

  • Sr. Member
  • ****
  • Posts: 322
  • Me : Anim8or RULLZ \m/
    • View Profile
Re: BVH File Import into Anim8or
« Reply #5 on: April 10, 2011, 05:20:04 pm »

Your guy seems kinda happy, captaindrewi  :)
I usualy set key every frame to be sure the movements are as natural as they can be, avoiding strange behavior.

BTW. I made some animations, and the project file is 40MB, with converted bvh file and my character. But I must say it looks amazing.
« Last Edit: April 10, 2011, 05:33:55 pm by daniel99 »
Logged

Navek

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: BVH File Import into Anim8or
« Reply #6 on: April 19, 2011, 09:53:34 pm »

wow, this looks awesome, cant wait to try it! just wondering though how would one go about making a bvh file (what kinds of motion capture equipment/ software etc. would be needed)? if any one has any tips they would be much appreciated.
Logged

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: BVH File Import into Anim8or
« Reply #7 on: April 21, 2011, 08:27:39 am »

bv hacker might help.http://www.bvhacker.com/in that once you have a bvh file ,you could edit/set it up it any way you want.there are links to free bvh files at bv hacker site.

i have played with  'bvh 2 an8' and have managed to import a number of bvh files successfully into anim8or but
how can one attach an object so that upper and lower body parts are influenced by the skeleton?
as one can't attach objects to the root bone
UPDATE....i have had my memory jogged now....'insert bone' above the root...via 'build' in the top menu bar.
« Last Edit: April 21, 2011, 06:25:48 pm by captaindrewi »
Logged
!

daniel99

  • Sr. Member
  • ****
  • Posts: 322
  • Me : Anim8or RULLZ \m/
    • View Profile
Re: BVH File Import into Anim8or
« Reply #8 on: April 22, 2011, 05:22:19 am »

Yes, you're right. Unfortunately, you can not attach one single mesh to the skeletton. I made a few animations, but my character was a robot, so this solved the problem. I attached each member separatly. When it comes to one single mesh, it is a problem.
Maybe NickE can help with this problem.
Logged

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: BVH File Import into Anim8or
« Reply #9 on: April 22, 2011, 08:46:16 am »

Dan a single mesh seems to work....after adding the extra bone to the root i added a 'bob it figure' to it and organised bone influences pretty quickly.
Roughly arranged but functioning.
« Last Edit: April 22, 2011, 08:48:01 am by captaindrewi »
Logged
!

rellik420

  • Sr. Member
  • ****
  • Posts: 652
    • View Profile
    • youtube channel
Re: BVH File Import into Anim8or
« Reply #10 on: May 12, 2011, 10:47:17 pm »

can u export the bvh 2?
Logged
h

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: BVH File Import into Anim8or
« Reply #11 on: May 13, 2011, 04:52:04 pm »

I have attached an updated version of the BVH Import program.  It automatically adds a bone to attach a single mesh.  This bone is called "0_object_bone".  When in Figure Mode, if you click on "List Items" button, it will be the first bone in the list.  Click on that item in the list to select it, and then do the "Build>Add Object" to attach the mesh to this "root" bone.  Then it is just a matter of weight painting.

The program is also a little bit more intelligent about keeping the axes from flipping.  It doesn't always work, but it is a lot better.

Feedback is always appreciated.
Logged

neodelito

  • Full Member
  • ***
  • Posts: 246
    • View Profile
    • ModuloSoporte
Re: BVH File Import into Anim8or
« Reply #12 on: June 07, 2011, 01:50:33 am »

UPDATED!!! i target your error...
all export using ",".... 
ex. 0,2323 <--- this is the error cause..
Correct 0.2323 <--- ok.

1.- Open an8 file in notepad
2.- search and replace all "," for "." in anim8or file exported and...
3.- works fine.. ;)



WOW! nickE you are..

Edited...

Extreme useful tool..

but i have error..
1. Bvh file to convert: C:\Documents and Settings\admin\Mis documentos\chinesemartialart.bvh
2. an8 file output:C:\Documents and Settings\admin\Mis documentos\test.an8
3. click in convert..
4. open in anim8or and....
Error :P
title. "just so you'd know" : "Error readyng file"

where i can get "vb runtime libraries"


« Last Edit: June 07, 2011, 02:48:51 am by neodelito »
Logged
I

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: BVH File Import into Anim8or
« Reply #13 on: June 07, 2011, 05:24:30 am »

Had a brief go.importing a random cmu bvh.
worked fine.
Logged
!

lppena

  • Sr. Member
  • ****
  • Posts: 299
  • Anim8or, does a body good.
    • View Profile
    • Truespace Anim8or Casual Modeling Forum.
Re: BVH File Import into Anim8or
« Reply #14 on: June 12, 2012, 12:12:55 pm »

Thanks Nick. Haven't tried it yet, but me being the pack rat that I am I got both anyways for possible future use. Leroy.
Logged
Pages: [1] 2 3 4