maplibre / maplibre-gl-js

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

Add 3D Tiles / batched-model support #3794

Open bertt opened 8 months ago

bertt commented 8 months ago

In MapBox GL JS v3 there is support for 'batched-model', with this we can add glTF 2.0 models to the map (like 3D Tiles).

Demo: https://bertt.github.io/mapbox_3dtiles_samples/samples/standard/tienhoven/

image

Sample code:

map.addSource('bag-3d', {
        "type": "batched-model",
        "maxzoom": 15,
        "minzoom": 15,
        "tiles": [
          "https://bertt.github.io/mapbox_3dtiles_samples/samples/standard/tienhoven/content/{z}-{x}-{y}.glb"
        ]
      }
)});

// add the custom style layer to the map
map.on('style.load', () => {
  map.addLayer({
    id: 'bag-layer',
    type: 'model',
    source: 'bag-3d',          
  });

Can we have support for batched-model in MapLibre as well?

HarelM commented 8 months ago

We can, if someone in the community would implement this without looking at the mapbox code, as this would infringe their copyright rules. I'll be happy to review any PR in that area.

guangbinl commented 8 months ago

Hi,I want to know how to generate model data in {z}-{x}-{y}.glb format, and what open source free tools can be used to do this?

tobias-brunner commented 7 months ago

@bertt maybe you could leverage deck.gl and use its MapboxOverlay function? https://deck.gl/examples/google-3d-tiles no idea if this really works as I've never done anything with maplibre.

vicb commented 7 months ago

Thanks for the link @tobias-brunner ! It doesn't look like the implementation is too big - I think it's mainly tile-3d and mesh layer - it would be cool to have that available in MapLibre 🎉

bertt commented 7 months ago

a test with Deck.GL Tile3DLayer and TerrainLayer https://bertt.github.io/deckgl_demo/sibbe/dist/