I am currently trying to load 3D models and animations into a program. The file format has no public description, so I am decoding them piece by piece. (I'm studying computer science and it's for educational purposes)
My problem is to restore 3 dimensional rotation from the skeleton files as the rotation is stored in 8 bytes only and I can't figure out how that data represents rotation around 3 axis. This is a sample skeleton with 11 joints:
float | float | float Bytes (hexadecimal values)
Joint 0: Parent: -1 Position: ( 0.000000| 0.000000| 0.000000) Rotation: 00 40 00 40 00 C0 00 C0
Joint 1: Parent: 0 Position: ( 3.042923| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint 2: Parent: 0 Position: ( 3.803955| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint 3: Parent: 0 Position: ( 4.482897| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint 4: Parent: 1 Position: ( 0.824744| -0.000000| 0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 5: Parent: 2 Position: ( 0.694988| -0.000000| 0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 6: Parent: 3 Position: ( 0.509095| -0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 7: Parent: 4 Position: ( 0.609431| 0.000000| 0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 8: Parent: 5 Position: ( 0.609431| 0.000000| 0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 9: Parent: 6 Position: ( 0.609431| 0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 10: Parent: 7 Position: ( 0.842106| 0.000000| 0.000000) Rotation: 00 00 00 00 00 00 FF 7F
which should form roughly this shape:
3-6-9
|
|2-5-8
||
||1-4-7-10
|||
0
But as you can see, the joints only extend in the 1st dimension (excluding 1, 2 and 3 which do extend a little in the 3rd dimension) so the coordinates have to be relative to the parent (which makes perfectly sense in terms of a skeleton).
My problem is to figure out how the rotation is stored in the 8 bytes per joint.
Short example: joints 1, 2 and 3 have to store a 90° rotation for the skeleton to work .. I allready did some research for different representations, but none can store arbitrary rotations around 3 axis in only 8 bytes, usually it takes double the space (4 floats) ..