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

Single-pass halo text #4717

Closed
wants to merge 1 commit into from
Closed

Single-pass halo text #4717

wants to merge 1 commit into from

Conversation

d1manson
Copy link

With this change, halo text is rendered in the same shader pass as the text itself.

The motivation for this was to improve the appearance of overlapping text as shown below:

screen shot 2017-05-17 at 10 55 23

Presumably it also has a somewhat beneficial impact on performance.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs ...none in this case
  • post benchmark scores
  • manually test the debug page

@d1manson
Copy link
Author

I have just noticed a potential issue, which is that now the halo from one character can overlap with the non-halo part of the previous character (within the same piece of text). The text-letter-spacing style value can be increased as a hack workaround, but it's not really what I wanted.

@kkaefer
Copy link
Contributor

kkaefer commented May 17, 2017

refs #596

@kkaefer kkaefer requested a review from lbud May 17, 2017 10:50
@kkaefer kkaefer added performance ⚡ Speed, stability, CPU usage, memory usage, or power usage refactoring 🏗️ labels May 17, 2017
Copy link
Contributor

@lbud lbud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: #4717 (comment) — right, we ran into that issue in #596. As @jfirebaugh noted in #4709 (comment),

The current behavior was chosen because it's almost always the desired result for text symbols. If we were to implement the alternative behavior, we would need to take care to preserve the current rendering of text. I can think of a few approaches:

  • Make halo overdrawing happen for icons, but not for text
  • Make halo overdrawing an opt-into behavior based on a style property
  • Make halo overdrawing happen for separate features, but preserve the current behavior for individual icons/glyphs associated with a single feature

We won't be able to merge this PR as-is as it would negatively impact label rendering for a lot of existing map styles. It's also clear from your intention here that option 1 from the above comment isn't necessarily the right solution for all users, which is helpful to know. Let's centralize discussion of how this should be solved in #4709.

@ChrisLoer
Copy link
Contributor

If we handle the other considerations that are blocking this, there's one more thing to worry about.. we're actually planning to rely on halos being done in a separate draw call on gl-native: mapbox/mapbox-gl-native#9009. The reason is that device compatibility limitations require us to have 8 or fewer vertex attributes (and using two draw calls allows us to selectively use only fill_color or halo_color). Even though that requirement doesn't directly affect gl-js, we want to keep the shader implementations in sync between the two code bases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage refactoring 🏗️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants