Support exporting embedded .gltf
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently (using WebIO in my case), you can use the writeBinary
function to export as .glb, and the writeJSON
function to export as .gltf with external resources.
It would be useful to have also the “.gltf embedded” option like blender does:
In my usecase, I need the json to be stored in another json file.
Describe the solution you’d like
A function like writeJSONEmbedded
or something that returns just the json object with the resources embedded in base64 in the object.
Describe alternatives you’ve considered Doing it myself (geometry only in this case):
const encodedBuffer = base64js.fromByteArray(new Uint8Array(resources['.bin']));
gltfCompressed.buffers[0].uri = `data:application/octet-stream;base64,${encodedBuffer}`;
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Exporting gltf embedded - Questions
Hello, I am trying to export a gltf File but the goal is to have only one file without the .bin BABYLON.GLTF2Export.
Read more >A Step-by-Step Guide to Exporting glTF Files From Blender
Run the Blender application. Go to Edit > Preferences > Add-ons; Search for 'glTF'; Enable Import-Export glTF 2.0 format.
Read more >glTF 2.0 (GLTF/GLB) File
Select the menu/tool indicated in Location. → The Save File window opens. · Select the desired saving path and click Save. → The...
Read more >glTF 2.0 — Blender Manual
The exporter supports Metal/Rough PBR (core glTF) and Shadeless ( KHR_materials_unlit ) materials. It will construct a glTF material based on the nodes...
Read more >Best practices for .gltf / .glb · Issue #1117
Documentation for when to export/import .gltf / .glb for different types of apps, e.g., desktop vs. web, consumer vs. developer, etc.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nit: base64 encodes each 3 bytes as 4, so it adds 33% size penalty.
There are no Data URIs in a
.glb
file1 – it’s binary data with the JSON prepended, similar to a file header. A.gltf
file cannot contain binary data and so encoding binary as Data URIs (base64 strings) is necessary instead. This adds a 25-30% size penalty compared to binary data in a.glb
, and decoding the Data URI can sometimes block the main thread in web browsers. If the final assets were gzipped, the size penalty might be lower but additional parsing cost is the same.<small>1 Technically you could combine them, but there’s no reason to and I’ve never seen it done.</small>