godotengine / godot

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

Garbled text rendering in editor with GL Compatibility renderer #68814

Open 0xafbf opened 2 years ago

0xafbf commented 2 years ago

Godot version

v4.0.beta5.official [89a33d28f]

System information

Windows 10, OpenGL Renderer: NVIDIA GeForce RTX 3060

Issue description

Text shows as garbled and unreadable under certain conditions. I suspect the issue is related to DPI scaling, as the problem only happens on my work computer with two screens: one at 1080p 100% scaling and the other is a 2160p screen with 150% scaling.

I wasn't able to replicate this in other computers with Windows 10, 100% DPI scaling and Windows 11, also 100% DPI scaling.

image image

Using different font rendering options in the editor preferences didn't improve the situation.

I bisected the git history and seems like this commit introduced this problem: cd25e48456e58704f1450954a0c94b1e7fe079f4 PR #67562

here is a comparison of both project launchers side by side, one before and the other after the commit mentioned above image

Steps to reproduce

Open the Godot editor. You can easily see the problem from the project launcher. Alternatively you can open any script and the issue is easy to notice there too.

Minimal reproduction project

N/A

clayjohn commented 2 years ago

Cc @bruvzg

Dunkhan commented 1 year ago

Linux Mint 20.3 Cinnamon

I have this in the player too, since beta4 I have two monitors, each with a different resolution, but I do not use scaling.

Calinou commented 1 year ago

I can't reproduce this on 4.0.beta 49cc12bf8 (Linux, AMD Radeon RX 6900 XT). I've tested the editor scales 75%, 100%, 125%, 150%, 175% and 200%. I'm using a single 4K monitor at 100% DPI scaling.

@Dunkhan Which graphics card model and driver version are you using?

tom-jk commented 1 year ago

Linux Mint 20 Cinnamon, RTX 2060 SUPER one monitor 1440x900, no scaling

I have this too. Latest I've tested in is beta4 where this happens; it does not happen in beta3.

Not sure I remember the details exactly, but a little while ago (around time of beta1) I wanted thicker scrollbars in the editor so I made a new theme from the current editor one with that change and set it as the editor theme. When I later saw the garbled text, I removed that custom theme and the problem went away; put it back, it came back.

so @0xafbf, @Dunkhan, are you using a custom editor theme carried over from older versions, or doing some other thing with fonts or theming in the editor?

0xafbf commented 1 year ago

Hey @tom-jk , You're right, I was using a custom editor theme, I did it to reduce the space between nodes in the node hierarchy. Once I reset it to the default, the editor renders correctly.

In that case, I guess this issue is no longer valid? It is not an issue for me anymore.

Dunkhan commented 1 year ago

Which graphics card model and driver version are you using?

NVIDIA Corporation TU106 [GeForce RTX 2070] - version 515.76

are you using a custom editor theme carried over from older versions, or doing some other thing with fonts or theming in the editor?

Yes. I am getting the issue in the player, and I am using a custom theme carried over from older versions in my project.

If this is the issue, my theme is just the default theme exported and tweaked a little, so I can conceivably delete it and make it again, but a lot of people will have themes they care about and spent a lot of time on.

If you want to to view the issue in my project you can get it here https://gitlab.com/gametheatre/poriferareader/Porifera/-/tree/ThemeSwitch Don't use the main branch that is not converted to the beta, any of the other branches should be fine though.

To see broken text you might have to paste an rss feed link into the top text bar

Dunkhan commented 1 year ago

Just a note, I often have strange issues due to my monitor setup, most notably in games. The reason is that my smaller monitor is the one that the hardware recognises as the primary monitor. There is a hardware level and an OS level primary monitor, the hardware one is based simply on which socket in the graphics card the monitor is attached to. On the OS level the primary monitor can be set (on some systems) so the two primary monitor variables might not be set to the same monitor.

Programmers often assume the primary monitor is the largest monitor. One especially common example is setting the maximum displayable resolution based on the primary monitor's maximum. They also sometimes query the graphics card as to which monitor is primary, then send commands to the OS primary monitor assuming it is the same. Dpi scaling is a whole other layer of complexity on top of this.

I hope this might offer some insight into potential causes for this issue. I think the whole concept of a primary monitor is a mistake but we can't change that here so we have to work around it.

bruvzg commented 1 year ago

I was not able to reproduce it on any platform.

You're right, I was using a custom editor theme, I did it to reduce the space between nodes in the node hierarchy. Once I reset it to the default, the editor renders correctly.

https://github.com/godotengine/godot/pull/67562 makes existing imported fonts with pre-rendered glyphs (*.fontdata) incompatible, and a custom theme might include imported fonts with the glyphs that were in use at the time.

I have this in the player too, since beta4 I have two monitors, each with a different resolution, but I do not use scaling.

It's unlikely it is directly connected to monitor setup or DPI in any way.

Try deleting .godot/impored subfolder of the project and re-importing fonts. If you are using Theme that was created from an editor theme, or include fonts that were loaded and used at the creation time, you might need to unset/reset fonts in it as well.

rcjsuen commented 1 year ago

I am starting to see this as well. I'm on macOS 12.6.1 with "AMD Radeon Pro 5300M 4 GB" and "Intel UHD Graphics 630 1536 MB" according to "About This Mac".

image

I've used Godot 4 beta 8, 9, 10, and 11 without such problems. Just started using beta 16 for a few hours and have encountered this problem already. 🤔

Calinou commented 1 year ago

@rcjsuen Which rendering method are you using? (You can see it in the top-right corner of the editor.) Try switching rendering methods and see if the issue persists.

rcjsuen commented 1 year ago

@rcjsuen Which rendering method are you using? (You can see it in the top-right corner of the editor.) Try switching rendering methods and see if the issue persists.

I was in Compatibility. If it happens again I will try changing it. Thanks for the tip.

clayjohn commented 1 year ago

Can you test again? This may have been fixed

rcjsuen commented 1 year ago

Can you test again? This may have been fixed

I have updated to Godot 4 beta 17 as of today. If it happens again I will post back.

kiraio-moe commented 1 year ago

Facing this issue today. All text are garbled and can't proceed to the editor. This will go forever until my RAM are all eaten up and forced to restart my PC.

It's happened after playing with some editor settings.

godot-err-1

godot-err-2

kiraio-moe commented 1 year ago

Setting enable_psuedolocalization to false at C:\Users\{username}\AppData\Roaming\Godot did fix my problem. What's going on?

Calinou commented 1 year ago

Setting enable_psuedolocalization to false at C:\Users\{username}\AppData\Roaming\Godot did fix my problem. What's going on?

As mentioned in its description when you hover the setting, this is a debugging setting that you should only enable if you're working on the editor itself, or creating editor plugins.

We should probably disable it from non-dev editor builds, but at the same time, this will prevent plugin authors from using it.