Customizing shadow color

女生的网名这么多〃 提交于 2019-12-23 02:08:33

问题


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..


回答1:


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.



来源:https://stackoverflow.com/questions/13665657/customizing-shadow-color

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!