A glTF 2.0 asset is one JSON object. Its top-level properties are arrays of objects
that refer to one another by index (a glTF id, an integer from 0). This page
lists every object the Khronos specification and its JSON schemas define, with their
properties and defaults. Accessors, buffers and buffer views are on
Buffers and attributes. Every object may also
have name (most objects), extensions and
extras (any application data).
Top level
| Property | Holds |
|---|---|
asset | required: version (required, "2.0"), minVersion, generator, copyright |
scene | the index of the default scene; needs scenes |
scenes, nodes, meshes, materials, textures, images, samplers, cameras, skins, animations, accessors, bufferViews, buffers | arrays of the objects below, each with at least one item when present |
extensionsUsed | names of the extensions the asset uses, each once |
extensionsRequired | names of the extensions needed to load it at all |
A loader must refuse an asset whose minVersion (or major version) it
does not support, or which requires an extension it does not know.
Scenes and nodes
A scene has nodes, the indices of its root nodes.
| Node property | Default | Meaning |
|---|---|---|
children | indices of child nodes, each once; nodes form trees, with no cycles | |
mesh | the mesh drawn at this node | |
camera | the camera at this node | |
skin | the skin that deforms the mesh; needs mesh | |
matrix | identity | 16 numbers, a column-major 4×4 transform; not with the three below, and not on an animated node |
translation | [0, 0, 0] | x, y, z |
rotation | [0, 0, 0, 1] | a unit quaternion x, y, z, w |
scale | [1, 1, 1] | x, y, z |
weights | morph target weights, one per target of the mesh |
The local transform is T × R × S. Units are metres, angles radians, and the coordinate system is right-handed with +Y up and +Z forward for assets.
Meshes and primitives
A mesh has primitives (required) and default morph
weights. Each primitive:
| Property | Default | Meaning |
|---|---|---|
attributes | required: attribute names mapped to accessor indices (see attributes) | |
indices | an accessor of unsigned byte, short or int scalars; without it the vertices are drawn in order | |
material | the material; without it, the default material | |
mode | 4 | 0 points, 1 lines, 2 line loop, 3 line strip, 4 triangles, 5 triangle strip, 6 triangle fan |
targets | morph targets, each mapping attribute names to accessors of differences |
Materials
| Property | Default | Meaning |
|---|---|---|
pbrMetallicRoughness.baseColorFactor | [1, 1, 1, 1] | linear RGBA, each 0 to 1 |
pbrMetallicRoughness.baseColorTexture | sRGB colour, alpha linear | |
pbrMetallicRoughness.metallicFactor | 1 | 0 to 1 |
pbrMetallicRoughness.roughnessFactor | 1 | 0 to 1 |
pbrMetallicRoughness.metallicRoughnessTexture | metalness from the blue channel, roughness from green | |
normalTexture | a tangent-space normal map; adds scale (default 1) | |
occlusionTexture | ambient occlusion from the red channel; adds strength (default 1) | |
emissiveTexture | sRGB emitted light | |
emissiveFactor | [0, 0, 0] | linear RGB, each 0 to 1 |
alphaMode | "OPAQUE" | OPAQUE ignores alpha; MASK cuts at alphaCutoff; BLEND blends |
alphaCutoff | 0.5 | for MASK only |
doubleSided | false | when false, back faces are culled |
A texture reference (textureInfo) has index (required, a
texture) and texCoord (default 0: which TEXCOORD_n set to
use).
Textures, images and samplers
A texture joins a source (an image) and a
sampler; without a sampler, repeat wrapping and automatic filtering
apply. An image has either a uri (a relative path or a
data: URI) or a bufferView with a mimeType,
which is image/jpeg or image/png.
| Sampler property | Values |
|---|---|
magFilter | 9728 nearest, 9729 linear |
minFilter | 9728 nearest, 9729 linear, 9984 nearest mipmap nearest, 9985 linear mipmap nearest, 9986 nearest mipmap linear, 9987 linear mipmap linear |
wrapS, wrapT | 10497 repeat (default), 33071 clamp to edge, 33648 mirrored repeat |
The numbers are the OpenGL constants of the same names.
Cameras
A camera has type (required: "perspective" or
"orthographic") and an object of the same name. It looks down its node’s
−Z axis with +Y up.
| Type | Properties |
|---|---|
| perspective | yfov (required, vertical field of view in radians), znear (required), zfar (omitted for an infinite projection), aspectRatio (omitted to use the viewport’s) |
| orthographic | xmag and ymag (half the width and height), znear, zfar; all required |
Skins
A skin has joints (required: the nodes used as bones),
inverseBindMatrices (an accessor of one 4×4 float matrix per joint;
identity when omitted) and skeleton (the common root node). A skinned
primitive’s JOINTS_n index into joints and
WEIGHTS_n weight them.
Animations
An animation has channels and samplers, both
required. A channel has a sampler index and a target with
node and path. A sampler has input (an accessor
of key times in seconds, float scalars rising), output (the values) and
interpolation.
| Path | Output |
|---|---|
translation | VEC3, float |
rotation | VEC4 quaternion, float or normalized byte or short |
scale | VEC3, float |
weights | SCALAR, one per morph target per key, float or normalized byte or short |
| Interpolation | Meaning | Outputs per key |
|---|---|---|
LINEAR (default) | straight lines between keys; rotations by spherical interpolation | 1 |
STEP | hold each value until the next key | 1 |
CUBICSPLINE | a cubic Hermite spline with given tangents; needs at least two keys | 3: in-tangent, value, out-tangent |