maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

Some vector layers on more distant tiles are not rendered for pitched 3D terrain map

Open zdila opened this issue 1 year ago • 17 comments

maplibre-gl-js version: 2.4.0

browser: Vivaldi, Firefox

Steps to Trigger Behavior

  1. create a map with vector style and 3D terrain
  2. zoom it, pitch it

Link to Demonstration

https://labs.maptiler.com/showcase/osm-3d-terrain/#map=13.05/48.8144/21.5301/59.28/75.50&language=sk

Expected Behavior

All visible layers should be rendered.

Actual Behavior

Some vector layers (eg. some landcover type) on more distant tiles are not rendered for pitched 3D terrain map.

image

zdila avatar Sep 06 '22 07:09 zdila

This is by design. To improve performance and make sure we are not loading too many tiles, the distant tiles are using a lower zoom level tiles. In your case, since the pitch is over 60 degrees and the horizon is visible, if this algorithm was not implemented the entire world tiles would have needed to be downloaded and rendered. Not a great solution :-) I guess you'll be able to see more details when you pan the map further into the distance, right?

HarelM avatar Sep 06 '22 09:09 HarelM

@HarelM that is not the case. You can see gray residential areas and streets but not forests. If you disable 3D (or set pitch to zero) and will zoom out, you will see that residential areas and residential and other minor roads disappear before forests. There is no zoom with tiles containing those roads without forests in that style.

zdila avatar Sep 06 '22 09:09 zdila

I see. Thanks for the info! Can you try and create a simplified style that shows this issue maybe?

HarelM avatar Sep 06 '22 10:09 HarelM

I will do it.

zdila avatar Sep 06 '22 10:09 zdila

Here is the minimal-style demo: https://codesandbox.io/s/maplibre-gl-js-issue-1618-8wzxue

Too see something you must zoom in, for example: https://8wzxue.csb.app/#map=14.28/48.85968/19.36918/-101.31/69.90

There are two layers - one shows landcover to zoom 13 and other shows landcover from zoom 13. If there is only one landcover layer used for all zooms, then the issue is not reproducible.

zdila avatar Sep 07 '22 13:09 zdila

I only see one layer in the above link... am I missing something? Not that the issue does not exists there, but just want to make sure I'm looking at the right example... image

HarelM avatar Sep 07 '22 14:09 HarelM

In style.json there are two layers. I am actually not counting the third one - shading.

zdila avatar Sep 07 '22 15:09 zdila

Hi, this is related to LOD (level of detail). You defined a minZoom of 13, tiles near the horizon are requested for 12.

prozessor13 avatar Sep 08 '22 07:09 prozessor13

There are two layers - one has "minzoom": 13 other has "maxzoom": 13. Affected tiles have nothing there from neither of the layers.

zdila avatar Sep 08 '22 07:09 zdila

@zdila sorry for nagging, but can you simplify this even further - remove the style.json file, remove the hill shading and just have everything in the same file so it will be easy to see and understand?

HarelM avatar Sep 08 '22 08:09 HarelM

@HarelM no problem. I've updated the testcase. Let me know if I could do anything more.

zdila avatar Sep 08 '22 09:09 zdila

Ah ok, didnt noticed (only noticed the minzoom)! Yes this is an issue. How to fix. hmmm. I can think something where it comes from, but may it is not easy to fix... is this issue also in 2d? If you are interested in fixing this ;), i may can give you some hints to start with.

prozessor13 avatar Sep 08 '22 09:09 prozessor13

Tested by myself, and as expected, this issue is also in 2D. So this is no Terrain-3D issue. It is an LOD issue when tilting map more that 60deg.

prozessor13 avatar Sep 08 '22 09:09 prozessor13

I don't see the problem when terrain is "off", @prozessor13 can you share what you saw? Terrain commented out: image Terrain not commented out: image

HarelM avatar Sep 08 '22 09:09 HarelM

is this issue also in 2d

"Partially" :-)

If 3D terrain is not enabled, then I see also more distant tiles, but not "to the infinity". I would expect to see the horizont in the red colour (as for zoom < 13 the styling is red).

Samples:

  1. 3D enabled:

image

  1. 3D disabled:

image

  1. 3D disabled and slightly zoomed out:

image

  1. 3D enabled and slightly zoomed out:

image

zdila avatar Sep 08 '22 10:09 zdila

Yep. in 2D tile-list generation anchor is map-center, in 3d camera-position. So in 2d you get more tiles to the horizon, but the error is the same.

prozessor13 avatar Sep 08 '22 10:09 prozessor13

I'm not sure how to categorize this in terms of label - is this a bug or a enhancement? Is it only in 3D?

HarelM avatar Oct 21 '22 19:10 HarelM