Skip to content

Add MSDF and mipmap generation project settings for the default font - #60513

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
Calinou:default-font-add-msdf-mipmap
Apr 26, 2022
Merged

Add MSDF and mipmap generation project settings for the default font#60513
akien-mga merged 1 commit into
godotengine:masterfrom
Calinou:default-font-add-msdf-mipmap

Conversation

@Calinou

@Calinou Calinou commented Apr 25, 2022

Copy link
Copy Markdown
Member

This can be used to improve Label3D and scaled Control appearance in prototypes.

This can be used to improve Label3D and scaled Control appearance
in prototypes.
@Calinou
Calinou requested review from a team as code owners April 25, 2022 14:48
@Calinou
Calinou requested a review from bruvzg April 25, 2022 14:48
@Calinou Calinou added this to the 4.0 milestone Apr 25, 2022
@fire

fire commented Apr 25, 2022

Copy link
Copy Markdown
Member

I wonder if MSDF can be defaulted on. I forget if mimaps are also able to be used or if it was exclusive.

@Calinou

Calinou commented Apr 25, 2022

Copy link
Copy Markdown
Member Author

I wonder if MSDF can be defaulted on.

Defaulting to MSDF can be problematic for lower-end devices, as it's not that cheap to render on the GPU. Generating MSDF glyphs also takes a while, so there can be stuttering during gameplay when a character is rendered for the first time. In fact, it might be a good idea to prerender the ASCII range of the default font when the MSDF setting is enabled.

MSDF fonts also tend to look worse at small sizes since they don't make use of hinting during the rendering process.

I forget if mimaps are also able to be used or if it was exclusive.

Mipmaps and MSDF can be used at the same time, as explained in the class reference. It's not essential, but it tends make downscaled fonts look a bit smoother. This can be good for Label3D when the camera moves.

I wouldn't enable mipmaps by default though, as it wastes memory (and mipmap generation time) if fonts are never rendered in a downscaled manner.

@fire fire left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@bruvzg bruvzg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, if MSDF is enabled, it should always pre-render Basic Latin and Alphabetic Presentation Forms (only a few common Latin ligatures, like ffi).

Also, it's probably better to have an extra option to enable the pre-rendering of other glyphs (for the default font it can be just three bitflags to select):

  • Extended Latin (Latin-1 Supplement, Latin Extended-A and a few chars from Latin Extended-B / Latin Extended Additional blocks).
  • Greek and Coptic.
  • Cyrillic (Cyrillic and Cyrillic Supplement blocks).

@akien-mga
akien-mga merged commit e9e2aaf into godotengine:master Apr 26, 2022
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@Calinou
Calinou deleted the default-font-add-msdf-mipmap branch April 26, 2022 21:17
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
…df-mipmap

Add MSDF and mipmap generation project settings for the default font
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
…df-mipmap

Add MSDF and mipmap generation project settings for the default font
wangshucheng pushed a commit to wangshucheng/godot that referenced this pull request Aug 27, 2026
…df-mipmap

Add MSDF and mipmap generation project settings for the default font
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants