In order to let all shadows be rendered, I set shadow.camera.top
/ bottom
/ left
/ right
to the directional light (casting shadow), but it causes shadow acne.
I try to use shadow.bias
but still not right. What causes shadow acne and how to fix it?
Here is my code.
light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 38, 82, 1 );
light.castShadow = true;
// light.shadow.bias = -0.001;
light.shadow.mapSize.width = 2048;
light.shadow.mapSize.height = 2048;
light.shadow.camera.near = 0.1; // same as the camera
light.shadow.camera.far = 1000; // same as the camera
light.shadow.camera.top = 120;
light.shadow.camera.bottom = -120;
light.shadow.camera.left = 120;
light.shadow.camera.right = -120;
scene.add( light );
Thanks!!
light.shadow.bias
does no help. BTW: The shadow camera does not have to use the samenear
andfar
values like the actual camera for rendering the scene. I suggest you useTHREE.CameraHelper
to visualize the shadow camera and make the frustum as tight as possible. You can create the helper like soscene.add( new THREE.CameraHelper( light.shadow.camera ) );
. – Set