Hello,
after some trial and error I managed to see shadows. Although I check that cameras are identical for drawing and shadows, the shadow is incomplete and wrong. I seems that the width of the shadow is too small. The cube is part of a group and setting castShadow for alle of them, using perspective camera, directional light and LambertMaterial.
The cube itstelf does not receive shadows at all, only the ground plane.
Any ideas?
Many thanks
You probably have to configure the view frustum of the shadow camera correctly. There is a helper class called CameraHelper
that can be useful when doing this:
scene.add( new THREE.CameraHelper( light.shadow.camera ) );
Depending on the type of light, the shadow camera is represented by a perspective or orthographic camera. For directional lights (which have an orthographic view frustum) code could look like so:
light.shadow.camera.top = 2000;
light.shadow.camera.bottom = - 2000;
light.shadow.camera.left = - 2000;
light.shadow.camera.right = 2000;
light.shadow.camera.near = 1;
light.shadow.camera.far = 2000;