Is it possible to change file extension on .bin files?

I have a special case and I am trying to find a workaround. I am doing a 3d rich media banner game and the system only allows file types HTML, JS, CSS, JPG, JPEG, GIF, PNG, and SVG. I am able to change gltf to js files and everything seems happy however, it will not load the .bin file if I change that file extension.

I was thinking a workaround could be using the GLB file instead since it has everything together in 1 file instead of split out, the issue here is when I rename the GLB to js, it doesn’t know it was a GLB file. Is there a way to trick the GLTFLoader that my js file is really a GLB file?

Try using glTF-pipeline (https://github.com/AnalyticalGraphicsInc/gltf-pipeline) to convert both files to a single JSON file:

npm install -g gltf-pipeline
gltf-pipeline -i input.gltf -o embedded.gltf

The result will be 20-30% bigger because it isn’t binary, but then you don’t need a separate .bin file at all.

That worked like a charm! Thanks for your help!

1 Like