peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
526 stars 320 forks source link

Setting castShadow causes blank render #42

Closed AllenWilliamson closed 5 years ago

AllenWilliamson commented 6 years ago

I'm trying to get shadows working using the latest threebox (with mapbox custom layers). When setting castShadow on a DirectionalLight, threebox does not render anything.

Is this a limitation of threebox or has anyone had any luck getting them to work?

peterqliu commented 6 years ago

@AllenWilliamson thanks for the note. can you make a test case illustrating what you're seeing?

AllenWilliamson commented 6 years ago

http://jsfiddle.net/allenw/cwtea0v5/40/

I'm not able to recreate the blank render from my project, but shadows don't seem to be working well either way in the fiddle.

In my project where where the blank render occurs, I can see the first frame render with shadows but then quickly disappears to just show the map.

It would be great to get some official examples of using shadows in threebox.

peterqliu commented 5 years ago

after a bunch of debugging, realized that you needed to add sunlight via threebox.addAtCoordinate, rather than threebox.world.add: https://jsfiddle.net/np5tqa06/ I'm using THREE.SpotLight here, but DirectionalLight should work with a bit more finessing.

Please do cut a ticket if you keep seeing the blank render and are able to reproduce -- it likely is related to the map not repainting after the three.js scene updating.

danvk commented 5 years ago

@peterqliu Do you have a working demo of a shadow using threebox? The fiddle linked to above produces this for me:

image

(Context: this question)

robhawkes commented 5 years ago

I'm also seeing the same results at @danvk when loading the fiddle. I'm currently trying to get shadows working but so far haven't had much luck.

jscastro76 commented 4 years ago

@robhawkes @danvk Just FYI, I think I have resolved this quite old request in my Threebox fork creating a realistic sun light mode for a given date, time and lnglat combination. I'm about to update the fork with these samples... Static MapboxShadow (1) Dynamic EiffelShadow