Suggesting for Light/s to cast perpendicular parallel beams through doorways

Hi, very new to ThreeJS (and 3D in general), about a week into my first project.

I have a scene that has a number of doors that will open, and cast a beam of light from behind the door accross a plane. I want the beams to be parallel, as though cast form a very wide rectangular light.

Here’s what I ahve so far:

As you can see using a Spotlight means the beams fan out, and aren’t prependicular to each other. Same with Pointlight and Directional light.
What I thought I needed was a RectAreaLight but they don’t cast shadows :frowning:

Any way do to this without putting a Spotlight behind every door?

Thanks!

Two ideas would be:

  • (a) bake the lights and shadows to textures in Blender
  • (b) make the point light (or whatever) very distant, like 5000m away, then adjust the decay, light distance, and shadow camera parameters to accommodate that.

see DirectionalLightShadow – three.js docs (threejs.org)
example : Directional Light Shadow - Three.js Tutorials (sbcode.net)

Thank you for your ideas @donmccurdy and @seanwasere. I tried both and didn’t previously know about the separate Shadow object types for lights, so that was v.useful.

As I wanted realised in testing more that I wanted beams parallel with each other, but still showing a fan shape individually, I decided I needed as many Spotlights as I had doors, so cloned them. This was pretty processor intensive when played, so I settled on having a single Spotlight, with it’s Shadow options tuned to look right, and then programatically moving that spotlight to sit behind the door that’s just about to be opened. Happy with it, thanks again for pointers and making me think more about it.

1 Like