Stream GLTF Animation frames

This is a long post. Sorry :
I’ll explain our current streaming workflow first.

We have a alembic file which contains one object (animated). The alembic file is fairly large (couple hundred MBs). To stream this data, I am extracting each frame into an OBJ file and compress it with Draco. These individual frames (draco) are sent to client. Client updates the geometry on every requestAnimationFrame call as below.

mesh.geometry = getCurrentGeometryFrame(currentTime)
mesh.geometry.attributes.position.needsUpdate = true

This workflow is okayish, but when the geometry has lot of vertices, decoding and updating them on every render call is becoming expensive. So, We want to explore animations in GLB. Here’s what I tried so far.

  • Convert the alembic file into GLB (retaining animations)
  • Split the GLB animation into clipped multiple GLBs (with blender-bpy).
    • Say model.glb has 500 frames. It’s split into model_0_to_99.glb, model_100_to_199.glb,…,model_400_to_499.glb where each GLB has specified number of frames.

Not successful from here:

  • I’m trying to do load and render the animations incrementally.
    • Load model_0_to_99.glb initially
    • When the animation of model_0_to_99.glb is about to end, load model_100_to_199.glb and continue animations without interruption.

The GLB animation file has morphTargets and mesh has morphAttributes. I thought, to fetch GLBs and update the morphAttributes on the mesh, but. BufferGeometry#morphAttributes – docs says, morphAttributes cannot be updated on an instance.

Could you point out where I’m doing wrong / suggest a better workflow to stream animation data? Thanks a lot!