如何在三个js中对完整对象应用阴影

时间:2014-06-26 08:28:00

标签: three.js

我想使用threejs在完整对象上应用阴影,如果我旋转对象阴影必须与对象一起使用,这意味着我想要为洞对象应用阴影,我尝试使用Spotlight,但是没有运气,我没有对我的对象进行任何更改,所以下面是我的代码

light = new THREE.SpotLight( 0xffffff );
light.position.set( 200, 200, -200 );
light.castShadow = true;
light.shadowMapWidth = 1024;    // power of 2
light.shadowMapHeight = 1024;

light.shadowCameraNear = 200;   // keep near and far planes as tight as possible
light.shadowCameraFar = 500;    // shadows not cast past the far plane
light.shadowCameraFov = 20;
light.shadowBias = -0.00022;    // a parameter you can tweak if there are artifacts
light.shadowDarkness = 0.5;

light.shadowCameraVisible = true;
scene.add( light ); 

1 个答案:

答案 0 :(得分:1)

您是否尝试在应呈现阴影的对象上设置object.receiveShadow = true;