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

Text: alpha blending of the fonts is not applied correctly in shader #1245

Open
hordurj opened this issue Aug 14, 2024 · 0 comments
Open

Text: alpha blending of the fonts is not applied correctly in shader #1245

hordurj opened this issue Aug 14, 2024 · 0 comments
Labels
bug Something isn't working needs-triage Issues that need triaging

Comments

@hordurj
Copy link
Contributor

hordurj commented Aug 14, 2024

The glyph texture uses the alpha channel to anti-alias fonts. This information is not correctly used in the text shader.

return vec4<f32>(color.rgb * c.a, color.a);

where c.a is the font texture.

this will make the color darker which will only work on a black background. Instead, the following should be used:

return vec4<f32>(color.rgb, c.a);

This will properly blend the font with the background. If the alpha channel in the color should be used to make transparent text, then

return vec4<f32>(color.rgb, color.a * c.a);

could be used.

Example:

Before:
before

After:
after

@hordurj hordurj added bug Something isn't working needs-triage Issues that need triaging labels Aug 14, 2024
hordurj added a commit to hordurj/mach that referenced this issue Aug 14, 2024
@hordurj hordurj changed the title Text module: alpha blending of the fonts is not applied correctly in shader Text: alpha blending of the fonts is not applied correctly in shader Aug 24, 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 needs-triage Issues that need triaging
Projects
None yet
Development

No branches or pull requests

1 participant