Help on understanding Draco compression in GLTF

Hello, I have trouble in understanding how the attributes in “KHR_draco_mesh_compression” part work in GLTF. I’ve read the official documentation as below,

It seems that they do not have exactly the same meaning as the “uncompressed” attributes? I ask that because the normal attributes point to the “global” accessors. But the local compressed attributes point to what? I googled some sample GLTFs and it seems that the compressed attributes always start from 0…

The official explanation as above drives me crazy. Maybe it is because of my poor English level though. Could anyone help me on that?

Thanks in advance.

Hi @SilverBullet

Maybe @bghgary or @Drigax can answer your question :slight_smile:

The attributes outside of the extension point to accessors that don’t have a bufferView (assuming the Draco extension is required for the glTF asset). For example, this mesh attribute points to this accessor. The reason for this is so that loaders can pre-allocate the GPU buffers before loading the data for the buffers.

The attributes inside the Draco extension don’t point to anything. They are identifiers intended to be used when loading the Draco compressed data. If you want to see how Babylon does this, the code is here: Babylon.js/dracoCompression.ts at master · BabylonJS/Babylon.js · GitHub

I have been involved since the beginning of this extension, so it’s hard for me to judge how clear the specification is, but if you feel the language is not clear (even if you’re not a native English speaker), it will be good to file an issue on the glTF specification repo so that the community can discuss and possible amend the spec language so that it is easier to understand.

Thank you for your explanation. Now I understand better.

1 Like

I have one more question though. Let’s say I have a geometry which is a merged one as the meshes share the same material. I would like to precalculate it so that I can save time when loading the Model. But I need to keep the original “range” for each geometry before the merge maybe using “extra”. The ranges can be described by a start vertex, vertex count and a start index and index count for example. So the only concern is whether doing Draco compression and Decompression will change the vertex order so that the range information becomes no longer valid?

I’m not sure about this one. Can you ask on the glTF GitHub?