Three.js 中的阴影:r71 与 r76 [英] Shadows in three.js : r71 vs r76
问题描述
我正在使用three.js 构建一个3D 环境,r76
.我似乎无法正确设置阴影.
在 r71
中,我对结果非常满意,但在 r76
中效果不一样.
说明我的问题的小提琴:
r71
:https://jsfiddle.net/sq2w15xy/>
r76
:https://jsfiddle.net/9uuq6s56/>
如您所见,最新版本中的阴影是黑色和像素化的.从那以后发生了什么变化?我该怎么做才能获得与 r71
相同的平滑阴影?
我想光的 shadow.mapSize 必须首先设置,否则默认设置为 ( 512, 512) .
spotlight.shadow.mapSize.width = 2048;聚光灯.shadow.mapSize.height = 2048;
I'm building a 3D environment using three.js , r76
.
I can't seem to get the shadows right.
In r71
, I was pretty happy with the result, but it doesn't work the same in r76
.
A fiddle to illustrate my problem:
r71
: https://jsfiddle.net/sq2w15xy/
r76
: https://jsfiddle.net/9uuq6s56/
As you can see, the shadow is black and pixelated in the newest revision.
What changed since then? What can I do the get the same smooth shadow as in r71
?
I suppose the light's shadow.mapSize must be set first as it's otherwise set to ( 512, 512) by default.
spotlight.shadow.mapSize.width = 2048;
spotlight.shadow.mapSize.height = 2048;
这篇关于Three.js 中的阴影:r71 与 r76的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!