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

Improve SDF Font Outlines Rendering for Better Compatibility with Various Font Styles #2584

Open
ourabigdev opened this issue Dec 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ourabigdev
Copy link
Contributor

ourabigdev commented Dec 26, 2024

Release Type

GitHub (master branch)

Version

Master branch

Platform(s)

Windows

Describe the Problem

This issue pertains to the implementation of text outline support, introduced in PR #2582. The feature is functional and usable, but there are some rendering issues when working with certain font styles. Specifically:

  • Fonts with rounder shapes tend to render well even with larger outline thicknesses.
  • Fonts with sharp or thin features may display visible gaps between outline offsets as the outline thickness grows.

While the current implementation is a good starting point, further refinements are necessary to ensure consistent rendering across all font styles.

Steps to Reproduce

  1. Use the master branch containing the changes from PR #2582.
  2. Set up a TextBlock with a font of your choice.
  3. Assign the font type as SpriteFontType.SDF.
  4. Apply an OutlineThickness value greater than Text Size/10 example:**Text size 100 apply thickness to 20** to the TextBlock.
  5. Test with both round and sharp/thin fonts.
  6. Observe:
    • Round fonts render outlines correctly.
    • Sharp/thin fonts may exhibit visible gaps as the outline thickness increases.

Expected Behavior

Outlines for all fonts (round, sharp, or thin) should render smoothly without gaps or artifacts, regardless of the outline thickness.

Screenshots

2024-12-26.12-00-01.mp4

Additional Context

This implementation of text outline support is a functional addition to the renderer, introduced in PR #2582. While it works well for most cases, improvements are needed to address edge cases, especially for fonts with sharp or thin features.

Next Steps

  • Explore a method to dynamically adjust kernel sizes based on the font style to mitigate gaps.
  • Investigate shader-based solutions for smoother rendering.
  • Open to further testing and feedback to refine the feature.

This is a significant step forward for text rendering in Stride, and I will continue to work on improving this feature. Feedback and suggestion and contributions are welcome!

@ourabigdev ourabigdev added the bug Something isn't working label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant