Option for DirectionalLights or ShadowGenerator to follow camera

Hi there,

I’m writing some code to limit shadow rendering to just where the camera is looking. It feels like it should be a feature rather than something left to the developer.

It would be really nice if there was an option on DirectionalLight to follow the camera, so that ShadowGenerators are always generating shadows only where the camera is looking. Alternatively, the ShadowGenerator could be attached to the camera.

I believe the simplest way is to set the camera as the parent for the light.

1 Like

Yeah, that makes the light rotate with the camera. i did realize I made a couple dumb mistakes in my code, and it really is as simple as setting the dirLight’s position = camera’s position. But, still would be nice to add a flag for this, as I’ve always found you typically want your shadowGenerator to generate shadows where the camera is.