Directly load mdd file for vertex animation in three js

Hi, I have been working on an interactive origami bowl animation from a couple of days. This forum has helped me a lot in getting the various pieces of code together. When I export the glb file with the mdd vertex data. The file size becomes relatively large. The blend file is 3.5 mb and the mdd file is around 1 mb. The exported glb file comes out to be 14 mb. Is there a way to import the mdd file and put the vertex data on the loaded model and be able to play the animation?

It’s currently not possible to separately load MDD files into three.js. Can you please share your MDD file in this thread? I’d like to inspect the contents in order to see how the file is structured.

bowl.mdd (985.4 KB) Thanks for clarifying. I will probably then try to reduce the file size by reducing the keyframe gaps or maybe by using draco.

Thanks for sharing this file. AFAIK, MDD just defines vertex transformation data for a given geometry. Unfortunately, it’s a binary format so without some sort of specification it will be hard to parse the loaded array buffer. Does somebody know a resource with information about the file format? If so, I can try to implement a MDDLoader.

1 Like

Prior context (for anyone stumbling across this thread) is this workflow:

  1. Create a complex vertex animation in Blender.
  2. Export to MDD.
  3. Import the MDD back into Blender as shape keys (morph targets).
  4. Export to glTF.

This bakes out the MDD file into keyframed morph targets, which as the OP writes would increase its size. I don’t think Draco will help in this particular case. You can compress this glTF file with gltfpack, that would be my suggestion.

1 Like

Can you please share the glb file without the animation in this topic ? I’m currently experimenting with MDD and try to figure out if it’s possible load animations and glTF separately.

surebowl.glb (8.8 KB)

Hey, I tried gltfpack but it is messing with the geometry and the animation. I think there is a precision lost when compressed. The vertex-adjusted model for preventing z-fighting gains back z fighting and the animation keyframes are messed up.

the file has been reduced from 14mb to 4mb

First of all thank you for uploading this, I did not know that exporting than importing mdd would do the trick for getting shape key animations on gltf/glb.
Yes, it is true that this technique will drastically increase your gltf/glb file.
To reduce the size you can try:

  1. Export to mdd with 1 frame per second not 24 (I do not see any visible change on my animations)
  2. If you have multiple meshes that only play the mdd animation, you can Join them to one, the mdd animation won’t be affected. (From what I’ve tried, sorry if that’s not your case)
  3. Exclude normals from geometry when exporting.
    These steps will lower your final gltf size.
    Sorry for being late