Can load glb files in Chrome but not babylon files?

Hi everyone,

So far I’ve been working on my project locally on Frirefox, but I now need to deploy it on a server and test it on Chrome. Immediately I was met with the following error while attempting to load a .babylon file:

loadAssets of undefined from undefined version: undefined, exporter version: undefinedImportScene has failed JSON parse

This error doesn’t appear when I’m loading a glb file. After browsing the forums a bit, it seems it has to do with the @babylon-loaders library I’m already using? I call:

SceneLoader.RegisterPlugin(new GLTFFileLoader());

To allow support for gltf and glb files, but I couldn’t find a similar plugin for babylon files, if such exists. This is probably a newbie question, but I didn’t factor the different search engines soon enough in production. Any help is welcomed.

Do you have a network error? maybe your server is not set up to serve .babylon files

1 Like

I doubt if GLTFFileLoader will load .babylon files.
It is designed to load GLTF files.
Probably you could use SceneLoader.ImportMesh or similar?
Docs example - https://playground.babylonjs.com/#WLDCUC#190

Hi, no I don’t have a network error. I don’t think it’s the server either, since I’m still able to load babylon files in firefox.

Hi, I’m using SceneLoader.LoadAssetContainer() to load everything in my scene, following the documentation. This allows me to edit the meshes and lights of my assets directly before appending them to my scene. I don’t know if this changes anything compared to the other methods of loading a file.

Do you have any chrome extension that could be blocking it?

Can you repro this in the Playground? What version of Babylon are you using?

Hi @Deltakosh, I’ve installed a clean version of Chrome a few days ago specifically to test my project, with no extensions, so that’s not the issue.

Hello, I haven’t been able to reproduce it in the Playground, unfortunately. The import fails both in localhost and owhen deployed to my server, so I guess the issue is on my part. I am using Babylon v7.24.0. What’s strange is that since then, I’ve split my babylon file into a glb (for the meshes), and a smaller babylon file (for the lights), and chrome is able to import that babylon file without any issue. So I don’t know where the issue comes from.

It might be odd to say but, sometimes, when things just don’t make sense it’s simply because… they don’t :sweat_smile: :joy: Have you tried renaming your file content or simply save again with a different name? For it could be just a corrupted file. It didn’t happen to me sometime. It eventually happens from time to time (and next thing that happens is you’re gonna spend ages trying to understand just why it doesn’t work :grimacing: :thinking:

1 Like

I’ve thought the same thing, but it didn’t work. I already tried renaming the file, reimporting it into the sandbox from 3Ds max, and reexporting it as a babylon file, it wasn’t enough.

And how does the network tab look like when ther babylon file is not downloaded? what HTTP error code do you get?

That’s the thing, I don’t get any http error code. The network tab says the model is loaded in memory, but passing it to the LoadAssetContainer() method throws the exception.

Okay, so I imported my babylon file into the sandbox, and gradually decimated as much geometry as possible before reexporting it as a babylon file. I don’t exactly know whether it is the file size or if a specific mesh/node in my model was corrupted or whatever, but the engine is now able to parse it in chrome. I guess it was the file size, my model is very large. I’ll refactor the model to reduce its size before resuming my tests. Thank you to everyone who helped me figured this one out.

2 Likes