3
$\begingroup$

I'm looking for any way which enables me to quickly generate gltf files including the conversion of plain array buffers (vertex, index, color, etc.) into binary (bgltf, glb, bin) files.

I'm asking because it currently looks like there are only high level applications like Maya, Blender available which can do that or converters to indirectly write glTF from COLLADA.

Are there any way to generate binary gltf array buffers using low level / command line utilities?

$\endgroup$
2
$\begingroup$

Technically any file format where you can dump the entire file into a VBO and then render from that will work for the .bin files. Unfortunately those formats are less well known than they should be.

Then you only need to adjust the bufferview elements to reference the proper subset of the file

$\endgroup$
1
$\begingroup$

I've finally managed to write the buffers myself using JavaScript.

The result is a base64 encoded String, like:

data:application/octet-stream;base64,AAACAAIABAAEAAAAAAABAAEABAB7g689dnGbPb1SFj1Q/Hg/vsF3P7hAAj3Qs3k/bcVuPw==

If you paste this Data URI into the browser, you can download a binary blob which is exactly what the glTF files can use.

enter image description here

The 52 bytes in this case contain 10 indices of 2 bytes size (U_SHORT) and 8 vertices of 4 bytes size (FLOAT), so 10 * 2 B + 8 * 4 B = 52 B.

See this post to find out how I generated the buffer and see this answer on how to read the data again.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.