Results 1 to 2 of 2

Thread: How matrix's animation is meant to be interpolated

  1. #1
    Andrey Kopysov
    Guest

    How matrix's animation is meant to be interpolated

    I need to play an object's animation which is described by matrix in collada file. I don't quite understand how do I have to interpolate the animation matrix between key frames. I have several options in mind:
    1) Interpolate the matrix's values. It seems like this will not work with complex animation
    2) Decompose the matrix into scaling, translational parts and Euler angles and interpolate each part independently
    3) Decompose the matrix into scaling, translational parts and quaternion and interpolate each part independently

    Here is the sample collada file:
    Code :
    <?xml version="1.0" encoding="utf-8"?> 
    <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1"> 
      <asset> 
        <contributor> 
          <author>andrei</author> 
        <unit name="centimeter" meter="0.01"/> 
        <up_axis>Z_UP</up_axis> 
      </asset> 
      <library_geometries> 
        <geometry id="geom-Box01" name="Box01"> 
          <mesh> 
            <source id="geom-Box01-positions">...</source> 
            <source id="geom-Box01-map1">...</source> 
            <vertices id="geom-Box01-vertices">...</vertices> 
            <polylist material="ColorMaterial" count="6">...</polylist> 
          </mesh> 
        </geometry> 
      </library_geometries> 
      <library_visual_scenes> 
        <visual_scene id="MaxScene"> 
          <node id="node-Box01" name="Box01"> 
            <matrix sid="matrix">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> 
            <instance_geometry url="#geom-Box01" /> 
          </node> 
        </visual_scene> 
      </library_visual_scenes> 
      <library_animations> 
        <animation> 
          <source id="node-Box01_matrix-input"> 
            <float_array id="node-Box01_matrix-input-array" count="2">0 1</float_array> 
            <technique_common> 
              <accessor source="#node-Box01_matrix-input-array" count="2" stride="1"> 
                <param name="TIME" type="float"/> 
              </accessor> 
            </technique_common> 
          </source> 
          <source id="node-Box01_matrix-output"> 
            <float_array id="node-Box01_matrix-output-array" count="32">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 20 0 1 0 0 0 0 1 0 0 0 0 1</float_array> 
            <technique_common> 
              <accessor source="#node-Box01_matrix-output-array" count="2" stride="16"> 
                <param name="TRANSFORM" type="float4x4"/> 
              </accessor> 
            </technique_common> 
          </source> 
          <source id="node-Box01_matrix-interpolation"> 
            <Name_array id="node-Box01_matrix-interpolation-array" count="2">LINEAR LINEAR</Name_array> 
            <technique_common> 
              <accessor source="#node-Box01_matrix-interpolation-array" count="2" stride="1"> 
                <param name="INTERPOLATION" type="name"/> 
              </accessor> 
            </technique_common> 
          </source> 
          <sampler id="node-Box01_matrix-sampler"> 
            <input semantic="INPUT" source="#node-Box01_matrix-input"/> 
            <input semantic="OUTPUT" source="#node-Box01_matrix-output"/> 
            <input semantic="INTERPOLATION" source="#node-Box01_matrix-interpolation"/> 
          </sampler> 
          <channel source="#node-Box01_matrix-sampler" target="node-Box01/matrix"/> 
        </animation> 
      </library_animations> 
      <scene> 
        <instance_visual_scene url="#MaxScene"/> 
      </scene> 
    </COLLADA>

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: How matrix's animation is meant to be interpolated

    The example describes animation of this 4x4 matrix using linear interpolation:

    Code :
    <matrix sid="matrix">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •