captDaylight captDaylight - 12 days ago 6
React JSX Question

Shadow not being cast with ThreeJS in react-three-renderer

I'm having trouble casting a shadow in my scene. Steps I've taken:


  1. shadowMapEnabled attribute added to the React3 element

  2. the directional light in my scene has verbatim the properties I see here in the react-three-renderer example

  3. all three meshes (one cube and two planes) in the scene have castShadow and receiveShadow



I have a black cube in the image below to show where the directional light is eminating from.

enter image description here

Here's a gist of my code. (abbreviated)

Answer

Try reducing the shadow camera's near value, it looks too high. If you can provide a full example it may be easier to diagnose what's happening

Additionally try to place a different object at the "lookAt" target for the light, this should help identify in which direction it will face