KhronosGroup/glTF

Support BSON with .glb format

OhmygodWorks opened this issue · 2 comments

Will BSON (binary JSON) suitable for .glb format as they are both binary format?

The is no support for BSON right now.

Theoretically, there could be a dedicated chunk type for this. So in addition to JSON or BIN, there could be BSON. But AFAICT there currently is no mechanism in place for defining new or additional chunk types.

Brainstorming: One could, even more theoretically, try to construct an extension, that still stores a (small) JSON, and just delegates to the BSON data, very roughly like

{ 
    "asset": { ... }
    "extensions": {
        "EXAMPLE_bson": {
            // Refers to the chunk in the binary buffer that contains
            // the actual JSON structure, but as BSON
            "chunkIndex": 2
        }
    }
}

But I don't have an idea how feasible this is in practice, or how widely it would be implemented.

Personally, I think if an application developer wants to use BSON, they should think of that as a 'wrapping' format, rather than as a variant or extension to glTF, and just encode the data as they wish. Similar to how the 3D Tiles standard embeds glTF today, without requiring incompatible glTF encodings.

Introducing BSON (or other alternative encodings like MessagePack, CBOR, or protobuf) within the glTF standard would be a substantial breaking change that requires a v2 → v3 bump in my opinion — not because an extension couldn't technically work, but because it's just that big of an ecosystem shift. I'm not currently in favor of such a change.