zeux / meshoptimizer

Mesh optimization library that makes meshes smaller and faster to render
MIT License
5.49k stars 473 forks source link

GltfPack isnt preserving identical node hierarchy with -kn -km flags activated #662

Closed saturn118 closed 5 months ago

saturn118 commented 5 months ago

I'm using gltfpack to optimize a mesh. My use case requires exact preservation of the original file's node hierarchy. In teh blender before and after images below you can see that it's maintaining the naming of the nodes but it's also introducing new nodes into the hierarchy

gltfpack -i input.glb -o output.glb -kn -km

I can share the exact model if required. Github doesnt allow me to upload it here

Before image

After. image

zeux commented 5 months ago

-kn does not guarantee that the hierarchy is preserved. Because by default gltfpack uses quantization which requires dequantization transforms, it has to insert additional nodes for existing meshes. If you're using a recent version you can use -vpf to disable fixed point quantization for positions only, which should usually maintain the hierarchy assuming all nodes are named; you can also use -noq to disable all quantization altogether, resulting in a large file.