Engine registerView problem

Hello everyone, as shown in the example, when the fourth parameter ofnew BABYLON.Engine is set to true(adaptToDeviceRatio = true), the newly register view will change, the ball is no longer in the center,
Is this a bug?
If it’s not how can I make two canvas same?

edit: Also, If I set the scene clearColor transparent, the view has another problem(also shown in example)

Thank you for reading!

Maybe @Evgeni_Popov can help with this one ?

1 Like

I don’t reproduce the size problem in the code pen: are you able to make a repro in the Playground?

I tried myself:

https://playground.babylonjs.com/#NENG7K#4

It creates a view on the right and the main canvas used by the engine is made invisible so that it does not interfere with the view rendering.

I have a set a blue background color on the view canvas and set a transparent color for the scene: as you can see it does work as we can see the blue of the background. However, you need to pass true as the 3rd parameter of registerView for a transparent color to work.

Also, setting adaptToDeviceRatio=true at engine creation is the same thing as changing the hardware scaling level: in this PG I change this value and it does work as expected.

Note that you must use Babylon.js 5.0 for this to work as there were some bugs in 4.2 related to views/hardware scaling level/transparent colors.

3 Likes

Thank you so much
These problems had bothered me for a few days, turns out it’s just that I’m using the wrong version
5.0.0 alpha.60 is perfect and solved all the issues
Thank you guys again!

1 Like