+1 vote

I have a scene for rendering a HUD containing following hierarchy:

Spatial
- Viewport (fixed size)
- - Control (with script to draw the HUD contents)
- MeshInstance (QuadMesh with material using ViewportTexture)

This scene is instantiated in front of player camera in the main scene.

It all works well until I switch to full-screen mode or resize the main window. After that all characters in the HUD show up as rectangles: https://i.imgur.com/r0Mt1qn.png

I found out that calling Control's update() method manually after main window resize fixes the texts. That leads to the questions:

  1. Why does resizing main viewport require updating other viewports and why does that not happen automatically? Am I doing something wrong here?

  2. Where should I call the update() method? As this viewport is not resized, I'm not getting any resize signals or notifications within this scene. Listening to main viewport size changes and manually updating all other viewports feels a bit hacky solution..

in Engine by (71 points)

1 Answer

+1 vote
Best answer

Why does resizing main viewport require updating other viewports and why does that not happen automatically? Am I doing something wrong here?

This is likely due to DynamicFont oversampling. To work around this, try disabling Rendering > Quality > Dynamic Fonts > Use Oversampling in the Project Settings.

by (11,899 points)
selected by

You're right, that fixed the initial problem.

Do you know if this behavior with font oversampling is a "feature" or something that gets eventually fixed?

It stems from a limitation of the font oversampling system which only supports a single global font scale factor, rather than a per-viewport (or per-node) scaling factor. I don't know if it will be fixed anytime soon though.

Moving to distance field fonts would remove the need for font oversampling techniques, but these are also more computationally expensive to render.

That's good to know, thanks. This workaround is good enough for me, at least for now.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.