Mobile browsers crashing (across several different phones)


I have created a scene with a few custom mesh objects. My scene with custom meshes reloads and crashes when I open the application on my phone browsers (chrome, safari, brave). My scene loads my 3d objects one at a time. My scene utilizes Assets Manager, my objects are added as tasks to Assets Manager, and Assets Manager loads after each object is added as a task. For my iPhone 8, the crash happens when I load my 3rd object. For my iPhone 12, the crash happens with I load my 5th object. My desktop have no problems loading all my objects one after another.

I believe I have narrowed down the problem to the rendering of the objects after the load. I created a simple scene utilizing one Assets Manager load function execution. My scene crashes on iPhone 8 browsers when I call Assets Manager to load 3 tasks. My scene crashes on iPhone 12 browsers when I call Assets Manager to load 5 tasks. The browser window reloads and/or crashes after those objects are added to the scene. My scene will some times load all the objects, but crashes on interaction.

At first, I suspected that it had to do with the size of the objects and created a scene to load small babylon mesh objects. My scene was able to handle the loading of the small babylon mesh objects and not crash on my iPhone 8. I replaced the small babylon mesh objects with much large babylon assets in my scene and was able to load the scene with the large babylon assets(total size of large babylon assets 2x the total of my custom mesh objects). I was able to interact with the scene with large babylon assets. This led me to believe that it is not precisely a size different issue.

I also tried a few optimization techniques from Optimizing Your Scene | Babylon.js Documentation. I implemented scene.freezeActiveMeshes() and mesh.freezeWorldMatrix() on my objects after the loading. I also assigned scene.autoClear = false and scene.autoClearDepthAndStencil = false. This was not effective in preventing the crash on my iPhone 8.

I was able to load on my iPhone 8, but cannot load my scene with my custom mesh objects.

May I have some help identifying what issues the mobile browsers may have with our scene?

warm Regards,

James Wu

1 Like

This seems really hard to troubleshoot without a repro.

It would be great if you could find a playground that reproes the crash. I am guessing it could be large texture more than 2k * 2k or relying on some features Safari is having trouble with (and there are a lot in Safari 15…)

Thank you very much for your prompt response. My iphone 8 crashes with this playground. I managed to crash an iphone 12 with this playground

My scene with custom assets is failing across all mobile with browsers safari, chrome, and brave. I think they are all related.

Thanks for the repro @Cedric can you have a look ?

Tested ok on my iphone11. latest ios with safari. Is there anything special to do? I kept it running for some minutes. Nothing relevant in the console.

@Cedric apologies, can you check scene This crashes my iphone 12. I paste the wrong background earlier. Thank you for the prompt review.

yes, I get the crash. what’s the difference with #18 ?

#18 loads 5-6 solar systems & #19 loads 8-9 solar systems.

i loaded the scene on desktop , in the inspector i see 249 textures. I wonder if this is part of the issue. Babylon does not automatically keep single instances of materials with same names. I found this out the hard way and actually wrote some code while loading assets to facilitate having only one instance of a material in the scene. So if an asset loads and it has materials with same names as materials already in the scene , i assign those materials to it and dispose the loaded ones. There is a post with the code here in the forums , worth a shot?

Thank you very much for your reply. I think the amount of textures and materials have something to do with the crash as well. Would you mind sharing that forum post with me?

I cant say it will help but maybe :wink:

thank you very much for your help! I will try and give it a go.

To be honest if your goal is to load the same model over and over, why not relying on clone or instances instead ?

@sebavan My goal is not to load the same model over and over again. I was trying to create a playground that would mimic my scene crash. My scene has multiple mesh objects and loads all of them eventually. I do have a high amount of textures and materials, which may be causing the mobile crash.

Yup I think you are just reaching the devices mas capabilities in some ways :slight_smile:

@sebavan I think so too. I was trying to see which factors caused the limitations and reduce the consumption of those factors.

Textures might be the biggest factor at play here, and you could also try to sequentially load models vs in parallel ?

@sebavan Original, I load the models in a queue format with Assets Manager in my current scene. I get the crash loading after loading the 3rd model into the scene on my iphone 8 and the crash occurs on the 5th model load on an iphone 12. I think this narrows it down to textures. Thank you very much for your help and guidance.

@shaderbytes, thank you for your kind link!

1 Like

Texture is the biggest factor causing phone browser crashing. I also met this condition and now tring to solve it. When I load several assets (.babylon files), my iphone 12 would crash. But if I delete the related textures, it works smoothly.

And now my goal is to load textures manually after meshes are loaded. if there are some ways to control texture loading when we apply BABYLON.SceneLoader.Append or BABYLON.AssetsManager, this problem would be solved. @sebavan @jamesgjwu

@sevenPlus Thank you for your response. I might give that a try later on.