Babylonjs takes longer to render the first frame on mobile compared to Threejs

When I use Babylonjs to render a .glb file(which has about 60 materials), I found it get a bad performance to render the first frame in mobile mode(compared with threejs or playcanvas).
BTW: if i delete all materials of this .glb file, it performance as fast as threejs/laycanvas.
I would appreciate it if anyone have any suggestions!!
above is the performance snapshot
babylonjs snapshot:

threejs snapshot:

Your performance snapshot looks a lot like the one I reported in this issue: 1448494 - chromium - An open-source project to help move the web forward. - Monorail

It could be a problem with the compilation of the shaders on the driver side…

Would you happen to have a repro we could look into as well ?

Thanks for your reply :grinning:
I found that this maybe a bug caused by the engine’s not setting the engine.disableUniformBuffers property correctly in mobile mode.
When I visit my project in my browser in normal mode, after I create my engine,the engine.disableUniformBuffers is true,and it perform well.
But when I change my browser to mobile mode, the engine.disableUniformBuffers value become false,which cause a bad performance :frowning_face:.

And I think this is similar to this bug:
(Related Commit)

And my solution is change this value to true manully after I create my engine.(now it performace well!!!)

@sebavan @Evgeni_Popov

We look for “Mac OS.+Chrome” in the user-agent to disable ubo support. It would seem that when you switch to mobile mode (what does that mean?) the user-agent does not match this string…

Can you report what you get when you type navigator.userAgent in the browser console?

1 Like

Here are the results of navigator.userAgent:

noraml mode => ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36’

mobile mode => ‘Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1’

sorry for my poor english: ‘mobile mode’ means I turn on this button in the chorme’s dev tools;

Thanks for the clarification (no need to apologize, I think “mobile mode” is quite appropriate for this button, it’s just that I’m not used to it!).

As this is an emulation mode, I don’t think it can be trusted: it says “Safari” in the user-agent, whereas you’re testing with Chrome. We would need to know whether you’re still experiencing the same problem with a real device(?)

The slow UBO issue has been proven to be only an issue on Chrome MAC so the Mobile mode emulation does not reflect real world usage at all here even more cause your simulating an android device.

I ll be happy to dig in if you repro in a real device as we can not bypass the mozilla… user agent without risking to be counter productive on the real devices.