ModelLoader handles external 3D model files: format detection, loader instantiation, normalization and object-URL lifecycle. Five formats are supported.
| Format | Extension | Data Supported | Notes |
|---|---|---|---|
| GLTF Binary | .glb | Geometry, materials, textures, animations, scene hierarchy | Recommended. Self-contained binary file. |
| GLTF | .gltf | Same as GLB | JSON file that may reference external .bin and texture files, which will not resolve through object URLs |
| Wavefront OBJ | .obj | Geometry only | No materials or textures. All meshes get a default material |
| FBX | .fbx | Geometry, basic materials, animations | Material fidelity varies |
| STL | .stl | Geometry only (triangulated mesh) | Gets a default blue material (#3B82F6, roughness 0.5, metalness 0.1) |
Draco is a compression format for GLTF meshes. Its decoder files must be served from public/draco/gltf/:
public/draco/gltf/
draco_decoder.js
draco_decoder.wasm
draco_wasm_wrapper.jsThe path is configured via dracoLoader.setDecoderPath("/draco/gltf/"). If these files are missing, Draco-compressed GLTF files fail silently or throw a network error.
Loaders are lazily instantiated as module-level singletons, so the first call creates the loader and later calls reuse it.