Mapbox-gl-js: rendering multiple gltf 3D model in a single layer on map using mapbox gl and three js

Created on 13 Aug 2019  路  3Comments  路  Source: mapbox/mapbox-gl-js

Question

I used adding gltf 3D Model on map using mapbox gl with three.js

but adding single 3D gltf model in single separate layer and adding them to map is working fine,but is there any way to add mulitple 3D gltf model in a single layer on the map.

Most helpful comment

@gongyucheng @bardiaheshmati take a look at this gist: https://gist.github.com/danvk/f8b55af3c1ed2cfafa51ea3385f9933f

The add-3d-model demo positions the camera in a way that makes it a bit tricky to extend to 2+ objects at different locations.

The gist uses react-mapbox-gl but you should be able to use SpriteCustomLayer directly if you're using Mapbox GL JS directly.

All 3 comments

@gongyucheng yes, you can add multiple gltf models to a single GL context within a single custom layer. there's no special method to do this as far as I'm aware

@mourner can you explain a bit more, when I try adding multiple gltf files to a single layer, all the object origins goes crazy, and all end up overlapping on top of each other, if it's possible to have an example if multiple gltf loading on a single layer. thanks

@gongyucheng @bardiaheshmati take a look at this gist: https://gist.github.com/danvk/f8b55af3c1ed2cfafa51ea3385f9933f

The add-3d-model demo positions the camera in a way that makes it a bit tricky to extend to 2+ objects at different locations.

The gist uses react-mapbox-gl but you should be able to use SpriteCustomLayer directly if you're using Mapbox GL JS directly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rasagy picture rasagy  路  3Comments

stevage picture stevage  路  3Comments

shotor picture shotor  路  3Comments

aderaaij picture aderaaij  路  3Comments

yoursweater picture yoursweater  路  3Comments