Skip to content
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

(3.5) Label3D buggy when DynamicFont oversampling is working #61517

Closed
wareya opened this issue May 29, 2022 · 4 comments
Closed

(3.5) Label3D buggy when DynamicFont oversampling is working #61517

wareya opened this issue May 29, 2022 · 4 comments
Assignees
Milestone

Comments

@wareya
Copy link
Contributor

wareya commented May 29, 2022

Godot version

3.5

System information

Windows 10

Issue description

The Label3D node backported to 3.x in #61276 exhibits weird glyph scaling and linewrapping behavior when the project's window viewport scaling mode is set to 2d and dynamicfont oversampling is not disabled:

godot.windows.opt.tools.64_2022-05-28_21-15-10.mp4

One of these issues, the unstable linewrapping, is #56399.

The other issue, with the individual glyphs being missized and misplaced, is specific to Label3D, and is why I'm opening a new issue. Updating the text or width of the Label3D after shrinking the window does not cause the missized/misplaced glyphs to re-flow.

4.0 probably does not have the first issue. I have no idea whether 4.0 would have the second issue.

Steps to reproduce

  1. Make sure dynamic font oversampling is enabled in project settings
  2. Set project window viewport scale mode to "2D"
  3. Put a dynamicfont and some text in a Label3D. Enable autowrap and reduce the width property to something that wraps
  4. Run the project, resize the game window, and observe brokenness. (these issues don't happen in-editor)

You can add an identical autowrapping Label node with the same font, text, and width if you want to compare line wrapping oddities.

Minimal reproduction project

No response

@bruvzg bruvzg self-assigned this May 29, 2022
@Calinou Calinou added this to the 3.5 milestone May 29, 2022
@Calinou
Copy link
Member

Calinou commented May 29, 2022

One workaround could be to disable font oversampling on fonts used in a Label3D.

That said, I think it'd be better if font oversampling working on Label3D, with the pixel size automatically being decreased to account for the greater font size.

@wareya
Copy link
Contributor Author

wareya commented May 29, 2022

One workaround could be to disable font oversampling on fonts used in a Label3D.

Oversampling can only be disabled on a per-DynamicFontData basis, right? That might be a gotcha for users of Label3D, since games frequently share font resources between DynamicFonts used in different places. They'd have to duplicate it/make it unique first.

That said, I think it'd be better if font oversampling working on Label3D, with the pixel size automatically being decreased to account for the greater font size.

I don't think this would work very well with the dynamicfont oversampling system, because of 3d perspective. Maybe just for billboarded fixed-size things. Or maybe with runtime-generated SDFs? But 3D-perspective SDFs can't work 100% properly in GLES2, because it lacks screenspace derivatives... I dunno, just spitballing.

@Calinou
Copy link
Member

Calinou commented May 29, 2022

I don't think this would work very well with the dynamicfont oversampling system, because of 3d perspective

It might turn out OK if mipmap generation is enabled on the Label3D. Font oversampling wouldn't be performed every frame when the camera moves, just when the window size changes.

Or maybe with runtime-generated SDFs?

Unlike master, Godot 3.x doesn't support generating SDFs from DynamicFont files. Only bitmap fonts can be imported this way, and it's not as convenient as in master. It also looks worse at smaller sizes, as it doesn't use multi-channel SDF.

@akien-mga
Copy link
Member

Fixed by #61535.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants