Loading local gltf file with its texture image files, .bin file etc

I have figured out to give an object url to a local file selected through an input type file. If this file is glb it is appended to the scene as I want. If it is a gltf it cannot be appended, and an error on console says:
BJS - [15:03:01]: Unable to load from blob:http://127.0.0.1:8887/ca4a2c45-95e1-40a3-8488-1d3a33a0f0c5: Unexpected magic: 1969300091

I think this can be due to its accompanying files. How to load a local gltf file which has a .bin file and possibly other assets too.
Note: all of the files are in the local file system.

You have to use our FileInput class for that. See how we do it in the Sandbox:


(And make sure to select all files)

I have changed input element to multiple. But I have textures in a texture directory. Only the .bin file is next to .gltf file. These are coming like that and also encoded like that inside the .gltf file.

How to make use of FilesInput class from here?

You can’t . They must be side by side

Is it not a limitation? Eventhough not in babylonjs’s part

It is a limitation of the file input mechanism in html world

It definitely is. Anyways. I will try to hack it out. I have an idea. When I am done I will share it here.
Hint: involves modified version of a babylon/gltf scene object and object URLs with a bunch of caveats.

1 Like