1
$\begingroup$

I have an animated cube with 5 keyframes and when I export it to glTF with blender, in the file I can only see 3 keyframes:

enter image description here

But when I viewed the gltf model with viewer all 5 keyframes worked well in the animation. Whats the explanation of this ? My blend file if you are interested: https://files.fm/u/ujs4w23g

$\endgroup$
2
$\begingroup$

You're seeing channels and samplers there, not individual keyframes. In this case, one animation is simultaneously targeting the translation, rotation, and scale channels of the same node, with three separate "samplers" (sets of keyframes per channel).

Not shown above, your glTF file has a section called accessors that tells viewers how to slice out portions of binary data from an associated .bin file. The .bin file contains mostly mesh position/normal/UV data, but also contains the keyframe times and values.

So in the above snippet, that first channel targets the translation of node 3 with sampler 0 (the first sampler). The sampler there asks for LINEAR interpolation of keyframes from animation times (input: 8) for translation keyframe values (output: 9). In the accessors section, accessors 8 and 9 (using zero-based indexing) are references to the keyframe times (in 8) and values (in 9). They are separate because the data type of the output depends on what's being targeted (rotations are vec4 quaternions for example, while translations and scales are vec3, and the input times are just floats).

The accessors in question (8 and 9 for example) will contain a value "count" that effectively tells you the number of keyframes. If you have 5 keyframes for example, accessor 8 should have "count": 5 keyframe times, and accessor 9 will also have "count": 5 keyframe values. The glTF Validator will flag an error if these counts don't match.

$\endgroup$
  • $\begingroup$ Thank you for the explanation again emackey ! :D Tonight I will check my bin file for the values. $\endgroup$ – Vettel.Sebastian May 10 '18 at 5:40
  • $\begingroup$ I realised that it has count 70, not 5. I have 70 frames. Why it's storing my frame datas instead of the 5 keyframes ?? I really need the keyframes, I am so angry now because if it doesn't store the actual keyframes then my one month work will lost... $\endgroup$ – Vettel.Sebastian May 10 '18 at 16:05
  • $\begingroup$ imgur.com/a/esok5xO as you can see there are 5 keyframes in 70 frames $\endgroup$ – Vettel.Sebastian May 10 '18 at 16:16
  • $\begingroup$ The 5 vs 70 keyframe question was resolved on GitHub here. $\endgroup$ – emackey May 15 '18 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.