Results 1 to 6 of 6

Thread: Basic Animation in Collada

  1. #1
    coders_gaint
    Guest

    Basic Animation in Collada

    Hi ,
    1) I have extracted the animation data and pasted below.From Can you please anyone explain me,actually how the animation is actually performing.If it is key frame based animation then how i came to whether its a time based or key based animation.
    2) If so how i will get the keys.
    3)And also am confused with the Param Name like TIME,ANGLE,INTERPOLATION.
    4)And also am seeing that array contains the keyword LINEAR what is that?

    If anyone can explain this.So that i will be useful and easier for everyone who starts collada.

    <source id="Box02-node-rz_Box02-node_RotZ_ANGLE-input">
    <float_array id="Box02-node-rz_Box02-node_RotZ_ANGLE-input-array" count="201">0 0.033333 0.066666 0.1 0.133333 0.166667 0.2 0.233333 0.266667 0.3 0.333333 0.366667 0.4 0.433333 0.466667 0.5 0.533333 0.566667 0.6 0.633333 0.666667 0.7 0.733333 0.766667 0.8 0.833333 0.866667 0.9 0.933333 0.966667 1 1.03333 1.06667 1.1 1.13333 1.16667 1.2 1.23333 1.26667 1.3 1.33333 1.36667 1.4 1.43333 1.46667 1.5 1.53333 1.56667 1.6 1.63333 1.66667 1.7 1.73333 1.76667 1.8 1.83333 1.86667 1.9 1.93333 1.96667 2 2.03333 2.06667 2.1 2.13333 2.16667 2.2 2.23333 2.26667 2.3 2.33333 2.36667 2.4 2.43333 2.46667 2.5 2.53333 2.56667 2.6 2.63333 2.66667 2.7 2.73333 2.76667 2.8 2.83333 2.86667 2.9 2.93333 2.96667 3 3.03333 3.06667 3.1 3.13333 3.16667 3.2 3.23333 3.26667 3.3 3.33333 3.36667 3.4 3.43333 3.46667 3.5 3.53333 3.56667 3.6 3.63333 3.66667 3.7 3.73333 3.76667 3.8 3.83333 3.86667 3.9 3.93333 3.96667 4 4.03333 4.06667 4.1 4.13333 4.16667 4.2 4.23333 4.26667 4.3 4.33333 4.36667 4.4 4.43333 4.46667 4.5 4.53333 4.56667 4.6 4.63333 4.66667 4.7 4.73333 4.76667 4.8 4.83333 4.86667 4.9 4.93333 4.96667 5 5.03333 5.06667 5.1 5.13333 5.16667 5.2 5.23333 5.26667 5.3 5.33333 5.36667 5.4 5.43333 5.46667 5.5 5.53333 5.56667 5.6 5.63333 5.66667 5.7 5.73333 5.76667 5.8 5.83333 5.86667 5.9 5.93333 5.96667 6 6.03333 6.06667 6.1 6.13333 6.16667 6.2 6.23333 6.26667 6.3 6.33333 6.36667 6.4 6.43333 6.46667 6.5 6.53333 6.56667 6.6 6.63333 6.66667</float_array>
    <technique_common>
    <accessor source="#Box02-node-rz_Box02-node_RotZ_ANGLE-input-array" count="201" stride="1">
    <param name="TIME" type="float"/>
    </accessor>
    </technique_common>
    <technique profile="MAYA">
    <pre_infinity>CONSTANT</pre_infinity>
    <post_infinity>CONSTANT</post_infinity>
    </technique>
    </source>
    <source id="Box02-node-rz_Box02-node_RotZ_ANGLE-output">
    <float_array id="Box02-node-rz_Box02-node_RotZ_ANGLE-output-array" count="201">0 -0.026514 -0.105495 -0.2361 -0.417487 -0.648815 -0.92924 -1.25792 -1.63402 -2.05668 -2.52508 -3.03836 -3.59568 -4.19621 -4.8391 -5.52351 -6.24859 -7.0135 -7.81741 -8.65947 -9.53883 -10.4547 -11.4061 -12.3923 -13.4125 -14.4658 -15.5513 -16.6682 -17.8157 -18.9929 -20.1991 -21.4332 -22.6946 -23.9823 -25.2955 -26.6334 -27.9951 -29.3799 -30.7867 -32.2149 -33.6635 -35.1318 -36.6188 -38.1238 -39.6459 -41.1842 -42.7379 -44.3062 -45.8882 -47.4831 -49.0901 -50.7082 -52.3367 -53.9747 -55.6214 -57.2759 -58.9374 -60.6051 -62.278 -63.9554 -65.6364 -67.3203 -69.006 -70.6928 -72.3799 -74.0664 -75.7514 -77.4342 -79.1139 -80.7896 -82.4605 -84.1257 -85.7845 -87.4359 -89.0791 -90.7134 -92.3378 -93.9515 -95.5536 -97.1433 -98.7199 -100.282 -101.83 -103.362 -104.877 -106.375 -107.854 -109.315 -110.755 -112.175 -113.573 -114.948 -116.3 -117.628 -118.931 -120.208 -121.459 -122.681 -123.876 -125.041 -126.176 -127.303 -128.443 -129.596 -130.761 -131.938 -133.127 -134.326 -135.536 -136.756 -137.985 -139.223 -140.469 -141.723 -142.985 -144.253 -145.528 -146.809 -148.095 -149.385 -150.68 -151.979 -153.282 -154.587 -155.895 -157.204 -158.515 -159.826 -161.138 -162.45 -163.761 -165.071 -166.379 -167.685 -168.988 -170.289 -171.585 -172.878 -174.165 -175.448 -176.725 -177.995 -179.259 -180.516 -181.765 -183.006 -184.238 -185.461 -186.675 -187.878 -189.07 -190.251 -191.421 -192.578 -193.723 -194.854 -195.972 -197.076 -198.164 -199.238 -200.296 -201.338 -202.362 -203.37 -204.36 -205.332 -206.285 -207.219 -208.133 -209.027 -209.9 -210.752 -211.582 -212.39 -213.175 -213.937 -214.676 -215.39 -216.079 -216.743 -217.381 -217.993 -218.579 -219.137 -219.667 -220.169 -220.642 -221.086 -221.501 -221.885 -222.238 -222.56 -222.85 -223.108 -223.333 -223.525 -223.683 -223.807 -223.896 -223.95 -223.968</float_array>
    <technique_common>
    <accessor source="#Box02-node-rz_Box02-node_RotZ_ANGLE-output-array" count="201" stride="1">
    <param name="ANGLE" type="float"/>
    </accessor>
    </technique_common>
    </source>
    <source id="Box02-node-rz_Box02-node_RotZ_ANGLE-interpolations">
    <Name_array id="Box02-node-rz_Box02-node_RotZ_ANGLE-interpolations-array" count="201">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 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 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 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 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 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 LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR LINEAR</Name_array>
    <technique_common>
    <accessor source="#Box02-node-rz_Box02-node_RotZ_ANGLE-interpolations-array" count="201" stride="1">
    <param name="INTERPOLATION" type="Name"/>
    </accessor>
    </technique_common>
    </source>


    thanks in advance

  2. #2
    Junior Member
    Join Date
    Jun 2009
    Posts
    8

    Re: Basic Animation in Collada

    hi,

    I don't know All about Animations in Collada. but if we take some assumptions things get easier.. But anyways.

    You are missing two things in what you have "pasted" here which are as much important as those 3 "Sources".. the first one is called "Sampler" and the second one is "Channel".. you need (i think) those two things to define the target on which the animation data is applied..

    From "channel" Node you pick the target which gives you the ID of the Object on which the Animation data will be applied. and you also get the Sampler ID from where you will pick the sources from which you will pick the animation Data...

    example,
    Code :
    <source id="astroBoy-input">
    <float_array id="astroBoy-input-array" count="2">0 1.16667</float_array>
    <technique_common>
    <accessor source="#astroBoy-input-array" count="2" stride="1">
    <param name="TIME" type="float"/>
    </accessor>
    </technique_common>
     
    <source id="astroBoy-output">
    <float_array id="astroBoy-output-array" count="2">2.2 3.5</float_array>
    <technique_common>
    <accessor source="#astroBoy-output-array" count="2" stride="1">
    <param name="TRANSFORM" type="float"/>
    </accessor>
    </technique_common>
     
    <source id="astroBoy-interpolations">
    <NAME_array id="astroBoy-interpolations-array" count="2">LINEAR LINEAR</NAME_array>
    <technique_common>
    <accessor source="#astroBoy-interpolations-array" count="2" stride="1">
    <param name="INTERPOLATION" type="float"/>
    </accessor>
    </technique_common>
     
    <sampler id="astroBoy_Skeleton-sampler">
    <input semantic="INPUT" source="#astroBoy-input"/>
    <input semantic="OUTPUT" source="#astroBoy-output"/>
    <input semantic="INTERPOLATION" source="#astroBoy-interpolations"/>
     </sampler>
     
    <channel source="#astroSkeleton-sampler" target="astroBoy_Skeleton/trans.X"/>

    Now Lets read from the Bottom "channel" node.

    This says that there is one Entity called "astroBoy_Skeleton" in the scene who's "X translation values" is being animated by the sampler "astroSkeleton-sampler"..

    so we need to know how "astroSkeleton-sampler" animated that "X translation value" so we read "sampler" which says..

    There are three types of inputs you must read to read the animation data..

    First : input
    Second : output
    Third : Interpolation

    when we read the Inputs from the Sampler..
    The "input" with semantic = "INPUT" gives you the input source for the animation
    The "input" with semantic = "OUTPUT" gives you the output source for the animation
    The "input" with semantic = "INTERPOLATON" gives you the interpolation source for the animation

    now when we go and read those sources. we see that the source who was refered to semantic = "INPUT" by the sampler has name="TIME" in param which says this sources has time values of the animation in floats.

    the source who was refered to semantic = "OUTPUT" by the sampler has name="TRANSFORM" in param which says this sources has "X translation" values in floats for those times which we read from the previous source.

    the source who was refered to semantic = "INTERPOLATION" by the sampler has name="INTERPOLATION" in param which says this sources has the interpolation values in Strings for those OUTPUTS which we read from the previous source.

    what this last source means is that.. if you see the sources you are given OUTPUT values for two values of time.. what happens if we want to run the animation on a time which falls in between those two time values.. then we apply interpolation to find the middle OUTPUT value for the inbetween time value.. and in this case its LINEAR interpolated...

    Now if you see the TIME Source.. thats actually your Keyframes.. and the OUTPUT one is the Keyframes data for the "X translation" of the Entity...

    So you pick the corresponding OUTPUT value for any time and apply that to the "X translation factor" of that entity in your code and the entity will be animated.. and to calculate the in-between values for more smooth animation you use the LINEAR interpolation..

    i hope this helps .. if not then please ask i would like to explain even further..

  3. #3
    coders_gaint
    Guest

    Re: Basic Animation in Collada

    Thanks a lot waZim.You have given a great explantion regarding the animation data for all the fresh collada users.Thank you so much.Now i understood the concept of animation.If i have any queries i get back to you.

    one more question(Sorry for troubling you).

    How to calculate the in between value of two times using interpolation value with the string "LINEAR" could you give me a example over that.

    Thanks in advance

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Posts
    8

    Re: Basic Animation in Collada

    you always welcome.

    Interpolation means calculating any in-between value between two values...

    so lets say i have "X" and "Y" so to calculate the "Middle" value in between those two values we can use an interpolation factor of "0.5" which we call "T"... and to find the 3-Quater value in-between "X" and "Y" we use "T = 0.75" and so on..

    So you can run a loop on "T" from lets say 0.0 to 1.0 have any increment i.e 0.001,0.01,0.05 etc and you can get "Loop" many in-between values..

    Now Linear Interpolation is a simple form of Interpolations. and the formula is as follows

    Code :
    float Interpolate( float a_Value1,float a_Value2,float a_T)
    {
    	return ((a_Value1 * a_T) + ((1 - a_T) * a_Value2));
    }

    so if you see the code it says that if "a_T" is "zero" then give me a_Value1, and if its "ONE" then give me a_Value2.. and if its in-between "zero and One" then it will give you value in-between a_Value1 and a_Value2.

    now their are other forms of Interpolations as well. lie Bezier, cubic(i think) etc.. they have further complicated formulas.. and they also consider more then two values to interpolate in-between..

    i hope this helps..

  5. #5
    Junior Member
    Join Date
    Jun 2009
    Posts
    8

    Re: Basic Animation in Collada

    Now you can use "LINEAR" String to take a decission of which type of Interpolations you want to do on the Animation Keyframes data and then do the interpolations.. in this case it will be "LINEAR" if you see any other String like "BEZIER" etc then you will do those types of Interpolations..

  6. #6
    coders_gaint
    Guest

    Re: Basic Animation in Collada

    Thanks for your quick response

    Oh! thats great.Really your post is helpful for all.

    Thanks a lot,

Posting Permissions

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