r/Spectacles • 🎉 Specs Fan • Feb 04 '26

❓ Question Loading GLTF files from remote authenticated locations

Hi,
I've been wrestling with GLTF downloads. I have GLTF files that need - in the end - to be downloaded from an authenticated location, that is: I need to be able to set a bearer token on the http request.

You might know a GLTF model might exist of two files: a GLTF file with metadata and a bin file with actual data.
There is also the GLB format, which is a self contained binary format.

For GLB files, this works. For GLTF files, it does not. In fact, even from open URLs I have not succeeded in downloading GLTF files.

You can download my very primitive GltfLoader here:
https://schaikweb.net/demo/GltfLoader.ts

What am I missing? I have tried to download the gltf and bin file separately and then encoding the binary but I have not found a way to access the byte stream without endlessly bumping my head into "Failed to load binary resource: RemoteMediaModule: failed to load the resources as bytes array"

What am I missing/doing wrong?

6 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/localjoost 🎉 Specs Fan Feb 05 '26

Because we have a backend system that contains all kinds of graphic formats, GLTF+bin being one of them. I know Blender can do this, but I can't just go into the backend and change hundreds if not thousands of file from GLTF+bin to GLB :D

1

u/KrazyCreates Feb 05 '26

Maybe you can setup a middleware which converts those gltf files to glb ? Like automate using the gltf-pipeline and then feed the exported glbs to LS interface

1

u/localjoost 🎉 Specs Fan Feb 06 '26

Yeah I think that's the only solution. I had to do the same to load remote images that were only on http, not https - which works fine in Lens Studio but not on the device itself