yaku
yaku

Reputation: 3111

Customizing shadow color

Is it possible to specify other colors than black for shadow rendering? I would like to allow users to experiment both with light and shadow colors, eg. using complementary colors in light/shadow.

Here's how I setup other shadow settings, and it works perfect. But I found no way to make shadows other than black / different shades of gray.

this._sun_light = new THREE.DirectionalLight(0xffffff, 1);
...
this._sun_light.intensity = this.getParameter("sun_intensity");
this._sun_light.color.setHex(this.getParameterColorHex("sun_color"));
...
this._sun_light.shadowDarkness = this.getParameter("sun_shadow_intensity");
...

I found some references to shadowColor variable in three.js\src\renderers\WebGLShaders.js , but understanding that file is way out of my mental capabilities, and couldn't find a way to configure it. Is this even possible considering the shadow mapping technique?

Only workaround I could think of is having other light from the opposite direction illuminating the shadowed areas, and getting kind of canceled by the mainlight outside shadow area. But that could soon get messy when I start adding more lights, if it worked at all..

Upvotes: 1

Views: 2155

Answers (1)

Paul Kaplan
Paul Kaplan

Reputation: 2885

The shadowColor variable is just set to 1 in the beginning and if shadows are enabled it gets darker and darker depending on the position. This value gets multiplied by the final color value in the end, so if it is still 1 nothing changes, but if it is less than 1 it makes the final color darker. So there is no way to set the color of the shadow.

Upvotes: 1

Related Questions