setHardwareScalingLevel() option doesn’t do anything if engine has been initialized with
adaptToDeviceRatio = true option.
I can’t create a Playground test case because I’m not sure how to alter the engine initialization options there.
The issue happens because the engine
resize() function replaces
_hardwareScalingLevel with devicePixelRatio on this line: Babylon.js/thinEngine.ts at 5406aca3f55afdda974600032c21af71aae4190a · BabylonJS/Babylon.js · GitHub
It should rather add a multiplier that is applied on top of the user defined hardwareScalingLevel.
Also, it would be good if it was possible to change adaptToDeviceRatio value afterwards. This would allow for example measuring performance with adaptToDeviceRatio = true and then disable it if frame times are unnecessarily long and ratio is high enough to make a difference.
Although I know that as a workaround I can just manipulate the hardwareScalingLevel manually with
devicePixelRatio factor in mind and keep
This is actually by design, you are either in a manual mode or an automated one. we could disable automatic mode when setting manually a value but I wonder how much of a breaking change it could be @Deltakosh ?
Alternative would be to just make it clearer in
setHardwareScalingLevel documentation that it only works if engine was initialized without
adaptToDeviceRatio. That could save the next person some debug time trying to figure out why it doesn’t work.
Personally I just assumed that
adaptToDeviceRatio defines if rendering happens at native resolution or at possibly lower “DPI base resolution” (which is pretty much what the setting does). But I incorrectly thought that hardware scaling level would be a separate factor on top of that to adjust the resolution.
Yeah I would recommend a better documentation than a code change
Actually it is a regression from Updated ThinEngine resize to optionally take device pixel ratio into … · BabylonJS/Babylon.js@04383a2 · GitHub cause we should be able to change it for the perf optimizer for instance… I ll handle it in another PR
Hi @sebavan just checking in if this was merged