NOTE: This version of the documentation tracks unstable development happening on A-Frame’s
masterbranch. If you wish to try it out, grab the unstable build. Otherwise, head to the documentation for the current 1.2.0 version
glTF (GL Transmission Format) is an open project by Khronos providing a common, extensible format for 3D assets that is both efficient and highly interoperable with modern web technologies.
gltf-model component loads a 3D model using a glTF (
Note that glTF is a fairly new specification and adoption is still growing. Work on the three.js glTF loader and converters are still active.
NOTE: A-Frame supports glTF 2.0. For models using older versions of the glTF format, use
In comparison to the older OBJ format, which supports only vertices, normals, texture coordinates, and basic materials, glTF provides a more powerful set of features. In addition to all of the above, glTF offers:
- Hierarchical objects
- Scene information (light sources, cameras)
- Skeletal structure and animation
- More robust materials and shaders
For simple models with no animation, OBJ is nevertheless a common and reliable choice.
In comparison to COLLADA or FBX, the supported features are very similar. However, because glTF focuses on providing a “transmission format” rather than an editor format, it is more interoperable with web technologies. By analogy, the .PSD (Adobe Photoshop) format is helpful for editing 2D images, but images are converted to .JPG for use on the web. In the same way, glTF is a simpler way of transmitting 3D assets while rendering the same result.
In short, expect glTF models to work with A-Frame more reliably than other formats.
Load a glTF model by pointing to an asset that specifies the
src for a glTF
|selector||Selector to an
|model-loaded||glTF model has been loaded into the scene.|
|model-error||glTF model could not be loaded.|
Alternatively, load a glTF model by specifying the path directly within
url(). However, the scene won’t wait for the resource to load before
<a-entity gltf-model="#monster" animation-mixer></a-entity>
glTF file size may be reduced using Draco or Meshopt compression. Neither of these affect textures, which should be compressed or resized by other methods. Furthermore, compression does not particularly affect framerate — if the model has too many triangles or draw calls, compression will not change that, and the model should be simplified using tools like Blender or gltfpack, instead.
- Draco: Compression for geometry, often reducing geometry size by 90-95%. Requires some extra time to decompress on the device, but this occurs off the main thread in a Web Worker.
- Meshopt: Compression for geometry, morph targets, and animation. If combined with additional lossless compression (like gzip) Meshopt may have similar compression ratios to Draco, with much faster decompression. Note: Some web servers do not support gzip with
.gltffiles (see: GitHub Pages).
To optimize an existing glTF model, use tools such as:
- Blender: Draco compression
- glTF-Pipeline: Draco compression
- glTF-Transform: Draco or Meshopt compression
- gltfpack: Meshopt compression
You’ll also need to load a decoder library by configuring scene properties as explained below.
When using glTF models compressed with Draco or Meshopt, you must configure the path to the necessary decoders:
<a-scene gltf-model="dracoDecoderPath: path/to/decoder/;
|dracoDecoderPath||Path to the Draco decoder libraries.||‘’|
|meshoptDecoderPath||Path to the Meshopt decoder.||‘’|
dracoDecoderPath path must be a folder containing three files:
draco_decoder.js— Emscripten-compiled decoder, compatible with old browsers like IE11.
draco_decoder.wasm— WebAssembly decoder, compatible with modern browsers.
These files are available from the three.js repository, under
gltf-model component will
be included. A Google-hosted version of the Draco decoder libraries saves you from needing to include these libraries in your own project: set
https://www.gstatic.com/draco/v1/decoders/ as the value for
meshoptDecoderPath path should be the complete file path (including filename) for a Meshopt decoder, typically named
meshopt_decoder.js. Meshopt requires WebAssembly support. A CDN-hosted, versioned decoder is available at
https://unpkg.com/[email protected]/meshopt_decoder.js, or you may download copies from the meshoptimizer GitHub repository.
Over 100,000 glTF models are free for download on Sketchfab, and various exporters and converters converters are available:
See the official glTF specification for available features, community resources, and ways to contribute.