Search code examples
3dblendergltfbabylonjsopencascade

removing unused objects from a glTF 2.0 file


I used opencascade's module to export from step to glb . I tried to read the glb file with blender and it works just fine . I then imported it to babylon and it crashed . I posted the file on Khronos's glTF validator and it reported lots of unused meshes . I would like to know if there is a way to remove these unused meshes and if there is other ways to optimize glTF files and babylon import


Solution

  • If it is "Entity cannot be empty" on entities having no triangulations, then it should be just fixed in OCCT itself.

    If this is another case with glTF files exported by OCCT and not passing validation, then probably it is better reporting a bug rather than trying to clean up generated glTF file (although I suppose there are tools in a wild that could do so).

    Optimization of glTF files for specific engines is another topic, sorry to have no answer here. OCCT exports files preserving shape topology structure which might result in poor performance on some unoptimized glTF viewers (you can see that such structure does no harm to CAD Assistant glTF viewer, for example). There is a list of tools that include "optimize" in description like gltfpack, but I have not tried any.