maplibre / maplibre-gl-js

MapLibre GL JS - Interactive vector tile maps in the browser
https://maplibre.org/maplibre-gl-js/docs/
Other
6.49k stars 695 forks source link

Line labels "show through" the terrain #1030

Open zstadler opened 2 years ago

zstadler commented 2 years ago

A stream label is seen in full while the stream line is barely seen.

image

maplibre-gl-js version:

browser: Win 11 Firefox, Win 11 Chrome

Link to Demonstration

https://wipfli.github.io/maplibre-terrain3d/#14.48/31.46119/35.36986/-87.2/80

Expected Behavior

Show labels only not obstructed by the terrain.

prozessor13 commented 2 years ago

Mapbox has the same problem, at least some times ago, dont know if they fixed it until now. I have 3 possible ideas to handle this problem:

Every of this tasks is still some work to do, and for me it is more a minor issue. What do you think?

zstadler commented 2 years ago

Would it be possible to show the label only if all glyph-anchors are visible, similar to the second option? If performance is an issue, perhaps checking for 3 anchors would be sufficient - the first and last glyph-anchors and the label-anchor.

prozessor13 commented 2 years ago

Technically it is possible, but the problem is, that the vertext-shader do not know anything about the "other" characters. So your proposal and my way 1 both needs to transfer all coordinates for checking visibility to every single character, which will increase the vertex-buffer-size significant.

Also to fix this issue in a good way, it think it is necessarry to test different ways, and then choose the best compromise.

HarelM commented 1 year ago

Assigned L bounty. Link to parent Bounty: https://github.com/maplibre/maplibre/issues/189 If you think the bounty is not big enough please ping me.