Shadowplane abruptly stops in AR for very large shadows

I’m using a shadowplane in AR and it clips at a location I don’t understand. Works fine for small and human size models, but as soon as you make a large model that casts a big shadow, can immediately see where the shadowplane plane abruptly ends. I tried to change the camera.far and plane size values but always the same result. Is there a good solution for shadows in AR that works for small, medium, and very large meshes?

		this.directionalLight = new THREE.DirectionalLight();
		this.directionalLight.intensity = this.settings.directional_light_intensity;
		this.directionalLight.position.set(2,25,2);
		this.directionalLight.castShadow = true;
		this.directionalLight.shadow.camera.zoom = 2.0; //wtf does this do
		this.directionalLight.shadow.mapSize.width = 1024;
		this.directionalLight.shadow.mapSize.height = 1024;
		this.directionalLight.shadow.camera.near = 0.1; 
		this.directionalLight.shadow.camera.far = 500; 
		this.directionalLight.shadow.camera.fov = 45; 
		this.scene.add(this.directionalLight);
		var planeGeometry = new THREE.PlaneGeometry(500, 500);
		planeGeometry.rotateX(-Math.PI / 2);
		this.shadowplane = new THREE.Mesh(planeGeometry, new THREE.ShadowMaterial({ color:0x000000, opacity:this.settings.shadowplane_opacity }));
		this.shadowplane.receiveShadow = true;
		this.scene.add(this.shadowplane);

same lighting and shadow again, but different project, clipping on the shadowplane…

any idea what causes this?

This looks like the edge of the orthographic shadow camera frustum. You can try adjusting shadow.camera.left, right, top, and bottom to increase the bounds. You’ll need to call updateProjectionMatrix afterward, too.

3 Likes

bingo that’s it. thanks @gkjohnson

1 Like