Three.js导入obj不正确的阴影渲染

时间:2015-07-27 13:33:44

标签: javascript three.js shadow .obj

我从blender导入了一个对象,设置它的每个网格以投射和接收阴影,但渲染的阴影不正确。我还合并了对象的网格,认为这将解决问题,但结果是一样的。 当使用side:THREE.DoubleSide时,问题似乎得到解决,但这会使材料变暗。

LIGHT SETTINGS

light = new THREE.DirectionalLight( 0x666666, 1 );
light.position.set(  2*400, 2*300.75, 2*400);
light.position.multiplyScalar( 1.3 );
light.castShadow=true;
light.shadowMapWidth = 2048;
light.shadowMapHeight =2048;
var d = 1300;
light.shadowCameraLeft = -d;
light.shadowCameraRight = d;
light.shadowCameraTop = d;
light.shadowCameraBottom = -d;

light.shadowCameraFar = 10000;
light.shadowBias = 0.0001;
light.shadowDarkness = 0.5;

材料设置

var childTilesTexture = THREE.ImageUtils.loadTexture('texture/wood_t.jpg?v1');
childTilesTexture.wrapS = childTilesTexture.wrapT = THREE.RepeatWrapping;
child.material = new THREE.MeshPhongMaterial( { map:childTilesTexture, shininess:5, metal: false} );

截图

http://i.stack.imgur.com/bsKnU.jpg

另一次放映

如您所见,手柄正在通过对象框投射阴影。

http://i.stack.imgur.com/aLMgL.jpg

1 个答案:

答案 0 :(得分:0)

属性shadowBias可用于解决自我遮蔽问题。尝试改变它。

尝试小的负值和小的正值。

three.js r.71