[WebXR] BABYLON GUI Button doesnt work in ar-session if HardwareScalingLevel is changed

When I change the engine hardware scaling level, I can no longer interact with the GUI elements within a WebXR ar-session. This can be tested in the below playground by un/commenting the engine.setHardwareScalingLevel(2);

Playground: https://playground.babylonjs.com/#F41V6N#155

If anyone has any suggestions on how I could get around this issue then please let me know!

Adding @RaananW about the XR as he is our own XR king :slight_smile:

Hardware scale works on the original canvas, but WebXR uses a different one. If you want to keep the hardware scaling (which i would suggest against, due to the way XR works), you can pass the value to XR to let the renderer know that you want hardware scaling in XR as well.

To do that pass framebufferScaleFactor when generating the XR experience helper, for example like this:

Babylon.js Playground

If I may ask - Why do you want to change the hardware scaling in AR mode? the camera input won’t change anyhow.

Hi RaananW,

Thanks for the explanation, I have a better understanding now.

I didn’t necessarily want hardware scaling in the AR mode, I was using the optimizer to improve the app’s performance for the user when they are not using the AR mode. Then I noticed the issue where some devices couldn’t use the GUI elements in the AR mode and I saw that hardware scaling was causing this.

I now have it to reset the hardware scaling when the AR mode is active and that pretty much solves the issue.

Thanks again for helping me out!

1 Like