Introduction
glTF is an open standard from the Khronos Group for delivering 3D scenes and models, often described as the JPEG of 3D. Version 2.0 was released in 2017. It carries meshes, physically based materials, textures, cameras, skeletons and animation, in a layout that maps closely onto how graphics cards draw, so it loads quickly in browsers and game engines.
There are two forms. A .gltf file is JSON that points to separate binary
buffers and images. A .glb file packs the JSON and the binary data into a
single file. Extensions add features such as mesh compression with
Draco.
Structure
The JSON describes the scene as arrays that refer to each other by index.
scenes list root nodes; a node has a transform and may hold a
mesh, a camera or a skin. A mesh’s primitives
read their vertex data through accessors, which describe a typed view
into a bufferView, which is a slice of a buffer of raw bytes.
materials, textures, images and
animations complete the scene, and asset gives the version.
A GLB file is a 12-byte header followed by chunks. All values are little-endian.
0Header magicglTF, version 2, total length12 bytes12JSON chunk length, typeJSON, the scene descriptionvaries…BIN chunk length, typeBIN, the buffer data (optional)varies
Links
Software
- Blender (Windows, macOS, Linux)
- Godot (Windows, macOS, Linux)
- Unreal Engine (Windows, macOS, Linux)
- Khronos glTF Sample Viewer (web browsers)
Developers
- three.js, JavaScript, with its GLTFLoader for browsers
- Babylon.js, JavaScript engine that loads glTF and GLB
- cgltf, single-file C library that parses glTF and GLB
- tinygltf, header-only C++ library that loads and saves glTF
- glTF Transform, JavaScript library and command line tool for editing and optimising glTF
Reference
- glTF 2.0 specification, Khronos Group
- glTF repository, Khronos Group, with the extensions