在three.js中对象上的Janky阴影

时间:2015-04-22 20:47:28

标签: javascript three.js

我正在尝试平滑场景中物体上的阴影

这是一个img:https://imgur.com/UFXTxSG

和我的Github:https://github.com/mat148/shoeVR

以下是一些与阴影有关的代码:

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

firePillar.castShadow = true;
firePillar.receiveShadow = true;

var directionalLight = new THREE.DirectionalLight(0x007c9a, 0.5);
directionalLight.position.set(500, 704, 0);
directionalLight.castShadow = true;

1 个答案:

答案 0 :(得分:1)

阴影很难弄清楚。因为您需要考虑哪些网格正在创建阴影以及它们是否会接收阴影等等。

ShadowBias肯定是可以玩的。

尝试

renderer.shadowMapSoft = true;
//Your shadow casting light source
spotlight.castShadow = true;
spotlight.shadowBias = - 0.001;
// This increases the resolution of your Shadow maps. 
spotlight.shadowMapWidth = 2042;
spotlight.shadowMapHeight = 2042;