-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically change hardware scaling based on browser zoom level #12711
Comments
We already have a mechanism to adjust according to the zoom ratio, it is simply turned off by default. it can be set when constructing an engine as the 4th variable ( The position in code - https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Engines/thinEngine.ts#L1731 . We are taking devicePixelRatio in account in different areas (mostly during construction). Maybe we should revisit how we handle this and what we want the defaults to be. |
Oh, and also wanted to state - this will only work if the developer registers the |
I think the resize is not trigger during the zoom change. Or is it? |
Checked, it does. |
Sorry! just making sure we are talking about the same thing :-) |
Zoom in and out here - https://playground.babylonjs.com/#7FBWRV , quality will stay the same. |
so we are good because then we have everything we need right @PatrickRyanMS ? |
I think the only thing we don't have and might be missing is a way to adjust this flag during a session. I don't see a reason why we don't expose the adjust ratio flag and let devs change it when needed (i.e. - why is it only in the constructor). |
no problem to change it |
@RaananW and I chatted and we think we need to add an additional parameter in the engine constructor for the maximum hardware scaling factor. We have a parameter for the minimum hardware scaling factor already with |
When the user sets the browser zoom to anything other than 100%, especially when larger than 100%, we can see artifacts in the render due to the canvas thinking it's a different size than it actually is. Zooming in causes the canvas to render at a lower resolution and shows pixelation of all elements. Any ADT will scale with the zoom level, but still renders at the lower resolution of the canvas. Here is a repro:
If we can detect the zoom level of the browser can we dynamically adjust hardware scaling on the scene so that the resolution of the canvas does not change even if the zoom level does?
The text was updated successfully, but these errors were encountered: