Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support custom textures on fill-extrusion layers #6516

Closed
onny opened this issue Apr 15, 2018 · 7 comments
Closed

support custom textures on fill-extrusion layers #6516

onny opened this issue Apr 15, 2018 · 7 comments

Comments

@onny
Copy link

onny commented Apr 15, 2018

Hey,
I would like to ask if it's already possible to add "3d" images to mapbox gl js or is there maybe some workaround in how to achieve an image layer in 3d-perspective?

Best regards,
Jonas

@andrewharvey
Copy link
Collaborator

andrewharvey commented Apr 15, 2018

Do you mean a volumetric 3D image like this https://grass.osgeo.org/grass72/manuals/raster3dintro.html ?

@onny
Copy link
Author

onny commented Apr 17, 2018

Thanks @andrewharvey for your replay. Of course you're right the term "3d image" is kind of unspecific.
In my project where I'm using mapbox gl js, I've added a custom 3d building layer. On some walls I would like to have a custom texture (e.g. an image) instead of a simple color.
Not sure if this is already possible or a planned feature.

@andrewharvey
Copy link
Collaborator

I don't think there is a ticket for this already, but it touches #3996 and #1489

@andrewharvey andrewharvey changed the title 3D image layer support custom textures on fill-extrusion layers Apr 17, 2018
@onny
Copy link
Author

onny commented Apr 17, 2018

Thanks for clarifying my request ;)

@jfirebaugh
Copy link
Contributor

I don't think we're likely to implement this as titled, as part of fill-extrusion , so let's roll this into #3996.

In the meantime @onny, you may be interested in the Mapbox SDK for Unity, which is more targeted to the 3d space.

@aartikanungo
Copy link

In my project where I'm using mapbox gl js, I've added a custom 3d building layer. On some walls I would like to have a custom texture (e.g. an image) instead of a simple color.
Not sure if this is already possible or a planned feature.

Hello @onny i want to do something exactly like this. want to add image in place of color filled. Did you get the solution for this? thanks in advance :)

@abrichr
Copy link

abrichr commented May 11, 2021

Here's a crude approximation:

const textureUrl = './texture.jpg'  // replace this with a URL to your texture
const textureName = 'buildingTexture';

map.loadImage('./texture.jpg', function (error, image) {
  if (error) throw error;
  map.addImage(textureName, image);
})

map.addLayer({
    ...
    type: 'fill-extrusion',
    paint: {
      'fill-extrusion-pattern': textureName,
      ...
    }
    ...
  },
  ...
);

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants