Shadow from object to ground not working

Hi,

I can’t manage to display shadow on the planeMesh from the antenna I created. The antenna has shadows but it isn’t casted to the ground, I checked everything and I can’t find the solution.

Here’s my source code, thanks for helping : https://codepen.io/ads4/full/zYXmYJO

Have a nice day!

ShadowMaterial?

Add this:

renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;

and change some values for your shadow camera and light source:

const sun = new THREE.DirectionalLight(0xffffff, 4);
sun.position.set(-50, 75, -50); // lesser values
sun.castShadow = true;
sun.shadow.camera.near = 0.1;
sun.shadow.camera.far = 150; // greater value
scene.add(sun);

The result:

PS Next time try to use CameraHelper for shadow.camera to see, if objects are inside shadow camera’s frustum.

1 Like

Thank you, I also found that for larger maps : https://threejs.org/examples/#webgl_shadowmap_csm

Your solution works on the codepen but when I implement it to my real project it doesn’t render well, even after trying changing x y z of the light or the far value:

Like OrthographicCamera, shadow.camera has left, right, top and bottom properties.