Detuned
Detuned

Reputation: 3758

Change the shadow color to any other color in THREE?

It this possible? If so, I can't seem to locate any documentation around it.

Upvotes: 2

Views: 2796

Answers (3)

swatchai
swatchai

Reputation: 18812

Adding ambient light can lighten the color of the shadows. It illuminates all the objects in the scene including the shadows.

// Create an ambient light, and set its intensity
const ambientLight = new THREE.AmbientLight(0xFFFFFF);
ambientLight.intensity = 0.5;// max=1

...

// Add the ambient light to the scene
scene.add(ambientLight);

...

Try experimenting with different values to get the desired effects. You may need to adjust the intensity of your light source to get the best result.

Upvotes: 0

Davorama
Davorama

Reputation: 76

Yes, alter the color of your shadow plane's material. I needed a slightly blue-ish tint to my shadows so used something like this:

var material = new THREE.ShadowMaterial({opacity: .7, color: '#003'});

Upvotes: 0

Martin Schuhfuß
Martin Schuhfuß

Reputation: 6986

You can do that to a limited amount by using a THREE.ShadowMaterial for the objects receiving the shadow. You might need to have a separate renderpass for shadow-rendering though. See here for an example:

https://codepen.io/usefulthink/pen/JrZOPw

Upvotes: 3

Related Questions