File: GLTFExporter.md | Updated: 11/15/2025
An exporter for glTF 2.0.
glTF (GL Transmission Format) is an open format specification for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb) format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and/or cameras.
GLTFExporter supports the glTF 2.0 extensions:
The following glTF 2.0 extension is supported by an external user plugin:
const exporter = new GLTFExporter();
const data = await exporter.parseAsync( scene, options );
GLTFExporter is an addon, and must be imported explicitly, see Installation#Addons.
import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js';
Constructs a new glTF exporter.
A reference to a texture utils module.
Default is null.
Parses the given scenes and generates the glTF output.
input | A scene or an array of scenes.
---|---
onDone | A callback function that is executed when the export has finished.
onError | A callback function that is executed when an error happens.
options | options
Async version of GLTFExporter#parse.
input | A scene or an array of scenes.
---|---
options | options.
Returns: A Promise that resolved with the exported glTF data.
Registers a plugin callback. This API is internally used to implement the various glTF extensions but can also used by third-party code to add additional logic to the exporter.
callback | The callback function to register.
---|---
Returns: A reference to this exporter.
Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.
Depending on whether you use WebGLRenderer or WebGPURenderer, you must inject the corresponding texture utils WebGLTextureUtils or WebGPUTextureUtils.
utils | The texture utils.
---|---
Returns: A reference to this exporter.
Unregisters a plugin callback.
callback | The callback function to unregister.
---|---
Returns: A reference to this exporter.
onDone callback of GLTFExporter.
result | The generated .gltf (JSON) or .glb (binary).
---|---
onError callback of GLTFExporter.
error | The error object.
---|---
Export options of GLTFExporter.
trs
boolean | Export position, rotation and scale instead of matrix per node. Default is false.
---|---
onlyVisible
boolean | Export only visible 3D objects. Default is true.
binary
boolean | Export in binary (.glb) format, returning an ArrayBuffer. Default is false.
maxTextureSize
number | Restricts the image maximum size (both width and height) to the given value. Default is Infinity.
animations
Array.<AnimationClip> | List of animations to be included in the export. Default is [].
includeCustomExtensions
boolean | Export custom glTF extensions defined on an object's userData.gltfExtensions property. Default is false.