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

[v3] Casting light from 3D models / layer interactions #12936

Open
mfobert opened this issue Oct 18, 2023 · 0 comments
Open

[v3] Casting light from 3D models / layer interactions #12936

mfobert opened this issue Oct 18, 2023 · 0 comments
Labels

Comments

@mfobert
Copy link

mfobert commented Oct 18, 2023

Before Mapbox v3 beta, I had implemented the building layer and additional models using the third party Threebox library; this enabled me to cast light from models and have it interact with surrounding buildings.

For example, in the image below you can see the white dot casting blue light onto the surrounding buildings.
image

I have since switched to v3 and have been able to import models with the recommended approaches (looks awesome - thanks!!!), but have been unable to implement any sort of lighting. I have attempted to add light sources to my .glb

glb = {
...
  "extensions": {
    "KHR_lights_punctual": {
      "lights": [
        {
          "color": [
            1,
            1,
            1
          ],
          "intensity": 1,
          "type": "point",
          "range": 100
        }
      ]
    }
  },
  "extensionsUsed": [
    "KHR_lights_punctual"
  ]
...
}

but this has no evident effect on the output model layer in Mapbox. I have also tried to add additional lights utilizing the new lights API, to no avail.

image

I'm wondering if there is any recommended way to implement point light sources that interact with other layers (building / trees) or another raycasting sort of feature that achieves the same effect? Additionally, as can be seen in the image above, I am not able to get shadows between the model layer and tree layer to behave in the expected way when dealing with a opacity gradient in my source model (the tree shadow is cut off); I have changed the model-cast-shadows and model-recieve-shadows layer attributes, but this has no effect. I have also not been able to place the model layer above the tree layer as when I set the before? parameter in addLayer to 'trees' or 'trees\u001fbasemap', I recieve an error that this layer cannot be found, even when I can successfully query for it with betaMap.style.getLayer('trees\u001fbasemap').

Thanks for your help.

@mourner @astojilj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants