0
votes

I imported an object from blender, set every mesh of it to cast and receive shadows, but the shadows rendered are incorrect. I also merged the meshes of the object thinking this will resolve the problem, but the result is the same. The problem seems to be resolved when using side: THREE.DoubleSide, but that makes the materials darken.

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;

MATERIAL SETTINGS

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} );

SCREENSHOTS

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

ANOTHER SCREENSHOT

As you can see, the handles are casting a shadow through the object box.

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

1
can you pinpoint on your images where the problems are? - gaitat
what do you mean with 'shadows rendered are incorrect'? Show an example of that problems - Ale_32
Look at the images I linked (on the first mainly). The shadows on the back of the objects should be full, but as you can see, parts without shadow apear. The light is in front of the objects, so the back of them should be covered in shadow. Instead, you can see parts with light. - culeaalex
Try setting shadowBias to a small negative value. - WestLangley
@WestLangley: I set it to 0.0003 and works great! Post it as answer so others can view it properly :) - culeaalex

1 Answers

0
votes

The property shadowBias can be used to remedy self-shadowing problems. Try varying it.

Try both small negative values, and small positive values.

three.js r.71