PDA

View Full Version : Collada animation



Itun.itu
02-12-2011, 09:53 AM
I am sorry for writing here, but Collada forum is dead.
And so could you get me an advice how to store animation from Collada? Usually I have to store one bone matrix and animate it, but here I must store a sequence of functions (rotation, translation, ... its parameters) for each bone. In each frame I must evaluate parameters of this functions (make animation because in models there are interpolation of parameters of functions(for instance an interpolation of an angle of rotation function)) and then for each bone evaluate bone matrix.
A XML code for example:


<animation id="joint11_rotateZ2">
<source id="joint11_rotateZ2_right_shoulder_joint11_rotateZ_AN GLE-input">
<float_array id="joint11_rotateZ2_right_shoulder_joint11_rotateZ_AN GLE-input-array" count="26">0.041667 0.083333 0.125 0.166667 0.208333 0.25 0.291667 0.333333 0.375 0.416667 0.458333 0.5 0.541667 0.583333 0.625 0.666667 0.708333 0.75 0.791667 0.833333 0.875 0.916667 0.958333 1 1.04167 1.08333</float_array>
<technique_common>
<accessor count="26" source="#joint11_rotateZ2_right_shoulder_joint11_rotateZ_A NGLE-input-array">
<param name="TIME" type="float"/>
</accessor>
</technique_common>
</source>
<source id="joint11_rotateZ2_right_shoulder_joint11_rotateZ_AN GLE-output">
<float_array id="joint11_rotateZ2_right_shoulder_joint11_rotateZ_AN GLE-output-array" count="26">-4.93792 -5.17142 -5.42837 -5.70291 -5.98917 -6.28129 -6.57341 -6.85966 -7.1342 -7.39115 -7.62465 -7.82884 -7.99786 -8.12585 -8.20694 -8.23527 -8.15847 -7.9479 -7.63328 -7.24433 -6.8108 -6.3624 -5.92886 -5.53992 -5.2253 -5.01472</float_array>
<technique_common>
<accessor count="26" source="#joint11_rotateZ2_right_shoulder_joint11_rotateZ_A NGLE-output-array">
<param name="ANGLE" type="float"/>
</accessor>
</technique_common>
</source>
<sampler id="joint11_rotateZ2_right_shoulder_joint11_rotateZ_AN GLE-sampler">
<input semantic="INPUT" source="#joint11_rotateZ2_right_shoulder_joint11_rotateZ_A NGLE-input"/>
<input semantic="OUTPUT" source="#joint11_rotateZ2_right_shoulder_joint11_rotateZ_A NGLE-output"/>
</sampler>
<channel source="#joint11_rotateZ2_right_shoulder_joint11_rotateZ_A NGLE-sampler" target="right_shoulder_joint11/rotateZ.ANGLE"/>
</animation>

<node id="right_shoulder_joint11" name="joint11" sid="right_shoulder_joint11" type="JOINT">
<translate sid="translate">-1.20726 2e-006 0.012825</translate>
<rotate sid="jointOrientZ">0 0 1 -0.34889</rotate>
<rotate sid="jointOrientY">0 1 0 0</rotate>
<rotate sid="jointOrientX">1 0 0 0</rotate>
<rotate sid="rotateZ">0 0 1 -6.8108</rotate>
<rotate sid="rotateY">0 1 0 -57.0018</rotate>
<rotate sid="rotateX">1 0 0 2.43798</rotate>
I think this is an inconvenient method for programming and very hard for graphics performance.
Could somebody explain or give links me how to use this Collada data in good form?

Alfonse Reinheart
02-12-2011, 12:26 PM
Usually I have to store one bone matrix and animate it, but here I must store a sequence of functions

Says who? Just because Collada stores its data in some way doesn't mean you have to. Read the data from Collada and convert it into whatever is most convenient for you.

Itun.itu
02-15-2011, 08:04 AM
You are right, it is obvious. Then I restated the question.
How to translate animation from the form above to a matrix form with matrix interpolation?
I suppose that for this purpose I have to write an animation converter, which will rewrite an animation track. But I don` t know how?

Alfonse Reinheart
02-15-2011, 11:09 AM
How to translate animation from the form above to a matrix form with matrix interpolation?

This is not really a Collada forum, and any answer I give would be... long. My suggestion would be buying a book on Collada. This Collada (http://www.amazon.com/Collada-Sailing-Digital-Content-Creation/dp/1568812876/ref=sr_1_1?ie=UTF8&amp;qid=1297793061&amp;sr=8-1) book is pretty decent, though it helps to have some familiarity with the basic rendering/animation concepts before digging in.

BTW, I've written several animation systems, and none of them used "matrix interpolation." They all decomposed the matrices down to position, rotation (typically encoded as a quaternion), and possibly a scale. All of which are interpolated independently through the animation and between separate animations.