-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Allow Hidpi leads to wrong window scale #42085
Comments
Can you reproduce this in older 3.2.3 RCs and betas? You can download them here. |
Just checked RC1. The issue was in that one already. |
@okapii Thanks! If you can build Godot from source, can you bisect the regression? For the bisection, the "good" commit to use is I don't have a macOS machine with an hiDPI display to test here. |
Sorry, not really equipped with infrastructure / knowledge on how to do that … :( |
I just updated to the new Godot 3.2.3 and the issue exists in that one, too. |
Hi there! I ran into this issue as well after updating a basic project to 3.2.3 and bisected the two commits above. I believe I've found the specific change:
Specific commit: e9ab41b While I am new to the codebase, I would suspect the code change in (Aside: It does appear to properly fix window position centering on a dual monitor setup when starting up the game compared to 3.2.2 which is great!) |
cc @bruvzg |
What's "wrong window scale"? When hiDPI is enabled real screen resolution is used and the window with the same pixel size will appear smaller, it's done for handling multiple displays with different DPI. Before #40201 scaled resolution was used for both hiDPI and loDPI and multi monitor setups were completely unusable. For example if you have 1024x768 window in loDPI mode, Godot will create and render 1024x768 window and OS will upscale it to double size on retina screen and keep as is on normal screen. |
Hey @bruvzg, thanks for the response. The sizing behavior seems to be much improved! Hoping to check my understanding now the behavior has changed a bit. Are the following statements correct?
The only thing I'm worried about this change is that I'd like to use `Allow HiDPI = true" (for better font oversampling/rasterization) yet have a predictable window size. That seems impossible to do as we can't assume the device density (could be 1x, 2x, 3x, etc) but Test Width and Test Height are interpreted in pixels (effectively baking in a single density assumption). If my understanding is correct, could I suggest the following?
My feeling is that this would be more intuitive as it more closely matches how macOS handles window units. It seems it would make it easier for developers to setup the same window sizing across monitors in hiDPI mode too, without resorting to scripting. I am new to this and there may be other solutions or thinking I'm unaware of—so forgive me if this suggestion seems like a bad idea. Thanks so much for your thoughts! (aside, wanted to share the current behavior for reference) Example of behavior in 3.2.3 for referenceScreenshots of a game with a native size of 480x270 on a HiDPI screen. |
Godot do not have any dynamic UI scaling support (#21446) and all window management is designed to use pixels, so it's always using pixels, we can't use points unless DPI independent rendering is implemented in the renderer. Current solution was done to make editor usable on dual hiDPI + loDPI monitor setup (which is probably the most common mac setup, retina MacBook + external display). I agree, this approach is not most intuitive for macOS users, but it's consistent with other OSes. Using points is the best solution, but it will require much bigger changes to the renderer to make everything function properly (and outside of mine expertise). |
As far as I know, loDPI fallbacks on Linux are only available in some Wayland-based desktop environments, not X11. This is because X11 is too limited to provide proper mouse input for windows scaled by the display server. |
For what it's worth, I like the current behavior in 3.2.3, i.e. turning on HiDPI causes the window to be smaller, since it's displaying the true size in pixels. This allows me the design a UI with hiDPI that looks identical, albeit smaller, to its non-hiDPI counterpart until I maximize it or go full screen. What the OP is asking actually makes sense and is more in line with Apple's Retina screen guidelines (I think), but I find less practical. Maybe both can be an option? Now if Godot's controls had automatic dynamic resizing that preserved the apparent size of everything when changing pixel density, then yes, I think it would make a lot more sense to preserve the dimensions in relation to the monitor size, not in pixels, but with higher/lower pixel count. Is there a request for that already? |
@DoctorWhoof We would really prefer to encourage best practices out of the box. Supporting hiDPI displays correctly is a best practice 🙂 Gotta get those WSGF labels somehow…
This already exists in the form of the |
That works well for games, not for applications, which is what I'm focusing on now. For instance, when using 2D stretch mode all text is resized when resizing the window, which is not what you want in an application. Just resize Godot itself to see what I mean. I feel that to satisfy the original request with Godot applications, Godot's Controls would need to behave in a resolution independent way - i.e. not use pixels as the unit, so that layout can be preserved while increasing pixel density. The effect can actually be achieved via code (I have it working, including resizing the UI on the fly with "zoom" controls), but implementing it is a pain, especially if you didn't start the project like that from the get go.
I strongly feel that to support HiDPI switching correctly with applications Godot would need resolution independent controls for GUIs, which is probably a full redesign not in the horizon (unless I'm mistaken!). In the absence of that, the way it handles hiDPI switching now is Ok for applications (layout is preserved, despite the size change), bad for games (window size relative to display size changes, as described in the original request). Thanks! |
@DoctorWhoof As I said, we need to expose a way to manually change the scale factor independently of the window size. This is what #21446 provides. The editor is already designed in DPI-indepedent pixels for the most part, although it's a manual process – all values have to be multiplied by the |
Yes @Calinou! Sorry I missed that point, I believe proper hiDPI (like the original request) + a global scale factor like that would work for applications. Thanks! |
Has there been made any progress regarding this issue? I am pretty much stuck on 3.2.2 for utilising 2D-nodes in my 3D game for the GUI which are all displayed substantially too small in newer versions because of how things are handled now. |
Use the For games, the You can check the godot-demo-projects repository for examples of projects that scale correctly to multiple resolutions and aspect ratios. (Not all demos are suitable for this, but most demos should be.) |
@Calinou Thanks for the feedback! Gonna give that a try! |
As I understand it things are working as intended, but it's maybe not the most self explanatory behavior? Does it behave the same on macOS and on other OSes? Should we just document this better? |
hi everyone :) issue confirmed with v3.5.1.stable.official [6fed1ff]. @akien-mga, imho there are multiple aspects which need to be considered. what is allow hidpi currently doing? what are gui applications? how should gui applications behave regarding scaling? what is the behavior with default settings? gui application: allow hidpi + fix scaling? I also ran into that issue while doing an unrelated fix for a godot demo but I couldn't get a good answer to that problem yet: godotengine/godot-demo-projects#791 my conclusion is that currently "allow hidpi" is broken for gui applications. in fact that is also what the guide "multiple resolutions" is stating: https://docs.godotengine.org/en/stable/tutorials/rendering/multiple_resolutions.html imho a fix might be worth here. maybe implementing dynamic scaling like the godot editor does. another source: this person on q&a also explains the issue very well but the given answer doesn't fix the issues I mentioned here: |
still a problem in godot 4 |
Godot version:
3.2.3 RC 6 Official, MacOS
OS/device including version:
Issue description:
Checking "Allow Hidpi" in the project settings (Display > Window > Dpi) scales down the window size to half (?) its intended size.
It happens with newly created vanilla 3D-projects, too. So this seems not to be about some other conflicting setting.
This appears to be a regression as the current stable build does not have this problem. It has been around for a number of release candidates already.
Steps to reproduce:
Check "Allow Hidpi" in project settings (Display > Window > Dpi).
Minimal reproduction project:
Happy to provide the fresh test-project I just created but since this is a one click operation for a newly created project, I refrained from uploading anything at this point for now.
The text was updated successfully, but these errors were encountered: