What Is the Relation Between .gltf and .bin Files?
The relationship between a .gltf file and its companion
.bin file is a division of labor between scene structure
and raw geometric payload. A .gltf file contains a
human-readable JSON schema defining the scene hierarchy, materials, node
transformations, animations, and object relationships. In contrast, the
external .bin file stores the raw, unformatted binary
data—including vertex positions, normals, texture coordinates, bone
weights, and animation keyframes—which the JSON references through byte
offsets and buffer views.
The Dual-File Architecture of glTF
The GL Transmission Format (glTF) was designed by the Khronos Group to serve as the "JPEG of 3D." Its primary design requirement is rapid loading and GPU parsing across web and real-time graphics engines.
Representing high-density 3D coordinates, index arrays, and float values directly in JSON text creates significant parsing overhead and balloons file sizes. To solve this, glTF separates structured metadata from heavy numerical arrays:
- The
.gltffile: Acts as the manifest and blueprint. It organizes the 3D scene graph, camera properties, material shaders, and animation timelines using JSON syntax. - The
.binfile: Acts as the compact payload. It stores raw binary blocks containing contiguous arrays of 32-bit floating-point numbers, unsigned integers, and bytes without parsing markers.
How the JSON Manifest Addresses the Binary Payload
The connection between the text-based .gltf document and
the .bin asset is established via a three-tier indexing
system defined within the JSON: Buffers,
BufferViews, and Accessors.
1. Buffers (buffers)
The buffers array defines the physical storage location
and total byte length of the binary resource. For a separate binary
file, the JSON entry references the URI directly:
"buffers": [
{
"uri": "model_data.bin",
"byteLength": 102400
}
]2. BufferViews
(bufferViews)
A bufferView slices the monolithic binary chunk into
discrete continuous partitions. It tells the runtime engine how to
isolate specific regions of memory, defining a starting byte offset
(byteOffset), total segment length
(byteLength), and optional stride (byteStride)
for interleaved attribute arrays:
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 38400,
"target": 34962
}
]The target parameter communicates whether the data
should bind as a vertex attribute buffer (ARRAY_BUFFER) or
an index buffer (ELEMENT_ARRAY_BUFFER).
3. Accessors
(accessors)
An accessor sits on top of a bufferView and
defines how the underlying raw bytes must be typed and read by rendering
APIs such as WebGL, WebGPU, Vulkan, or DirectX. It provides:
componentType: Specifies the data type (e.g., unsigned short, float).type: Specifies dimensionality (e.g.,SCALAR,VEC2,VEC3,MAT4).count: The total number of elements.minandmax: Bounding-box boundaries used for fast frustum culling.
Meshes, primitives, and animation channels reference accessor indices rather than the binary data directly.
Operational Lifecycle During Scene Loading
When a runtime engine loads a .gltf asset with an
external .bin component, the loading pipeline operates
through sequential phases:
- Manifest Retrieval: The engine fetches and parses
the
.gltfJSON structure. - Binary Fetching: The engine resolves the
uriin thebufferssection and asynchronously fetches the.binfile as anArrayBuffer. - Direct Memory Mapping: Rather than iterating over
strings to reconstruct arrays, the runtime maps the binary buffer
directly into GPU memory buffers (VBOs and IBOs) according to the
specifications in
bufferViews. - Scene Graph Construction: Materials, textures, node
hierarchies, and skinning rigs from the JSON are bound to the
GPU-resident buffers via their assigned
accessors.
Advantages of Separating the Files
Keeping the JSON manifest and binary payload in discrete files provides specific production advantages:
- Efficient Network Caching: Metadata adjustments
(such as changing a node's transform, swapping an external texture
reference, or tuning a PBR material roughness value) only require
re-downloading the lightweight JSON text, leaving the large
.binfile cached. - Streaming and Progressive Loading: Applications can
parse the lightweight
.gltfscene layout instantly to establish camera angles, bounding boxes, and object placement while larger binary mesh geometry streams in progressively. - Zero Parsing Overhead: Numeric arrays stored in
.binmatch native CPU and GPU memory layouts, avoiding the floating-point parsing latencies inherent in formats like OBJ or Collada.