Detuned
Detuned

Reputation: 3758

How to change the volume of DirectionalLight in THREE to cast larger shadows?

I have a DirectionalLight in my screen casting light downwards onto a large 3d model. I have a plane above this model that I'd like a shadow projected (orthographically) onto the 3d model. This did not work as I had expected, so after adding the DirectionalLightHelper, I noticed that the volume of the DirectionalLight is only a small portion of the 3D model. When the plane is within this volume, the shadow works.

I assume that I need to increase the volume of the DirectionalLight box to be able to project light onto the entire model?

Upvotes: 0

Views: 39

Answers (1)

Mugen87
Mugen87

Reputation: 31066

Try to increase the frustum of the internal shadow camera like in this example: https://threejs.org/examples/webaudio_timing.html

    var d = 5;
    directionalLight.castShadow = true;
    directionalLight.shadow.camera.left = - d;
    directionalLight.shadow.camera.right = d;
    directionalLight.shadow.camera.top = d;
    directionalLight.shadow.camera.bottom = - d;

Upvotes: 1

Related Questions