Automatically set an Appropriate Resolution

Hello There,

Is there any good method to get an appropriate resolution? (not too blurry to too slow…)

I can see that the resolution varies quite a lot from device to device, and also depending on where I have deployed the code (e.g. high resolution on localhost, but low when running it on the server)

I know that I could set AdaptToDeviceRatio to true (BABYLON.Engine(canvas, antialiasing, null, true)) but this would slow down the app too much on some devices.

A thought I have is to automatically detect the fps and adjust engine.setHardwareScalingLevel( ) untill an appropriate fps has been reached.

Is there a better method?

Best Regards,
Erik

Hello and welcome!
we do have this tool for you :slight_smile: :Use SceneOptimizer - Babylon.js Documentation

Amazing, thank you!

I’m still having a problem that it refuses to work as soon as I create a ParticleSystem.
For: Babylon.js Playground
if I remove the line: var crash = new BABYLON.ParticleSystem(“particles”, 1000, scene);
it works.

Please, if anybody knows what I’m doing worng, let me know?

the sceneOptimizer will wait for the scene to be ready and if you only add a particle system without setting it up it will block the optimizer by flagging the scene as not ready

Thank you!

I was preparing some particle systems w/o assigning an emitter to them…
In case it could be helpful to someone else, seems like I always have to set up the texture and the emitter before sceneOptimizer starts:

particleSystem.particleTexture = new BABYLON.Texture(“textures/flare.png”, scene);
particleSystem.emitter = sphere;

https://www.babylonjs-playground.com/#YKKTVU

1 Like