NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.63k stars 290 forks source link

Expose tile depth level #813

Open xawill opened 1 month ago

xawill commented 1 month ago

Is your feature request related to a problem? Please describe.

I am overlaying multiple tilesets: google photorealistic tiles for the whole world and another tileset specifically for Switzerland. I would therefore need to hide google tiles for Switzerland, but only when the zoom level is sufficiently zoomed in so that Switzerland takes the whole screen (to avoid having to deal with seams between multiple tilesets). Also, Switzerland tiles are very detailed and not needed when very zoomed out, so I would like to deactivate them.

In the load-model callback, I currently cannot know the tile depth level and apply the logic mentioned above based on this.

Describe the solution you'd like

In addition to the existing maxDepth setting which is useless in this current use case, have the tile depth level publicly exposed in the API. It looks like the current __depth would be the one I am looking for, right?

Describe alternatives you've considered

At least having a minDepth setting?

Additional context

Add any other context or screenshots about the feature request here.

Below, you see the google tiles fully inside Switzerland's bounding box at this zoom level being 90% transparent like I would like to have them when we are very zoomed in. However at this zoom level, I would still like to see all the google tiles (for homogeneity reasons), and disable Switzerland tiles (for performance reasons). Capture d’écran 2024-10-17 à 15 06 20

gkjohnson commented 1 month ago

I would therefore need to hide google tiles for Switzerland, but only when the zoom level is sufficiently zoomed in so that Switzerland takes the whole screen (to avoid having to deal with seams between multiple tilesets). Also, Switzerland tiles are very detailed and not needed when very zoomed out, so I would like to deactivate them.

Why not use the bounding volumes of the Switzerland tile set to determine when the camera is "close enough" to switch which tile sets are visible? Eg you could check when the camera is inside the bounds. check the distance to the bounds, check the screen space size of the bounds, etc to make the determination of which tile sets should be displayed.