General Category > ASL Scripts
BVH File Import into Anim8or
NickE:
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?
SubDrag:
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"
NickE:
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.
SubDrag:
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.
NickE:
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?"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version