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]

Author Topic: .an8 Format, jointangles, how are they stored?  (Read 29551 times)

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #15 on: December 07, 2014, 07:45:38 pm »

Sorry I was gone for a week, thanks for the reply!  I'm trying to go from FBX format into anim8or format.  It seems like XYZ euler angles in FBX.  I sort of deduced similar to what you had, but I'm getting lost in getting from my euler, adjusted to the relative to parent bone.  Not sure if you have done something similar and have at least pseudocode on how to do the conversion?   I can't figure out the math to go from my euler, such as 15, 30, 45, to an euler relative to parent bone.  Please help!  Maybe assuming have parent's bone quaternion, and your XYZ euler relative to parent, how to go to anim8or XYZ.

I was able to get the skeleton fine translated, it's just the keyframe angles themselves that won't translate.  I made a 0 sized node, which matched the way I had the FBX, in between bones, and those were used for rotations.  I believe the issue is just translating rotations properly.

Here's my attempt at least...
FBX: http://goldeneyevault.com/priv/an8conversionattempt/animation.fbx
An8 (skeleton nodes):
FBX: http://goldeneyevault.com/priv/an8conversionattempt/animation.an8
« Last Edit: December 07, 2014, 07:54:59 pm by SubDrag »
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #16 on: June 14, 2015, 10:23:09 pm »

Perhaps someone can help, I feel like sort of closer, perhaps the piece I am missing is still, how anim8or stores its angles.

I have a quaternion at a bone (absolute quaternion, basically, I trawled the hierarchy), that I'm doing rotation in anim8or of:
     x   0.52576530   float
     y   0.084034257   float
     z   0.40772036   float
     w   0.74180400   float

Off of this bone, in FBX format, a rotation (Euler XYZ of 58.675510 y=33.600880 z=38.327244), yields in anim8or 30 60 90, which matches and works great.  However, converting to anim8or also always yields a second solution for anim8or,  in this case, -150 120 -140.  I cannot figure out why in anim8or, that set of angles yields a different rotation visually.  The quaternions should be identical (or 360 degrees off).  Maybe someone can explain why those two rotations do not yield identical results about that bone, that would be very helpful!

I've attached the sample an8, go to sequence mode, then use this part:
« Last Edit: June 14, 2015, 10:41:37 pm by SubDrag »
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #17 on: June 20, 2015, 09:57:49 am »

Quaternions encode more than Euler angles. There are two unit queternions for a given Euler orientation. If you interpolate between q1 and q2 using the shortest path it traces a great circle path on the unit sphere. For example a path from New York to London across the Atlantic Ocean.  If you substitute q2' (the alternate quaternion for q2) the shortest path in quaternion space  is the long way around the sphere over the Pacific Ocean. So one way to think of it is that queternions encode a directional bias as well as an orientation.

When I return home in mid July I'll post a detailed description of what is happening but it's too difficult to do with a tablet.
Logged

Deepthought

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #18 on: June 20, 2015, 04:43:01 pm »

maybe could you put something on how anim8or handles quaternions? maybe like a short example on drawing the bones in opengl
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #19 on: June 23, 2015, 03:44:04 am »

Yes, I'll post the code to convert to and from Euler angles, interpolate quaternion angles, etc.
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #20 on: July 18, 2015, 08:21:04 pm »

Here's a short note on quaternions that might help explain why you're getting some whacky rotations in your .an8 files:

Quaternions and Anim8or

I hope this explanation makes quaternions a bit clearer. Let me know if you have any questions. I'll be posting some source code a bit later.
« Last Edit: July 18, 2015, 08:22:56 pm by Steve »
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1482
    • View Profile
Re: .an8 Format, jointangles, how are they stored?
« Reply #21 on: July 19, 2015, 08:27:47 pm »

Hi Steve, thanks for the writeup on quaternions :)
Logged

Trevor

  • Full Member
  • ***
  • Posts: 220
  • Goldfinger64 Dev OS:10 CPU:5960x Gfx:RX480
    • View Profile
    • LS Tech Services
Re: .an8 Format, jointangles, how are they stored?
« Reply #22 on: July 21, 2015, 04:33:50 am »

Hi Steve, just wanted to link you to another post.
http://www.anim8or.com/smf/index.php/topic,3953.msg38744.html#msg38744

I think Sub did get Quaternuions fixed but we ended up with another problem as described in the post.

Unless there is an easier way?

Trev
Logged
Pages: 1 [2]