Animation channel target question(s)

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).

What you said is correct.

Collada Animation is really flexible. You can group things anyways you wanted.

It is legal to list those 3 channels as three separate <animation>s.
Unlike the order of transform stack, the order of <animation>s is commutative, so you can mix them in any order you want.

There are many different way to group animations.

  1. You can put different animations in an animation.
  2. You can put different channels in an animation.
  3. You can group different animation referenced by different <instance_animation> into an <animation_clip>.
  4. You can merge different channels that target the same transform element (probably in different value in the element) into one channel that target the whole transform element. That mean you can merge your example into something like “cube/translation.XYZ” or just “cube/translation”. This merging requires more work since you need to merge the sources also.

It would be a good application to create a conditioner to merge or group your animation into something that you can import or convert easier.

Thanks,
Herbert