yoga icon indicating copy to clipboard operation
yoga copied to clipboard

Optimize outputted meshes with meshoptimizer

Open Krenodeno opened this issue 2 years ago • 3 comments

Looking at zeux/meshoptimizer, we could use some optimization to assimp output geometries.

First do some tests with outputted geometries by YOGA, count the gains, and see if an integration as a lib is doable.

TODO-list:

  • [ ] Test gltf optimizer with multiple geometries, measure the gains if any
  • [ ] See if it is usable as a library to add to YOGA (python bindings)
  • [ ] Write python bindings
  • [ ] Integrate to YOGA (and option to deactivate those optimizations ?)

Krenodeno avatar Mar 14 '22 14:03 Krenodeno

I've tested a input model with 942 vertices and 1560 triangles (FBX format). The output of YOGA is a GLTF file with a 4680 vertices and 1560 triangles model. Then I used gltfpack on this last model, turned into a 1187 vertices and 1560 triangles model.

Triangles count is preserved across the different files, but the original fbx still have the lower vertex count. Well the optimized gltf have reduced to 25% the vertex count of the yoga output one.

Krenodeno avatar Mar 18 '22 17:03 Krenodeno

I tried a simple cube: original have 8 vertices and 12 triangles. exported with YOGA, I get 36 vertices and 12 triangles. gltfpack gives 24 vertices and 12 triangles.

Krenodeno avatar Mar 18 '22 17:03 Krenodeno

It looks like there should be some fixes to do in assimp too... But that's another topic.

In terms of vertices optimization, results are looking good. What do you think @flozz ?

Krenodeno avatar Mar 21 '22 16:03 Krenodeno