Read glb file from string

Pretty much like this example, but I want to read a .glb file, not a .gltf file, because it’s a model with textures and materials. Is there a way to have a .glb string and have babylonjs instantiate a model from it? Or is there a way to use a normal .gltf but with the external textures and materials embedded in the string as well?

You could use base64 for glb

https://playground.babylonjs.com/#58T0JY

4 Likes

I have a Question:
Can I copy base64 string to txt file or html file and read it from “data:base64,/string.txt”?
Thank very much

You just have to load the file like in this example (using json): How to read an external local JSON file in JavaScript? - Stack Overflow

Not sure why you would use a data URL if the data you are loading is already in a file, in that case you can probably just load the file directly. Can you explain what you’re trying to do a bit more?