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

Is there any way to add 3d building textures in mapbox GL JS?

Open Vinita18 opened this issue 8 years ago • 4 comments

Hi, I want to ask, Is there any way to add 3d building textures on map using GL JS? I found the option to change the color of the buildings in mapbox studio but I want to add textures to the 3D buildings to give more realistic look like Unity. Or does mapbox supports unity webGL builds?

Vinita18 avatar Oct 31 '18 12:10 Vinita18

Hi @Vinita18 there's no way to apply textures to a 3d extrusion layer, but our new custom layer interface may suit your needs. They allow for rendering 3d models on your map as seen here. If you have further questions, our support team is available to help.

EDIT: I should have mentioned fill-extrusion-pattern as well. This may be what you were looking for.

ryanhamley avatar Oct 31 '18 18:10 ryanhamley

The example posted above no longer works. @ryanhamley has the required code changed?

spencerthayer avatar Mar 08 '22 01:03 spencerthayer

@spencerthayer I'm not sure why that link doesn't work, but we have an official example of adding 3d models to GL JS now: https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/

ryanhamley avatar Mar 08 '22 02:03 ryanhamley

It's working, but you changed the map center, but not the model origin, so the model is being rendered somewhere offscreen.

ryanhamley avatar Mar 08 '22 20:03 ryanhamley