How to reduce gltf file size?

Hello, I’m trying to export my mesh into the gltf/glb format. I don’t need textures or materials included in the file, however I do need animations, skinning and quite a lot shape keys. I tried to fiddle around a bit and got this results:

gltf + bin (418KB + 30MB)

glb (30,1 MB)

gltf (40,4 MB)

Draco compressed gltf (38 MB)

Is there a way to reduce the file size a bit? I kind of hoped that Draco compression helps me more. I also read I could reduce the vertex count but the mesh is already low-poly. Are there any other techniques? I probably miss something. I’m aiming for a size of a maximum of 10MB, as I’m using the mesh for a THREE.js application in the browser. Is that even possible? Thank you.

If animations and shape keys are the cause of the large file size (you can get a better idea of that on https://gltf.report/) then Draco compression won’t help much in this case. Instead your options would be:

  1. resample keyframes (to reduce animation size)
  2. quantize (to reduce shape key size)
  3. apply meshopt compression (to reduce both animation and shape key size)

You can do (1) in the https://gltf.report/ tool (by running a script there), as well as (2) and (3) by selecting meshopt in the export settings. Or if you’re OK with using a commandline tool, gltfpack will do all three and a few other optimizations:

gltfpack -i input.glb -o output.glb -cc

Not all glTF viewers support meshopt compression, but three.js does — refer to this example for how to enable that.

1 Like

Thank you so much, this is exactly what I needed.

1 Like