A repo to quickly display any model (fbx & gltf format with compression) using Three.js.
- GLTF supports gltf-pack, gltf-pipeline and Blender exports.
- gltf-pack compression uses vertex quantisation, gltf-pipeline uses DRACO compression
- Clone the repo.
- Run
npm installto install all the dependencies - Use
npm run devto compile the project in development mode - Use
npm run buildto compile the project in production mode - Open
index.htmlusing Live Server
- index.html - Display the FBX model (by default) on the full page.
- Source files:
- app.js - (default script) Displays FBX Model
- app2.js - Displays GLTF Model
- app.scss
- Output files: Generated by Webpack after you compile the project
- bundle.js
- main.css
- Everything is written inside an exportable class named
Sketchso it can be easily imported using ES6+ syntax. - To view GLTF model, change
entryinwebpack.config.jstoapp2.jsand then compile the project usingnpm run dev. - In case your model is compressed with Blender or gltf-pipeline, DRACO compression is applied over the model so make sure you include the
draco-filesfolder in your project. - In case your model is compressed with gltf-pack, it uses mesh quantisation to compress the model so make sure you correctly import the MeshoptDecoder from three module.
- All animations are played by default if provided in the GLTF.
- The model is displayed in MeshNormalMaterial, so in case normals are not provided, the model will be solid black.
- Source files: