Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create very soft shadows in three.js?

is it possible to create a very soft / very subtle shadow in three.js? like on this pic? enter image description here

everything I managed to do so far is this:

enter image description here

My Lights:

hemisphereLight = new THREE.HemisphereLight(0xaaaaaa,0x000000, 0.9);
ambientLight = new THREE.AmbientLight(0xdc8874, 0.5);
shadowLight = new THREE.DirectionalLight(0xffffff, 1);
shadowLight.position.set(5, 20, -5);
shadowLight.castShadow = true;
shadowLight.shadowCameraVisible = true;
shadowLight.shadowDarkness = 0.5;
shadowLight.shadow.camera.left = -500;
shadowLight.shadow.camera.right = 500;
shadowLight.shadow.camera.top = 500;
shadowLight.shadow.camera.bottom = -500;
shadowLight.shadow.camera.near = 1;
shadowLight.shadow.camera.far = 1000;
shadowLight.shadowCameraVisible = true;
shadowLight.shadow.mapSize.width = 4096; // default is 512
shadowLight.shadow.mapSize.height = 4096; // default is 512

and render:

renderer.shadowMapEnabled = true;
renderer.shadowMapSoft = true;
renderer.shadowMapType = THREE.PCFSoftShadowMap;

thanks you

like image 851
chitzui Avatar asked Dec 18 '16 19:12

chitzui


People also ask

What produces soft shadow?

An area light is the most conceptually elegant source for soft shadows, because it is designed to closely resemble the effects of a larger light source in real life. As in real life, a larger light source, such as a fluorescent ceiling panel, casts softer shadows than a smaller light source, such as a bare light-bulb.

How are soft shadows achieved?

For the soft shadows, there are several ways to achieve this look. You can add more lights or bounce cards to your setup. However, the fastest and easiest way to soften your shadows is to soften your light by diffusing it.

Are soft shadows realistic?

Since all real light sources occupy an area or vol- ume, soft shadows are more realistic than hard shadows.

What is the difference between a hard shadow and soft shadow?

Hard and soft light are different types of lighting that are commonly used in photography and filmmaking. Soft light is light that tends to "wrap" around objects, projecting diffused shadows with soft edges, whereas hard light is more focused and produces harsher shadows.


1 Answers

You can soften shadows by setting radius like this:

var light = new THREE.PointLight(0xffffff, 0.2);
light.castShadow = true;
light.shadow.radius = 8;
like image 131
Slakinov Avatar answered Sep 28 '22 00:09

Slakinov