-
-
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
Distance field fonts are blurry #8022
Comments
Seems to affect just distance field fonts, by the way. |
I've had the same problem. I've looked through the code and although I'm not a programming expert at all, I found this piece of code that can only be found in the label.cpp. This is probably why it doesn't render correctly. Edit: I meant by that why it doesn't render correctly for the rest of the text based nodes |
Well, maybe it's why only the label renders correctly, in fact^^ |
First of all thank you for your report and sorry for the delay. We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to. We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us. For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors. Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed. Thanks in advance. Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it. |
Is there a way to create distance field fonts? It do not seem possible on godot 3. |
Just try to import the same font as in the example project? |
No, that font is not recognized as a resource. |
Argh I need to find the original, I believe that one was imported with 2.x |
@Zylann how do you managed to import it? (and as .tres) |
@eon-s the original is a TTF, I created a DynamicFont from it. I'm not sure why distance field was a thing in the first place in this issue (the FNT file was a result of Godot 2 import). |
Oh, I was able to replicate only with that font, I will see if I can get one and try again later |
This issue is not solved, still valid for distance field fonts, Example using the font on the SDF demo. |
Distance field fonts have not really been properly re-added yet, so this gets kicked to 3.2 |
Bumped again into this after upgrading my game from Godot 2 (where it worked) to Godot 3.0.6 (no longer works), still with the same font. If having to wait for 3.2, that means... quite a long time, since it's the version we plan to have Vulkan in^^" I'd expect such a fix to be in a 3.1 maintainance release instead. Meanwhile... no pixel fonts... |
Still valid in 3.2.3 |
This is fixed by the new MSDF font rendering implementation in |
@filipworksdev Can you make a PR? |
Hi @Zireael07 I can try but can't guarantee I'll be approved. Is only implemented for some controls. I skipped all the advanced stuff because I don't think they were meant to work with bitmap fonts like a TextEditor for ex. Works in game though for the specific implement controls. The main issue is I could not make it work for the new Theme Editor Plugin preview. It only works when you do a popup but not in the actual theme. The new Theme Editor needs more work from someone that knows it better . I tried but couldn't figure it out. |
I can't guarantee it will be approved either, but as it is a bugfix chances are it will and/or someone will take a look at the other places that need the fix, like the Theme Editor you mentioned, |
@filipworksdev If you don't have time to finish this work, could you push your work to a branch so others can improve it and open a pull request based on it? Thanks in advance 🙂 |
@Calinou Sorry! I did push it to a branch but is using my custom build of Godot for educational purpose where I am doing more core changes and more basic work to learn C++. This is the commit with all the changes. Is compatible with 3.x branch goblinengine/goblin@66c4f2f It works but has a number of issues which need to be addressed: It causes some blurry effects on some controls . The signed field was not ported correctly and then for years the controls were modified without signed field in mind so now adding these back I realize the style rects are drawn in a way that conflicts with how signed field work. I have also adjusted signed field shader to be slightly less sharp to avoid it looking blurry when zoomed all the way out or on lower rez (retro-style) viewports. Signed field needs to be manually flagged for each control font in order to make it work . In Godot 2 only label used this while all other controls would automatically turn on Signed Field when the font was marked as such and this happened when Canvas item was rendered. Now because of batching that way of rendering cannot happen and cannot individually turn on/off signed field shader for those specific fonts. Each control would have to use something like this My code will not work inside theme preview either. I wasn't able to figure out how to make it with the newly reworked theme preview. It just looks blurry. I think is because the theme preview panel uses custom rendering and doesn't enable signed distance fields on any of the fonts. Also signed filed is not enabled for more complex controls like for example TextEditor. It doesn't seem like it was designed with simple fonts in mind. So I got a bit ahead of myself. After further testing works well but not perfectly 😄 |
I ported filipworksdev's changes above to a branch based on Right now, it's working correctly, but only when batching is disabled. I changed the rendering formula in the shader to further improve the sharpness/antialiasing quality balance as well. Improvements to rendering quality could be made by adjusting SDF smoothing depending on font size (relative to screen size) or performing supersampling. However, the Testing project: https://0x0.st/oaBt.zip (link expires in April 2023) 1024×6002560×1440 |
It would be great if this could land on 3.5, even as experimental because is a huge improvement. |
Thanks @Calinou ! Looks great. Sorry it says Ghost above I'm still here I had some issues with my old account so I ported everything to a new account same usename and same repots. Still here :) Did you manage to fix the theme preview and I think there are also batching issues. |
Thanks! |
Fixed by #86786. |
Tested on Godot 2.1.2
Windows 10 64 bits
I created a theme with a custom font, and it looks fine with Labels. However, every other control gets blurry text instead. I expected the same result as the label, because I see the text appears to be the same size.
ItemListFontBlurry.zip
Related QA thread I investigated from: https://godotengine.org/qa/13127/itemlist-font-is-scaled-and-blurry
The text was updated successfully, but these errors were encountered: