Export GLTF containing only animation data

Hello everyone!

Is it possible to use the threejs GLTFExporter to export a GLTF containing only the buffers for animation data, no other buffers?

This tutorial shows a way to load a GLTF with these restrictions on top of a base GLTF that contains the other buffers. What I want to do is the inverse: export a GLTF containing only animation data.

More precisely what I want to do is send animation data created on a client to a server where it is integrated in to a common GLTF file. I know I could just send the node references and raw animation data, but I think sending valid GLTFs would be kind of neat.

I read the source code and it doesn’t seem to be possible except for removing parts from the exported GLTF after the export is complete, which would involve a lot of processing overhead. Am I missing something?

Thank you so much for this amazing library and in advance for any words of advice!

What will happen if before exporting you make all objects invisible and set the GLTRExporter opiton onlyVisible to true?

Thank you so much for your answer, that did get me significantly closer to what I was aiming for.

My error so far was that I simply set scene.visible = false, which didn’t have the desired effect. It required scene.traverse((object) => (object.visible = false)) to actually accept that it shouldn’t include the other buffers.

However, it seems that the exported GLTF loses its channels -> target -> node references, because the GLTF lacks nodes. In the tutorial linked above it seems that the whole node structure is generated for the GLTF, but the buffers are omitted. I believe that is why the animations can be applied to the base model so easily.

Is there a way to tell the exporter which types of data to include?

It is impossible to export skinning animation to glTF, without also including a skeleton. The resulting file would not be valid. I think you could perhaps replace the SkinnedMesh’s geometry with a single triangle or something trivial like that, which should allow the file to be exported correctly.


Maybe the only way is to modify GLTFExporter.js. There are separate functions for the different data, e.g. individual animation clips are processed by processAnimation. But, honestly, I doubt it is worth going this way.