Search code examples
mapboxmaplibre-gl

MaplibreGL JS, with terrain on, opacity of markers gets changed on moving


I made custom html element for markers in MapLibre, so they can show some data.

When I added terrain to map (amazon rgb terrain), it happened that markers change their opacity while camera is moving. By default it's 1 of course, but suddenly goes to 0.2. I can only suggest that while we move and scene being rendered again, MapLibre thinks that point is under the ground??

I coudn't find any mention of such problem with markers or places in docs about markers can change opacity because of terrain(

here is video demo of what happens https://www.youtube.com/watch?v=6zqEOcTH2Pw


Solution

  • It happened to be collision with terrain. It works pretty well with default small droplet markers and stuff like that, but bigger html elements cause a lot of collisions which makes them hard to use with terrain for now. As I understand there is no easy solution for now. Opened and issue on maplibre github https://github.com/maplibre/maplibre-gl-js/issues/1783