Weird shadow lines on my terrain

Please have a look at this: Demo weird shadows

The shadows on the terrain have some sort of hard lines in them. Does anyone know how to get rid of them?

This is the setup of the light:

	// LIGHT

	scene.add( new THREE.AmbientLight( 0x222222 ) );
	var light = new THREE.DirectionalLight( 0xffffff, 1 );
    light.position.set(300, 400, 50);
    light.position.multiplyScalar(1.3);
	light.castShadow=true;

    light.castShadow = true;
    light.shadow.camera.visible = true;	
    var d = 200;
	light.shadow.darkness = 0.5;
    light.shadow.camera.left = -d;
    light.shadow.camera.right = d;
    light.shadow.camera.top = d;
    light.shadow.camera.bottom = -d;

    light.shadow.camera.far = 0;
    light.shadow.camera.far = 1000;
    


    light.shadow.mapSize.width = 2048;
    light.shadow.mapSize.height = 2048;
	
	scene.add( light );

And here are the settings of the terrain:

	terrainMaterial = new THREE.MeshPhongMaterial({
		map: grassTexture,
		normalMap:baseBump,

		metalness: 0.1,
		refractionRatio:0.1,
		color : 0xdddddd,
		side: 2,
		shininess: 0.5,
		
	});	
[...]
	var loader = new THREE.FBXLoader();
	loader.load( 'scene0-terrain.fbx', function ( object ) {
		
		plane=object.children[0];

		plane.castShadow = true;
		plane.receiveShadow = true;		
		
		plane.material=terrainMaterial;
		plane.position.set(0,0,0);
		plane.scale.set(1,1,1);

		scene.add( plane );

	} );

Please ignore the multi tiled texturing, when I remove it, the shadow problem stays…

The first thing I would try is to set plane.castShadow to false. Self-shadowing is tricky and sometimes the reason for shadow artifacts. Also try to decrease the frustum of the shadow camera. You achieve best shadow quality if the shadow casting light “follows” the player. Consider the light in this case more as a shadow projector.

3 Likes

That definitely was it! Now it looks so much better!