godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.48k stars 21.26k forks source link

Resolution issue with dual monitors with different DPI #84948

Open Jules5 opened 1 year ago

Jules5 commented 1 year ago

Godot version

4.1.2.stable

System information

Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1060 with Max-Q Design

Issue description

I have two screens:

I work on a 2D pixel perfect game. When I display it fullscreen on my laptop everything is nice and sharp, but not on the external screen where I have scaling issues (the pixel art is altered). I logged the screen resolution according to Godot and I got this:

I tried to disable the "allow_hidpi" settings, then I got this:

Finally I put back the "allow_hidpi" settings and disabled the 125% scaling in windows settings:

As I understand these results I'd say that Godot is handling well the Windows scaling through the "allow_hidpi" setting, but is failign to handle correctly the case where the two screens have a different scaling value in the Windows settings. I expected Godot to use a 1920x1080 resolution for the two screens in this case.

Steps to reproduce

Minimal reproduction project

minimal_reproduction_project.zip

Calinou commented 1 year ago

Godot doesn't use the Windows per-monitor DPI awareness API yet, as per https://github.com/godotengine/godot/issues/56341. This limits its ability to scale to multi-monitor setups with different scale factors.

Please upload a minimal reproduction project[^1] to make this easier to troubleshoot.

Which stretch mode does the project use? I suggest using 4.2.beta5 and setting the scale stretch policy in the project settings to Integer (this is a new setting in 4.2.beta). This ensures the viewport is always scaled at an integer scale.

[^1]: A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the .godot folder in the archive (but keep project.godot).

Drag and drop a ZIP archive to upload it. Do not select another field until the project is done uploading.

Note for C# users: If your issue is not Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available.

Jules5 commented 1 year ago

Minimal reproduction project uploaded!

Which stretch mode does the project use?

I'm using the "canvas_item" mode.

I suggest using 4.2.beta5 and setting the scale stretch policy in the project settings to Integer (this is a new setting in 4.2.beta). This ensures the viewport is always scaled at an integer scale.

I just checked with 4.2.beta5, it's worth mentionning that with this version the issue occurs on my internal monitor (while it was on the external one with 4.1.2). Nonetheless with the integer scaling option it's better, but the viewport cover only a fraction of the display (since a wrong screen resolution is used).