Generate GLTF scene with multiple compression levels

I’m creating a DRACO-compressed GLTF asset with several elements. Some elements are organic and highly detailed, while others are pretty large and boxy. To save filesize without losing much fidelity, I’d like to apply different levels of compression to these two types of elements:

  • Organic elements: high quantize bits
  • Large straight elements: low quantize bits

Unfortunately, the GLTF exporter only allows one Quantize Position value for the whole scene:
compression

So I’d have to export my scene in 2+ binary files: a high-fidelity and low-fi. The question is, is there a way to manually edit my .gltf JSON so I can use multiple binary files in one scene? This is what I get at the end of the JSON file.

    "bufferViews" : [
        {
            "buffer" : 0,
            "byteLength" : 69339,
            "byteOffset" : 0
        }
    ],
    "buffers" : [
        {
            "byteLength" : 69340,
            "uri" : "scene.bin"
        }
    ]

I could manually add multiple .bin files to the buffers & bufferViews arrays, but can the GLTFLoader parse multiple .bin files? If so, how can I edit my file to so the accessors can distinguish between them?

Yes, it can.

If so, how can I edit my file to so the accessors can distinguish between them?

This might be helpful as an example. The library overall is pretty experimental, and doesn’t handle all glTF files well, but the steps involved in splitting out multiple .bin files should be about right:

2 Likes