I've been trying to work with blender exported models in Three.js, and I'm at the point where I can import the model, and see how light affects the object itself. I can see a directionalLight I used highlighting what's facing it, but I cannot cast shadows at all.
Here's what I'm doing:
renderer.shadowMapEnabled = true;
renderer.shadowMapType = THREE.PCFSoftShadowMap;
(...)
var directionalLight = new THREE.DirectionalLight(0xffffff);
directionalLight.position.set(30,10,-10);
directionalLight.castShadow = true;
directionalLight.shadowDarkness = 0.5;
directionalLight.shadowCameraVisible = true;
directionalLight.shadowBias = 0.1;
directionalLight.shadowMapWidth = 1024;
directionalLight.shadowMapHeight = 1024;
directionalLight.shadowCameraRight = 10;
directionalLight.shadowCameraLeft = -10;
directionalLight.shadowCameraTop = 10;
directionalLight.shadowCameraBottom = -10;
directionalLight.shadowCameraFar = 10;
directionalLight.shadowCameraNear = 10;
scene.add(directionalLight);
var loader = new THREE.ObjectLoader();
loader.load( "island.json", function ( geometry ) {
islandMesh = geometry;
for(k in islandMesh.children-1){
islandMesh.children[k].castShadow = true;
islandMesh.children[k].receiveShadow = true;
}
islandMesh.castShadow = true;
islandMesh.receiveShadow = true;
scene.add( islandMesh );
render();
} );
But even with what I believe is the whole setup that allows me to cast shadows done, I cannot get any shadow to be cast. Here's a screenshot:
Even though the light is coming from the right of the island, the mountains are not casting the shadows I expected them to.
I really appretiate any time you spend looking at this!
Massive thanks in advance, guys!