Users browsing this thread: 1 Guest(s)
ozz animation, concrete file format
#3
Nevermind, I guess I finally understood the source code and the data packing after reading this page again: http://guillaumeblanc.github.io/ozz-anim.../advanced/

Each of the transform elements is actually 4 elements in one. 

So a single translation struct contains data like so:
Code:
{
    float xs[4];
    float ys[4];
    float zs[4];
    // the below row is only present for rotations/quaternions
    float w[4];
}
The transformations are stored in an array whose size is (numJoints + 3) / 4. (this is an integer division, so the result truncates to an integer result) (source)

So for joint count 1..4, you have 1 element in the transformations array. Then for joint count 5...8, you have 2 elements and so on.

The data in the file is as follows (the prefix t means transformation, r means rotation, s means scale. The elements are all floats, so 32 bits or 4 bytes)
tx0,tx1,tx2,tx3; ty0,ty1,ty2,ty3; tz0,tz1,tz2,tz3;
rx0,rx1,rx2,rx3; ry0,ry1,ry2,ry3; rz0,rz1,rz2,rz3; rw0,rw1,rw2,rw3;
sx0,sx1,sx2,sx3; sy0,sy1,sy2,sy3; sz0,sz1,sz2,sz3;

The minimum size of the transform matrices, even if you have a single joint, is 160 bytes. Then whenever you go over a number divisable by 4, you get 160 bytes more.
Reply
Thanked by:


Messages In This Thread
RE: ozz animation, concrete file format - by whantasqued - 12-26-2024, 04:53 PM

Forum Jump: