This is a checklist to refer to if your Three.js scene doesn’t cast shadow as intended.
- Renderer’s
shadowMap
must be enabled.
renderer.shadowMap.enabled = true
- Use lights that support shadow casting, which currently are
DirectionalLight
,PointLight
andSpotLight
. - The light’s
castShadow
must be set totrue
. - The
castShadow
property of the object to cast a shadow must be set totrue
. - The
receiveShadow
property of the object to receive a shadow must be set totrue
. - If all above are set and there’s still no shadow, check your light’s
shadowCamera
's view frustum and make sure shadow casters and receivers are all inside the frustum.
Based on Three.js version r107
.