gltf

What are the GLTF animations sampler input/output values?


I am reading the specification, but I can not understand the properties of the sampler.

This is the animation that I have

"animations" : [
        {
            "channels" : [
                {
                    "sampler" : 0,
                    "target" : {
                        "node" : 0,
                        "path" : "translation"
                    }
                }
            ],
            "name" : "00001_2780.datAction",
            "samplers" : [
                {
                    "input" : 9,
                    "interpolation" : "CUBICSPLINE",
                    "output" : 10
                }
            ]
        },
        {
            "channels" : [
                {
                    "sampler" : 0,
                    "target" : {
                        "node" : 1,
                        "path" : "translation"
                    }
                }
            ],
            "name" : "00002_2780.datAction",
            "samplers" : [
                {
                    "input" : 9,
                    "interpolation" : "CUBICSPLINE",
                    "output" : 11
                }
            ]
        }
    ],

What I can not understand is what are the values 9 and 10 for the first sample and 9 and 11 for the second

All that we have in the specification is

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations

Each of the animation's samplers defines the input/output pair: a set of floating point scalar values representing linear time in seconds; and a set of vectors or scalars representing animated property. 

And this makes it more unclear to me.

Is there a more detailed explanation about what input/output values are and what they represent. What will happen for example if I change the input from 9 to 99 or to 9.9 or to 0.9 or to 0. How will this change the animation?

Thanks


Solution

  • The numbers 9 and 10 here are glTF accessor index ID values. If you decode accessor index 9, you'll find the list of times for each of the keyframes of the animation. If you decode accessor 10, normally you would expect to find the list of values for the keyframes. But since this is CUBICSPLINE, accessor 10 will contain the in-tangent, value, and out-tangent for each keyframe.

    One way to investigate glTF files like this is to use the glTF Tools extension for VSCode. You can right-click the input or output value and choose Go To Definition to get to the accessor in question, and choose Go To Definition again to decode it. (Disclaimer, I'm a contributor to glTF Tools).

    screenshot