Some symbols disappear in globe projection between zoom levels 5 and 6
mapbox-gl-js version: 2.13.0
browser: Chrome 111
Description
Symbols of these types:
- Line labels
- Point labels with variable anchors
- Symbols with both
text-variable-anchorandicon-text-fitset
are not rendered in globe projection between GLOBE_ZOOM_THRESHOLD_MIN and GLOBE_ZOOM_THRESHOLD_MAX.
Steps to Trigger Behavior
- Go to https://codepen.io/osvodef/pen/povExxg
- Zoom in
Link to Demonstration
https://codepen.io/osvodef/pen/povExxg
Expected Behavior
All labels stay visible while crossing zoom levels 5–6
Actual Behavior
3 labels disappear, 1 stays
Additional info
I did a bit of detective work myself on this issue, hope this helps.
I tracked the bug down to symbol vertex shaders and u_zoom_transition uniform. Forcing its value to 0 makes the labels appear, but on wrong positions on the screen, as if no globe→mercator transition is happening.
In the shaders, I found this line that hides the labels when u_zoom_transition > 0:
#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
projection_transition_fade = 1.0 - step(EPSILON, u_zoom_transition);
#endif
However, just removing this line doesn’t fix the issue since the screen coordinates calculated by the shader are also wrong when u_zoom_transition > 0, usually putting the symbol completely off-screen.
The projection_transition_fade line suggests that this was done intentionally, however, I couldn’t find any relevant discussion in PRs/issues here so I decided to report it anyway.
@karimnaaji looks like this was introduced in #11015 — maybe you have insight into what's going on here?
I have a similar type of issue, for me the symbols don't disappear but the Features do. The problem for me manifest only if zoom >=6. This is my ugly workaround at the moment:
<MapGL
projection={zoom < 6 ? "globe": "mercator"} //TODO: fix me
initialViewState={mapSettings.defaults}
...
/>
Edit: it was fixed with an update, now all good!
Could be related to https://github.com/mapbox/mapbox-gl-js/issues/12100