-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Don't draw halo pixels "underneath" text pixels #2897
Conversation
This prevents unexpected color blending when labels are partially transparent. This also allows fully transparent text with an opaque halo for an "outline" effect.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2897 +/- ##
==========================================
+ Coverage 74.48% 74.49% +0.01%
==========================================
Files 238 238
Lines 19002 19018 +16
Branches 4284 4285 +1
==========================================
+ Hits 14153 14167 +14
- Misses 4849 4851 +2
☔ View full report in Codecov by Sentry. |
…ot was partially red, which didn't really make sense.
153d232
to
9336919
Compare
Oops, my first take at this didn't pass tests because marking the "inside" of the halo as the edge of the text left a small overlap area where even in the fully opaque case, partially transparent text (from the edge anti-aliasing) could be drawn over a partially transparent inner halo edge, and you'd get some slight unexpected color mixing from beneath the halo. I fixed that by just making the halo wider on the inside by one The |
Can you please add a change log entry? |
@louwers is there an issue in Native for this? |
As a rule of thumb I think whenever somebody edits a shader in MapLibre GL JS, we need an issue in Native. And vice versa... |
Some edits to shaders have no discernible changes to rendering output. A better rule of thumb would probably be when someone adds or edits a render test. Even better would be if this was automated somehow. I'll have a look and create an issue. |
This prevents unexpected color blending when labels are partially transparent. This also allows fully transparent text with an opaque halo for an "outline" effect.
We came across the previous behavior at Felt because our UI gives users control over
text-color
andtext-halo-color
and allows setting the alpha channel. I think if you have a partially transparent label, you don't expect the of the text to be blended with the halo color.Here's the previous behavior with transparent text-color and a black halo:
Here's the previous behavior with text-opacity: 0.5 and blue text with a yellow halo -- note how it becomes green:
This adds a tiny amount of extra work to the symbol_sdf fragment shader, but in my experience a little extra math in shaders rarely has measurable perf impact. I don't see anything jump out from the benchmark results:
cc @makella @ibesora
Launch Checklist
CHANGELOG.md
under the## main
section.