3D models are available in hundreds of file formats, each with different purposes, assorted features, and varying complexity. Although three.js provides many loaders, choosing the right format and workflow will save time and frustration later on. Some formats are difficult to work with, inefficient for realtime experiences, or simply not fully supported at this time.
This guide provides a workflow recommended for most users, and suggestions for what to try if things don't go as expected.
If you're new to running a local server, begin with [link:#manual/introduction/Installation installation] first. Many common errors viewing 3D models can be avoided by hosting files correctly.
Where possible, we recommend using glTF (GL Transmission Format). Both .GLB and .GLTF versions of the format are well supported. Because glTF is focused on runtime asset delivery, it is compact to transmit and fast to load. Features include meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and cameras.
Public-domain glTF files are available on sites like Sketchfab, or various tools include glTF export:
If your preferred tools do not support glTF, consider requesting glTF export from the authors, or posting on the glTF roadmap thread.
When glTF is not an option, popular formats such as FBX, OBJ, or COLLADA are also available and regularly maintained.
Only a few loaders (e.g. [page:ObjectLoader]) are included by default with three.js — others should be added to your app individually.
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
Once you've imported a loader, you're ready to add a model to your scene. Syntax varies among different loaders — when using another format, check the examples and documentation for that loader. For glTF, usage with global scripts would be:
const loader = new GLTFLoader();
loader.load( 'path/to/model.glb', function ( gltf ) {
scene.add( gltf.scene );
}, undefined, function ( error ) {
console.error( error );
} );
See [page:GLTFLoader GLTFLoader documentation] for further details.
You've spent hours modeling an artisanal masterpiece, you load it into the webpage, and — oh no! 😭 It's distorted, miscolored, or missing entirely. Start with these troubleshooting steps:
If you've gone through the troubleshooting process above and your model still isn't working, the right approach to asking for help will get you to a solution faster. Post a question on the three.js forum and, whenever possible, include your model (or a simpler model with the same problem) in any formats you have available. Include enough information for someone else to reproduce the issue quickly — ideally, a live demo.