Horde3D
http://horde3d.org/forums/

problems getting animations from COLLADA file
http://horde3d.org/forums/viewtopic.php?f=2&t=1687
Page 1 of 1

Author:  swx [ 27.06.2012, 01:13 ]
Post subject:  problems getting animations from COLLADA file

I have a .max file of a walking character that is moving (so not animated in place). I export it using OpenCOLLADA and enable sampling of the animation. When I load and play it using Horde3D the character is animated in place (not translated as it should).

The COLLADA file does contain correct translation values for the nodes, but the .anim file does not.

I investigated a bit and found some interesting things in Converter::getNodeTransform()

The transStack looks the following:
Code:
node.transStack = [4]({sid="translation" type=1 values=0x00bd02dc ...},
                      {sid="rotationZ" type=2 values=0x00bd0380 ...},
                      {sid="rotationY" type=2 values=0x00bd0424 ...},
                      {sid="rotationX" type=2 values=0x00bd04c8 ...})

which appears to be correct since the node decl in the COLLADA file is:
Code:
<node id="node-Zand" name="Zand" sid="joint0" type="JOINT">
  <translate sid="translation">-0.1367118 -1.029331 10.03159</translate>   
  <rotate sid="rotationZ">0 0 1 -78.21608</rotate>   
  <rotate sid="rotationY">0 1 0 -6.28271e-4</rotate>   
  <rotate sid="rotationX">1 0 0 1.584883</rotate>
  <node id="node-Zand_Footsteps" name="Zand_Footsteps" sid="joint53" type="JOINT">
  ...


The elements of the transStack are iterated over to retrieve samplers:
Code:
for( unsigned int i = 0; i < node.transStack.size(); ++i )
{
  int compIndex;
  DaeSampler *sampler = _daeDoc.libAnimations.findAnimForTarget( node.id, node.transStack[i].sid, &compIndex );
  ...


This will give me a "node-Zand_translation.X-sampler", but never a "node-Zand_translation.Y-sampler" or "node-Zand_translation.Z-sampler".
So the output values for y and z are never used but they are present in the .dae file and in _daeDoc.libAnimations.
From the COLLADA file:
Code:
<source id="node-Zand_translation.Y-input">
        <float_array id="node-Zand_translation.Y-input-array" count="31">0 0.03333334 0.06666667 0.1 0.1333333 0.1666667 0.2 0.2333333 0.2666667 0.3 0.3333333 0.3666667 0.4 0.4333333 0.4666667 0.5 0.5333334 0.5666667 0.6 0.6333333 0.6666667 0.7 0.7333333 0.7666667 0.8 0.8333333 0.8666667 0.9 0.9333333 0.9666666 1</float_array>
        <technique_common>
          <accessor source="#node-Zand_translation.Y-input-array" count="31" stride="1">
            <param name="TIME" type="float"/>
          </accessor>
        </technique_common>
      </source>
      <source id="node-Zand_translation.Y-output">
        <float_array id="node-Zand_translation.Y-output-array" count="31">-1.029331 -1.029331 -1.66839 -2.310763 -2.955492 -3.592182 -4.23628 -4.870735 -5.460976 -6.015109 -6.548089 -7.061303 -7.571934 -8.083939 -8.600042 -9.151761 -9.727701 -10.32779 -10.95066 -11.58309 -12.21289 -12.84714 -13.48406 -14.08366 -14.65022 -15.19554 -15.73173 -16.25819 -16.77802 -17.30676 -17.86168</float_array>
        <technique_common>
          <accessor source="#node-Zand_translation.Y-output-array" count="31" stride="1">
            <param name="Y" type="float"/>
          </accessor>
        </technique_common>
      </source>
      <source id="node-Zand_translation.Y-interpolation">
        <Name_array id="node-Zand_translation.Y-interpolation-array" count="31">LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR</Name_array>
        <technique_common>
          <accessor source="#node-Zand_translation.Y-interpolation-array" count="31" stride="1">
            <param name="INTERPOLATION" type="name"/>
          </accessor>
        </technique_common>
      </source>

...

<sampler id="node-Zand_translation.Y-sampler">
        <input semantic="INPUT" source="#node-Zand_translation.Y-input"/>
        <input semantic="OUTPUT" source="#node-Zand_translation.Y-output"/>
        <input semantic="INTERPOLATION" source="#node-Zand_translation.Y-interpolation"/>
</sampler>

...

<channel source="#node-Zand_translation.X-sampler" target="node-Zand/translation.X"/>
<channel source="#node-Zand_translation.Y-sampler" target="node-Zand/translation.Y"/>
<channel source="#node-Zand_translation.Z-sampler" target="node-Zand/translation.Z"/>



Author:  Roland [ 27.06.2012, 08:44 ]
Post subject:  Re: problems getting animations from COLLADA file

Hi.
Just a couple of month ago I did the exact same thing (3ds Max 2011/OpenCollada) using some motion capture data and everything worked fine for me.

I currently don't have access to 3ds Max or my old collada files, so all I can say right know is that I used these settings and an old Horde3D beta 4 collada exporter version.

Author:  swx [ 27.06.2012, 11:18 ]
Post subject:  Re: problems getting animations from COLLADA file

I've tried different export options but it doesn't really make any difference. The COLLADA file is correct so the exporter is not doing anything wrong as far as I can see... perhaps the older versions sampled the data in a different way or used a slightly different node declaration.

Author:  swx [ 27.06.2012, 19:42 ]
Post subject:  Re: problems getting animations from COLLADA file

You were right Roland :) I'm pretty sure I did test with baking matrices before... but I tried it now and it worked.

The COLLADA converter expects a matrix sampler for the node and not translation samplers.

Author:  Roland [ 27.06.2012, 22:56 ]
Post subject:  Re: problems getting animations from COLLADA file

glad I could help :)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/