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 text rendering output #207

Open
ensisoft opened this issue Sep 9, 2024 · 2 comments
Open

Improve text rendering output #207

ensisoft opened this issue Sep 9, 2024 · 2 comments

Comments

@ensisoft
Copy link
Owner

ensisoft commented Sep 9, 2024

Find a way to improve the text rendering output.

bad-rendering

The attached screenshot shows multiple problems:

  • clipping at the right edge
    • this is ok, it's just the text composition buffer that is too small
  • clipping the vertical ascent (for example the bottom part of letter g)
    • line height issue, probably fixable by user setting a larger line height multiplier
  • garbled text on multiple occasions
@ensisoft
Copy link
Owner Author

ensisoft commented Sep 9, 2024

sample-text-buffer

The raw text raster from the text rasterizer looks like this

@ensisoft
Copy link
Owner Author

ensisoft commented Sep 9, 2024

A problem related to transferring the text to the screen is

  • The text already has alpha blended anti-aliasing built into it with partially transparent pixels
  • Sampling from the texture might filter and thus squashes multiple pixels together
  • When drawing to the render targets color buffer there's no per pixel level precision to transfer the pixels from the rasterized text to exact pixel locations in the render target by drawing.
    • when the output is a MSAA render target more garbling happens due to aliasing.

Seems that ideally when the rendered output of the text matches exactly the rasterized text (as it should) we'd like to transfer the pixels directly (pixel per pixel) to the render target color buffer.

Theoretically one could resolve the MSAA FBO RT color buffer and then use a compute shader to write to the color buffer texture but this would not work when there's a need to do stencil testing.

ensisoft added a commit that referenced this issue Sep 12, 2024
Change text rendering (text material) text filtering mode and just
force/use linear min/mag filtering for now.

Using a better filtering (with mipmaps) would require that the
rasterized text is a power of two (on ES2/WASM). But this already
seems to improve the text somewhat.

Issue #207
ensisoft added a commit that referenced this issue Sep 12, 2024
Change text rendering (text material) text filtering mode and just
force/use linear min/mag filtering for now.

Using a better filtering (with mipmaps) would require that the
rasterized text is a power of two (on ES2/WASM). But this already
seems to improve the text somewhat.

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

No branches or pull requests

1 participant