Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Pages: 1 [2] 3 4

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

civic71

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: BVH File Import into Anim8or
« Reply #15 on: December 08, 2012, 02:24:02 pm »

Thank you very much for this converter . After change "," to "." it worked :)
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: BVH File Import into Anim8or
« Reply #16 on: June 02, 2013, 03:44:22 pm »

A user (Daniel) found a set of BVH files that could not be converted with the current version.  Those files had 6 channels for each bone as opposed to the normal 3 channels.  It was causing the program to crash.  An updated version is attached.

Feedback is appreciated.
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #17 on: June 12, 2015, 02:54:57 pm »

Is there a possibility you could release source for this? 
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: BVH File Import into Anim8or
« Reply #18 on: June 13, 2015, 12:37:16 pm »

The source code is for Visual Studio 2013 (available free).

Enjoy!
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #19 on: June 14, 2015, 08:48:24 pm »

Thanks :) I do not know if will help, but I am trying to convert euler angles to anim8or relative to bone. Not sure how bvh stored them, but I'm having problems in the final step, which is mapping euler angles to instead axis-angles of the bone XYZ.  How perfect did you get that conversion going?  (Maybe bvh isn't stored that way, as euler).
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: BVH File Import into Anim8or
« Reply #20 on: June 14, 2015, 09:04:46 pm »

SubDrag,
Can you please be more specific about what you are trying to do?  Euler angles relative to what?  Is there a source format you are using?
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #21 on: June 14, 2015, 09:17:25 pm »

Yeah, FBX -> an8.  I have everything but the final step, which is to take the bones absolute orientation, and map the Euler angles per keyframe I have, to the 3 axis-angle anim8or uses.  I thought you would have done something similar with BVH.

It is what anim8or has in its file as "floatkey" under "jointangle" and then "track"
« Last Edit: June 14, 2015, 09:18:54 pm by SubDrag »
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: BVH File Import into Anim8or
« Reply #22 on: June 14, 2015, 11:45:39 pm »

All the math you need is in the BVH2Anim8or code.  I have also attached a SMD2Anim8or source.  It does something very similar. 

Anim8or does not use a 3 axis-angle format.  Anim8or uses quaternions to encode the orientation of the bone relative to its parent.

Do you have a link to the FBX format specification where it describes the reference frame for the bone orientations?

Please read the thread http://www.anim8or.com/smf/index.php/topic,5005.msg37381.html#msg37381 for some discussion of the math required.
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #23 on: June 15, 2015, 12:14:30 am »

Ah, I'm talking about the actual animation track (got the bones proper, I use a bone, and then a 0-sized bone in anim8or).  I'm not sure about spec, I use the FBX SDK api, but FBX is stored as relative offsets by joint, and each rotation at a joint is Euler X Y Z (in that order).  The translation to and from anim8or of skeleton I have working.  It's the animation keyframe tracks that I am trying to convert.  In FBX, each joint rotation is stored in euler angles are not relative to the bone, they are normal, unlike anim8or which appears relative to the bone, which appears to me to be 3 angle rotations, of a coordinate axis aligning with the bone (essentially, transformation of (0,1,0) into bone orientation), which seems like multiplication of 3 axis-angles or something. 

I don't see it in SMDA2Anim8or, but it must be in the bvh one somewhere, the angles of the animation at each joint, into anim8or format

For example, a 0-sized bone with absolute resolved orientation quaternion  of:
x   0.52577096   
y   0.084030904   
z   0.40771002   
w   0.74180597   
, and euler rotation 58.6767 33.600 138.3259 in FBX.  That translates to in anim8or 30 60 40 (this is goal, to find out these numbers using math for general case).  Well, the part I am trying to figure out is how to automatically go from those Euler angles, with known orientation that I already figured out, into anim8or animation angles.
« Last Edit: June 15, 2015, 12:26:39 am by SubDrag »
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: BVH File Import into Anim8or
« Reply #24 on: June 15, 2015, 11:33:03 pm »

The missing pieces of required information is the reference frames for the rotations.  Does FBX use a right-handed or left-handed reference frame?  Are the skeletal orientation given in the global reference frame, object reference frame, or local reference frame?  Are the keyframe joint rotations given in the global reference frame, object reference frame, or local reference frame?

Since you already have the Anim8or skeleton constructed from the FBX file, you have some knowledge of the FBX reference frame.  Otherwise the skeleton would be distorted or rotated.   So, essentially what you need to do is transform the FBX Euler rotation angles from whatever reference frame they are in to the Anim8or local bone reference frame (the rotation of the bone relative to the parent).

The BVH2Anim8or source code routine "Calc_Figure_Orientation" calculates the each bone orientation relative to its parent bone.  The root bone (the ultimate parent) is located in the Anim8or global reference frame Left-Handed (0,1,0).  The routine "Calc_NetOrient" calculates the each bone orientation relative to the Anim8or global reference frame.  The routine "Calc_Sequence_Motion" transforms the BVH keyframe joint rotations to the Anim8or local bone reference frame.

I know this is very confusing and extremely frustrating.  While writing the BVH2Anim8or and SMD2Anim8or converters, I kept having to remind myself "What frame I am in?  What frame do the actions take place?  What frame does Anim8or need?"
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #25 on: June 16, 2015, 12:57:46 am »

Thanks, that is complicated, I'll have to try and make sense of it.  FBX is left-handed, XYZ euler.  Skeleton translation is relative to parent.  It's probably the same as BVH, though I'm not that familiar with BVH.  As you mentioned, just the last step is heavily thwarting.
« Last Edit: June 16, 2015, 01:04:21 am by SubDrag »
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #26 on: June 17, 2015, 01:17:37 am »

Hi again, I was able to get what I wanted to do, though a different way, but it is not working perfectly.  I think there is a problem with your BVH convertor also, as I was trying to see if it did better.  It does not do well on my BVH test. 

Source:
http://www.mediafire.com/download/y78hcvzapvh4hne/animation.fbx

BVH attempt:
http://www.mediafire.com/download/i140norhf31gd48/DefaultAnimation.bvh
http://www.mediafire.com/download/49225tchu0ckdv6/DefaultAnimation.an8

My attempt (using my tool):
http://www.mediafire.com/download/k9311miosdl9d4w/myanimationconvertattempt.an8
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 1532
    • View Profile
Re: BVH File Import into Anim8or
« Reply #27 on: June 17, 2015, 12:33:45 pm »

There are 6 ways to convert Euler angles into a quaternion, depending on the order that the X Y and Z angles are applied.  Unfortunately I don't remember which order Anim8or uses!  I'll post the code it uses when I get back from Italy but that won't be until mid July.

There are also some misconceptions in some of these posts about how Anim8or works which I 'll address as well. It's too difficult to write much on my tablet or I'd do it now :)
Logged

Trevor

  • Full Member
  • ***
  • Posts: 167
  • Goldfinger64 Dev OS:10.0.17017 Gfx:RX480 Loc:UK
    • View Profile
    • LS Tech Services
Re: BVH File Import into Anim8or
« Reply #28 on: June 18, 2015, 10:55:04 am »

Ah great, I cant wait for Sub to get GoldenEye animations working with An8.

Trev
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BVH File Import into Anim8or
« Reply #29 on: June 19, 2015, 12:25:00 pm »

That's great Steve, I'm close, but no cigar on the port! It would be great, then can get animations in, and out, of anim8or between it and FBX (At least...the simple ones I do).

@NickE, I am having problems getting your tool to work.  This one crashes anim8or when converted, can you take a look:
http://goldeneyevault.com/priv/endorphintest.bvh
« Last Edit: June 19, 2015, 07:06:37 pm by SubDrag »
Logged
Pages: 1 [2] 3 4