Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| Peer dependency conflict | React/React DOM version and duplicate installations | Use React 19, Three.js ^0.184.0, and React Three Fiber ^9.6.1; inspect npm ls react react-dom three @react-three/fiber |
| Component import is missing | Import entry point | Import SimpleModelViewer from /simple-model-viewer, BindingBuilder from /binding-builder, and ModelViewer from the main package |
| Unstyled or cramped viewer | CSS and parent dimensions | Import the component’s own stylesheet and give its container an explicit height |
| Empty model or loader failure | Browser Network panel and onLoadError | Open modelUrl directly; it must return the asset rather than an HTML 404/sign-in page |
| Model works locally but fails remotely | CORS and external files | Allow requests from the app origin and host GLTF/OBJ/FBX dependencies at their declared relative paths |
| Signed or extensionless URL fails | Format detection | Set the supported modelFormat explicitly |
| ModelViewer/BindingBuilder shows a license error | Key, plan, origin, registered domain | Follow the licensing guide; hosted previews are not automatically local domains |
process is not defined in Vite | Environment variable syntax | Use import.meta.env.VITE_LICENSE_KEY; Next.js uses process.env.NEXT_PUBLIC_LICENSE_KEY |
| Next.js rejects hooks or event handlers | Client boundary | Put hooks/callbacks in a "use client" file; see the complete Next.js guide |
| Binding changes do not affect the intended mesh | Actual node IDs | Read onObjectCatalog, generate automatic bindings, or export from BindingBuilder; do not guess IDs |
| Binding import or state setter fails TypeScript | Export and inferred state type | Export the bindings; use useState<Record<string, ObjectBinding>>(initialBindings) for mutable state |
| Compressed model fails | Decoder requests and CSP | Follow the ModelViewer decoder setup; self-host version-matched files when necessary |
Multiple models and selection
| Symptom | Check / fix |
|---|---|
| Only one model is editable | Expected: only modelUrl is active. Pass onModelChange to enable the switcher and update that URL. |
| Binding edits disappear on switching | With onObjectBindingsChange, write edits to the active models entry, not a shared top-level record. Use useViewerModels. |
| Export contains only one model’s bindings | Expected: export each independent model separately and supply each record on its entry. |
| Added-node bindings have no geometry | Provide the original mergeModels sources with the exact authoring prefixes. Bindings do not include assets. |
| Only the active model’s clips are listed | onAnimationsReady is active-model only. Register every URL through onModelAnimationsReady. |
| Wrong animation plays when names repeat | Select the owning controls by URL, using that model’s local clip name. Editor aggregate suffixes are display names. |
| Group outlines or gizmo point at the wrong objects | Use active-model binding keys, clear selection on model switches, and handle null selection callbacks. |
| Models overlap | Their authored coordinates are retained. Apply placement transforms or author suitable positions. |
| Downloaded GLB no longer animates | GLB download bakes the current geometry pose. Keep original models plus binding/config exports for animated reuse. |
See the export-to-viewer example for a complete controlled integration.
Observe load success and failure
Use onModelLoaded to confirm the asset loaded, and onLoadError to present a
failure state. For ModelViewer, onObjectCatalog reveals bindable identifiers;
onViewerReady connects runtime controls. Do not treat a successful build as
proof that the asset and browser rendering succeeded.
The public sample GLB is useful for separating integration problems from problems in your own asset. It must retain its CC BY 4.0 attribution .
Large or blank scenes
Use a browser/device with WebGL support. Inspect the console for renderer or context-loss errors. Very large assets can exceed device memory; optimize the asset and consult the performance and large-model sections in the ModelViewer reference .
Report an issue
Include the package version, framework, browser/device, sanitized error text, reproduction steps, and a small redistributable model or public sample. Use the public issue tracker . Send license keys, private models, account information and security reports through private support rather than a public issue.
Viewer sizing inside grid and flex layouts
Give the viewer a real height and let its grid/flex item shrink below its content width. Otherwise a wide canvas can force the entire page to overflow:
.viewer-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.viewer-cell { min-width: 0; min-height: 0; height: 500px; }
.flex-viewer-cell { flex: 1 1 0; min-width: 0; min-height: 0; height: 500px; }
@media (max-width: 640px) { .viewer-layout { grid-template-columns: minmax(0, 1fr); } }Place the viewer in .viewer-cell or .flex-viewer-cell. For full-height apps,
define the height of every ancestor rather than relying on an unbounded 100%.
JavaScript download size
Measured in a production Vite build (gzip, everything loaded before and while the first model appears, including three.js, React and React Three Fiber):
| Page uses | JavaScript |
|---|---|
SimpleModelViewer | ~445 KiB |
ModelViewer | ~785 KiB |
| Both | ~795 KiB |
Features you don’t use aren’t downloaded. These load only when needed:
- WebXR, when
xr.enabled(enableXR) is on and the browser supports it - Streaming 3D Tiles, for a
tilesetUrl - KTX2 texture decoding, for a model with KTX2 textures
- OBJ, FBX, USDZ, STL and PLY loaders, for those formats
- HDR lighting loaders, for a downloadable preset or
environmentUrl - The GLB exporter, the AR QR code and the colour picker, when first used
To keep the viewer off a page’s first load, import it with React.lazy (or
next/dynamic) and show a poster until the visitor reaches it.