Skip to main content

Loader category

Keep the scene hierarchy until the renderer needs it.

Scenegraph loaders preserve nodes, meshes, materials, transforms, and extensions as a structured representation. That lets applications inspect, transform, or render a scene without flattening it during decode.

A scene is more than a mesh

Decode the relationships as well as the bytes.

A scenegraph carries the hierarchy that connects geometry, materials, animations, and transforms. The category keeps those relationships available to an application-specific renderer or converter.

Scene files

glTF, GLB, and OpenUSD

Preserves

Nodes, meshes, materials, transforms, animations, and extensions

Payloads

Binary buffers, images, compressed geometry, and textures

Output

Typed scene data close to the source format

The Scenegraph category represents hierarchical 3D scene descriptions. Each loader returns a typed representation close to its source format.

Detailed guide

The scenegraph data model

The sections below document the loaders and the source-shaped data structures they return.

Loaders​

glTF Data Format​

The data format is fairly raw, close to the unpacked glTF/GLB data structure, it is described by:

  • a parsed JSON object (with top level arrays for scenes, nodes etc)
  • a list of ArrayBuffers representing binary blocks (into which bufferViews and images in the JSON point).

Data Structure​

A JSON object with the following top-level fields:

FieldTypeDefaultDescription
magicNumberglTFThe first four bytes of the file
versionNumber2The version number
jsonObject{}The JSON chunk
buffersArrayBuffer[][](glTF) The BIN chunk plus any base64 or BIN file buffers

Buffers can be objects in the shape of {buffer, byteOffset, byteLength}.

Helper Classes​

To simplify higher-level processing of the loaded, raw glTF data, several helper classes are provided in the @loaders.gl/scene/gltf module, these can:

  • unpack and remove certain glTF extensions
  • extract typed array views from the JSON objects into the binary buffers
  • create HTML images from image buffers
  • etc

OpenUSD Data Format​

USDLoader returns a USDStage with root-layer metadata, a hierarchy of typed USDPrim objects, and the URLs of layers used during composition. See the USDLoader reference for supported OpenUSD features and current limitations.