-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Font oversampling doesn't work with custom viewports #28045
Comments
Font oversampling is currently a global property that scales all DynamicFonts with the same factor, so maybe we need the ability to selectively disable it for specific DynamicFont resources. A workaround I can think of is resizing the Viewport and scaling the Label depending on the resolution, so that it becomes larger on larger resolutions (and won't be blurry since the font size will match the label size more or less). |
Font oversampling is a global setting, so it will not work on custom viewports. |
Why would it be a solution to have a toggle for disabling font oversampling on individual fonts when it already doesn't work? My problem is that I'd like to alpha mask a VBoxContainer with all of its Label children. My current solution would be to place the container inside a Viewport, but the fonts will be pixelated when I do this. Calinous solution is only a bandaid fix and doesn't look good on most resolutions. |
Last time I checked, you can enable filtering on a ViewportTexture that's applied to a Sprite or TextureRect by editing it then enabling the Filter flag. |
@TheMoye Font oversampling doesn't make sense if you use the |
Hi @Calinou , Okay, I can understand that. But why is Godot giving me this Warning? Especially since I don't use any font. My scene tree doesn't contain any character nodes (label, richtextlabel...) 🤷♂️ |
@TheMoye Disable Rendering > Quality > Dynamic Fonts > Use Oversampling in the Project Settings. |
I'm having the same problem. I need to draw some texts inside a Viewport. I have "Use Oversampling" enable, and I use First image is from Viewport, and the second one is outside the Viewport (it is using the same DynamicFont) Project: I already test every option in the Viewport, and I searched and tried a lot, haha. |
Ok, I found a solution for this problem. When the game resizes I resize the custom viewport to fit it parent from GDScript, and I put a Camera2D in the custom viewport to zoom in to get the same proportion. Here is the script (to keep_height), you can change how the zoom is calculated keep or keep_width.
Result: Example project: With this, I have had some problems with TileMaps in some resolutions (black lines between tiles), but I limited the resolutions and it's working well. |
Perhaps the error message should instead say to disable font oversampling if you are using Viewport stretch mode. It's not obvious that font oversampling is a project setting. |
@bmolyneaux This is already the case in the latest godot/scene/main/scene_tree.cpp Line 1156 in 398a625
godot/scene/main/scene_tree.cpp Line 1239 in 398a625
|
This is now addressed in two ways:
|
@kuruk-mm Can I also make the Camera2D as a child of the Viewport and all the labels, containers, maptiles, tiles etc. as childs of the Camera or can/should I make all the Nodes(Lables,Containers, Maptiles, etc.) childs of the Viewport and the Camera also as child of the Viewport as you did in your code? |
Godot version:
3.1 Stable
OS/device including version:
Windows 7
Issue description:
Controls with text won't benefit from font oversampling when placed inside a Viewport and a Viewportcontainer.
Steps to reproduce:
Create a DynamicFont and assign it to a Label. Put the Label inside a Viewport and put the Viewport inside a Viewportcontainer. Enable Font Oversampling in the project settings and set the stretch mode to 2D and aspect to keep. The Label will get blurred upon resizing the window when running the project.
Filter and mipmaps in the DynamicFont doesn't resolve it either.
Minimal reproduction project:
viewport_oversampling_mrp.zip
The text was updated successfully, but these errors were encountered: