I’m currently working on a collada->proprietary binary converter and I’m now at the Animation section. Our format separates animation tracks by transformation component (Translate, Rotate, Scale), so I have to translate from collada’s openness to our more specific system.
I’ve build a few testcases to see how collada is formatted in these various cases, so now I have a few questions:
For now, let us only look at animation on <node>s
First, animation channels may target either a transformation element listed under the node (e.g. target=myNode/Transformation or myNode/RotateZ) or one part of an element (like Translate.X)
let’s say there are three channels, targetting each one of X, Y and Z of one common <translate> tag. Am I correct to assume these three channels will be listed under one single <animation> tag? (in the even they do come from a common animation from 3ds max)
i.e. as opposed to, say, three channels targetting a different <rotate> tag, which up to now seem to have each their own <animation> tag.
To clarify a bit, let me illustrate what I mean:
... <node id="cube"> <translate sid="translation">0 0 0</translate> <rotate sid="RotZ">0 0 1 0</rotate> <rotate sid="RotY">0 1 0 0</rotate> <rotate sid="RotX">1 0 0 0</rotate> </node> // An animation targetting the X Y and Z Translate components separately <animation id="cube-translate"> ... <channel source="#cube-translation-X-sampler" target="cube/translation.X"/> <channel source="#cube-translation-Y-sampler" target="cube/translation.Y"/> <channel source="#cube-translation-Z-sampler" target="cube/translation.Z"/> </animation> // Three Animations targetting the <rotate>s tags <animation id="cube-rz"> ... <channel source="#cube-RotZ.ANGLE-sampler" target="cube/rotZ.ANGLE"/> </animation> <animation id="cube-ry"> ... <channel source="#cube-RotY.ANGLE-sampler" target="cube/rotY.ANGLE"/> </animation> <animation id="cube-rx"> ... <channel source="#cube-RotX.ANGLE-sampler" target="cube/rotX.ANGLE"/> </animation>
As you can see from this example, all three X Y Z translate animation channels are listed into one <animation> tag. Would it still be legal that these three channels become listed as three separate <animation>s?
As a side question that could also help, are animation tracks listed in the order they must be applied like it is with the various transformation tags listed under a <node>?
In a more general point of view, my current goal and the reason why I’m asking all of this is that I want to correctly merge all the animation tracks listed in a collada file into one Transformation track (out of which I can extract the components I wish). In order to do that, one has to carefully plan about the many animation channels scattered through a collada file and merge them in the correct order. How to get the order right, and correctly match keys, optionally calculating tweens for when a track has keys occuring at times different from other tracks, that’s my current puzzle.
I know our export plug-in has the option to bake matrices, but this isn’t always convenient and I want to support more than just transforms so we don’t depend on one exporter brew and so we can freely switch between collada exporter and collada-supporting tools (which is quite what collada was meant for).