In writting an egg exporter for blender, I ran into some whackyness with egg files. From what I understand.
For the joint structure I provided a matrix by which the weighted points are related. These are nested so the matrixes provided are offsets from the previous. The problem I’m running into is that, in the animation frames, it seems I have to respecify my position offsets to get it to work right, which doesn’t make sense to me.
is a very simple egg, 3 polys going up the global z axis. 3 bones the first being for the bottom 4 points the 2nd for the next 2 up and the 3rd for the remaning 2 verts at the top. The joints are nested and if you look in that file you’ll see the transforms offset relative to each other, but to get things to work I had to re issue the offsets in the animation.
I suppose I could just do it, but I’d like to understand why better.
I’m thinking that the offsets in the bones would be enough, and I wouldn’t need to re specific the offsets in the animation.
The transform that is specified in the animation completely replaces the transform that is specified for the corresponding joint in the joint structure. Thus, if you do not specify an offset in the animation, you are replacing the joint with a transform that has no offset.
I seem to be running into issues when a bone is rotated from its parent. In the egg file referenced, it should look like a flat plane, there is only 1 frame of animation and it “attempts” to set the transform to the same transform as the joint specification, but things come out rotated.
There are two different problems working against you here.
First, since your egg file is Z-up, it means that “H” is defined as a rotation around the Z axis, and “R” is a rotation around the Y axis. Thus, you should define the initial transform Bone.One using:
to compose the rotations in the order p, h, r, to match your animation table.
Second, because you have chosen the order “sphrt”, you have triggered a special-case undocumented hack deep within the egg loader. Lucky you!
We have this hack because, many years ago, in a precursor to Panda, the VR Studio used a different set of tools that read and wrote egg files–but we discovered later that these tools represented “R” in the reverse sense that they represented “H” and “P”. So we changed Panda to use a more consistent, intuitive direction for “R”, but then we still wanted to be able to load the legacy egg files that were written by these old tools. Since these old tools wrote animations out with the order “sphrt”, we made the egg loader automatically reverse “R” when it sees the order “sphrt”.
Long story short, to work around the hack, you should either use a different order, or reverse the sign of R (in the Table, but not in the Joint), like this:
Ah, thank you. Yes, the original version of the specification doc was written back for the original egg loader. I’ve just fixed it to remove references to sphrt.