KhronosGroup / KhronosGroup/glTF

GLB packing has issues, stemming from its one buffer limit

Open
#1,318 23 comments 2 reactions 0 assignees View on GitHub
breaking change spec:glb
Dominant language
HTML
Stars
7.8k
Forks
1.2k
Avg merge
17h 26m
Merged PRs (30d)
5

Description

The GLB single-file format should be augmented imo. Only supporting a single buffer brings a couple big issues:

1. It is not reversible. You lose the filenames and file delineations when smushing everything into a single buffer. This lost data is a huge barrier to using the GLB format at all.
2. it comes with memory cost at load time. If you want to load a single scene from a GLB file, you need to load the entire GLB binary buffer into memory. edit: It's actually possible to implement partial buffer loading in an intelligent way, but it's not as straight forward as it could be.

I don't see a reason why GLB packing is limited to a single buffer. IMO, every buffer with uri == "" should appear in the GLB as a seperate chunk, in the order that they are found in the JSON.

^ Unfortunately that's a breaking change. To keep breaking changes small, we could also do something like this - an extension to the buffer definition:

```

buffer.extensions.glbUnpacking.unpackedBuffers//an array of GlbUnpackedBuffer objects

struct GlbUnpackedBuffer{
uint64 byteOffset;//where this unpacked buffer starts within the GLB binary chunk
uint64 byteLength;//the length of the unpacked buffer
string uri;//the URI of the unpacked buffer
vector associatedBufferViews;//the buffer views that will be updated to point to this new unpacked buffer
}
```

Contributor guide

Open the contributing guide

Research direction

The issue proposes changing GLB packing so multiple buffers can be represented while preserving filenames and enabling partial loading. Start by reviewing the GLB single-buffer behavior and the JSON buffer definitions described here. Done would require an agreed format design, compatibility approach, and corresponding specification updates.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.