Repository navigation
always add labels to buffers in MapMode::Still - #2829
Conversation
|
Note that there are failing tests in the visual render suite because of this change. Is there an equivalent change that should be applied to mapbox-gl-js to generate updated fixtures, or is there an alternate workaround here @jfirebaugh? |
|
EDIT: Swapped images in comment above. In the "New" image, you can see that many of the labels (those that come from points within tile buffer area) are drawn twice, or maybe more if they're near a tile corner. This is a problem for static renders. To fix this, I believe we need to clip labels by tile boundaries, and at that point I think we should not have different layout and rendering pathways for Still vs Continuous mode:
cc @ansis |
|
Ah dang, totally missed that the static API can render more than just individual tiles. |
Yep, they need to be clipped by enabling the stencil test here.
Yes, whatever changes are made in -native need to be added to -js.
Separate paths allow for a pretty significant optimization. If labels are always clipped to tile boundaries, the quads used for rendering need to be included in multiple tiles not just one. Without clipping we can drop all the labels with anchors outside that tile's boundaries. Usually 50% - 66% of all labels are outside and can be dropped. A single render path with clipping at tile boundaries would mean:
|
|
My concern with having a separate rendering pathway is that even if we fix this specific issue, it will still be possible to make a style where labels look fine in |
|
@jfirebaugh Is still mode used to render vector tiles as PNG/JPG/raster tiles? |
|
@jfirebaugh that's a very good point. I hadn't thought about that |
|
My current thinking is that this approach is good enough as an expedient fix for 90% of the label rendering issues with static tiles. Let's get a test case for this in the test suite (hopefully City of London is a good one) and merge. I expect that some cases will still have a rendering issue -- where a label is so big/long that it crosses over a tile despite not being anchored in the buffer area. This is probably what's happening with Colorado Springs in #3357. These will need to be dealt with by tweaking the style. |
Agreed. This is the whole point of vector tile buffers. We could go as far as to issue a warning if This doesn't capture all cases but maybe the remaining 90% of the 90% 😬 |
|
Thinking about the Colorado Springs case again, I realized that it's probably the So I think we should merge this for the expedient fix, but then go back and make the more reliable fix, where we always clip labels to tile boundaries during painting. In order to get some of the nice performance characteristics of the existing approach perhaps we can cull the symbol geometries to those that actually intersect the tile. |
|
Hmm, overall we'd like to move to a model that doesn't use clipping. In an interactive context, we can load adjacent tiles by widening the invisible buffer from the viewport to X pixels around it. |
7cbccc9 to
a03dd15
Compare
|
Rebased this onto |
|
After clipping labels to tiles, I'm still seeing a single failing test case (overdrawn labels) locally for |
To minimize label clipping.
8b8c1b9 to
1dd1543
Compare
|
All tests are passing now. There was a small bug in the condition that determines when clipping happens. Merging |
|
Was there a test-suite test case added for this? |
No, most of the existing text tests have four tiles and already test tile crosstile clipping. I'm not sure how a clipping test would differ from any of the existing text tests. Do you have any ideas for tests that should be added? |
|
We should have a test case that was failing before the change, and passing after, like one of the regions from the screenshots above. |
for testing mapbox/mapbox-gl-native#2829 This test mimics rendering a single-tile png by rendering a 500x500 test that contains a single tile.
|
pr for test: #3457 |
for testing mapbox/mapbox-gl-native#2829 This test mimics rendering a single-tile png by rendering a 500x500 test that contains a single tile.







To minimize label clipping.
/cc @bsudekum @ansis @miccolis