What are reasons no shadows appear?

I’ve force enabled all shadows in a scene like this,

function animate() {
  scene.traverse(n => n.castShadow = n.receiveShadow = true)
  renderer.render(scene, camera)
  requestAnimationFrame(animate)
}

animate()

but there’s not a single shadow visible in the scene.

This code sets castShadow and receiveShadow for all objects, including meshes and lights, to true, yet no shadows appear.

I haven’t seen this happen before. Any ideas what to check? (the project is private, I don’t have a public reproduction yet).

Have you set renderer.shadowMap to enabled as well as check the bounds of your lights shadow camera?

3 Likes

Oops , yep, renderer.shadowMap.enabled = true was missing. :rofl:

I’ve gotten so accustomed to the simple aspects of Lume 3D HTML (built on top of Three.js) that when I go back to plain Three.js I forget the non-obvious parts (if you say an object casts a shadow in Lume, then it just does).

3 Likes