reactjsthree.jsshadowlight

How To set Shadow(Light) using DirectioalLight on boxgeometry in threejs?


I am used Directionl light for shadow, But I need Light shadow not Dark. I am using this code : -

   this.root.remove(this.light.shadow.camera);    
   this.scene.remove(this.light);
   this.scene.remove(this.camera);
   this.light.position.set(0, minPosition, maxPosition);    
   this.light.castShadow = true;
   this.light.intensity = 1.6;
   this.light.shadow.camera.top = 16; // default
   this.light.shadow.camera.bottom = -6; // default
   this.light.shadow.camera.right = 10; // default
   this.light.shadow.camera.left = -10; // default
   cube.castShadow = true;
   this.light.shadow.transparent = true;
   this.light.target.position.add(this.scene.position);
   this.light.shadow.mapSize.width = 1024;
 this.light.shadow.mapSize.height = 1024;

[![BoxShadow][1]][1] [1]: https://i.sstatic.net/00byW.png


Solution

  • You can use "Hemishpere light " over the "Directional light" which will reduce the shadow intensity. You can refer to the three.js examples : https://threejs.org/examples/#misc_exporter_ply