![](https://private-user-images.githubusercontent.com/470477/268556200-b72f5857-32fe-45a3-8252-3670a1e1ea7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjQ4NjEsIm5iZiI6MTczOTAyNDU2MSwicGF0aCI6Ii80NzA0NzcvMjY4NTU2MjAwLWI3MmY1ODU3LTMyZmUtNDVhMy04MjUyLTM2NzBhMWUxZWE3ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQxNDIyNDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZThjZjhjNWI3OTU5NjkxZDA3MWRjZmFkNzJmMTVlOTQ3ZmZmNDk3ODAzNDlhOWVlODMwMmU2MTA5MDNjYmQwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.x7D8qvWm0XH8tolvUsoY_d0ogHs622g7SFlIlQGb2Fw)
Continuation of https://glitch.com/~aframe-2-vr-menus tile based block editor
Features:
- Cross platform -- runs in most web browsers across devices.
- Simple to use -- Click and drag on desktop. Open it on a smartphone and use the device motion sensors. Or plug in a VR headset!
- Quest controller support -- Use Meta Quest headset and controllers to make a scene
- Reusable gltf asset build system -- example to use for other projects
Credits:
- audit.js and pipeline.js scripts using donmccurdy's gltf-transform package
- screenshot-glb script from shopify
- source assets from kaykit https://kaylousberg.itch.io/city-builder-bits
- Continuation of Kieran's work from: https://glitch.com/edit/#!/aframe-2-vr-menus
- Which itself was modified from this original: https://glitch.com/~aframe-aincraft
- Inspired by: https://threejs.org/examples/webgl_interactive_voxelpainter.html
- Built with A-Frame, a web framework for building virtual reality experiences. Make WebVR with HTML and Entity-Component. Works on Vive, Rift, desktop, mobile platforms.
This repo is intended to show an example of a complete gltf pipeline from exported gltf file through optimization and screenshot generation and a json file to describe the model library for use in front-end apps.
After running npm install
then run npm run gltf:pipeline
to do the full 3 step process of auditing, building and creating screenshots for your source glTF library.
Or, you can run each script separately in this order:
node gltf-audit.mjs -i ./src/models
- create initial gltf-audit.json outputnode gltf-build.mjs -i ./src/models -o ./dist/models -u
- create optimized glb modelsnode gltf-screenshots.mjs -i ./dist/models -o ./dist/img -u
- create preview images for each glb
Each of the 3 scripts above have corresponding npm scripts to be accessed like npm run gltf:audit
, npm run gltf:build
, and npm run gltf:screenshots
. The command npm run gltf:pipeline
simply runs all 3 in that order.
Generates json file with details about gltf or glb files in project ./src/ path
example usage:
$ node gltf-audit -i src
-i is optional to specify a directory to audit
Takes input directory of assets and optimizes each including adding draco compression to an output directory
example usage:
$ node gltf-build -i src -o dist
- -i and -o are required
- optional --update (or -u) will assume existence of gltf-audit.json from gltf-audit.js above, and add the newly built glb files under "dist" key
$ node gltf-build -i src -o dist -u
Create screenshots for all glb files found in input path using the screenshot-glb script.
example usage
$ node gltf-screenshots -i ./dist/ -o ./dist/
$ node gltf-screenshots -i ./dist/ -o ./dist/ -u
- optional --update (or -u) will assume existence of gltf-audit.json from gltf-audit.js above, and add the newly built jpg files under "img" key
example usage:
$ screenshot-glb -i input.glb -o test.png
- glb is required, doesn't work with gltf (issue)