godotengine / godot

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

DynamicFont should enable filter by default #30643

Closed TheDuriel closed 3 years ago

TheDuriel commented 5 years ago

Godot version:

3.1

Issue description:

Currently the filter and mipmap properties default to false. This means that it is very easy to run into a situation where font quality is negatively affected. (For example when the viewport resolution, and the window resolution do not match. Aka. any debug environment.)

Imho filtering should default to being on. It simply looks better in all cases.

Calinou commented 5 years ago

Filter isn't enabled by default because it sometimes causes the font to become blurry, even if you aren't zooming in at all. Therefore, it should be enabled only when you expect the font size to change at run-time (e.g. when a Control is scaled during an animation).

IAmActuallyCthulhu commented 5 years ago

@Calinou By that logic should images import not have filter ON by default?

Addition (Edit): If you are not rendering the font at the exact size you set it too it will do this. This is especially a problem with rending in window mode.

Calinou commented 5 years ago

@IAmActuallyCthulhu I think this is a different situation, as images are often expected to be scaled at run-time. By contrast, this is usually not the case for fonts. If you use the 2d stretch mode, Godot will automatically oversample DynamicFonts by default, which means they will still be rendered at a pixel-perfect scale, just rendered at an higher resolution to match the display size.

TheDuriel commented 5 years ago

If you use the 2d stretch mode, Godot will automatically oversample DynamicFonts by default

Filtering off: image

viewport 1080p, window 900p, stretch 2D, aspect expand

Filtering on: image viewport 1080p, window 900p, stretch 2D, aspect expand

Look at "modding support" in the first sentence.

Calinou commented 5 years ago

@TheDuriel Double-check that Rendering > Quality > Dynamic Fonts > Use Oversampling is enabled in the Project Settings – it should be enabled by default since 3.1. Also, note that it will only work within the default viewport; it won't work with custom viewports.

The oversampling factor is currently computed automatically and there's no way to override it. I suppose it would make sense to make it adjustable manually, so that it can still be used when using a custom viewport with custom stretch logic.

TheDuriel commented 5 years ago

image

Default viewport.

Funnily enough, with it disabled and having filtering off as well, it is almost ok. Still terrible, but at least the letters line up. image

Basically, supersampling only works correctly with font filtering on.

girng commented 5 years ago

wats up with that font @TheDuriel lol

TheDuriel commented 5 years ago

Happens to be inconsolata. Meant to look like this. Hence the thread. image

girng commented 5 years ago

something ain't right, even if filter is enabled it looks way out of character (pun intended)

something else is going on here i think

Calinou commented 3 years ago

Fonts are now filtered by default in the master branch as part of the Vulkan renderer rewrite, closing. (This will also apply to the OpenGL renderer once it's implemented.)