A-Frame Convert Zip Package into Glb for Sketch Fab Model
I've Been Coding in a-Frame Recently and I've Been Using Gltf Models in My Scene. I've Been Using Tinkercad Models Because I Can't Figure out How to Put...
I've been coding In A-frame recently and I've been using gltf models in my scene. I've been using tinkercad models because I can't figure out how to put sketchfab.com models in my code. When I download a model from sketchfab.com and press download as gltf, it gives me a zip folder. Inside the zip folder are 2 files and a folder. Scene.glf and scene.bin are the files and textures is the folder. I want to take this zip folder and turn it into a sole glb or gltf file. How would I accomplish this?
1 Answer
For others' context, Sketchfab returns something like...
model/scene.gltfmodel/scene.binmodel/textures/diffuse.pngmodel/textures/normal.png
... where the scene.gltf file contains relative references to the other files. A-Frame can load all of those files given just the .gltf reference, as documented, as long as they're hosted in your project under a similar folder structure:
<a-gltf-model src="assets/model/scene.gltf"></a-gltf-model>
It's also common to combine the whole model into a self-contained (binary) .glb file, which is a "lossless" change and should not affect the content in any way if done by a correctly-implemented tool. Two easy options would be glTF-Pipeline or glTF-Transform. Example:
npm install --global @gltf-transform/cli
gltf-transform cp model/scene.gltf output.glb
Also see , but it may not work with certain files.
NOTICE: While it's technically possible to create a self-contained
.gltffile, rather than.glb, don't do this. Embedding binary resources in a (JSON).gltffile adds 20-30% to file size and reduces loading speed. The (binary).glbformat is more efficient here.