Hello guys, I am new to shadows and things so please dont eat me, but it seems like my GLTF object’s children simply do not block/cast shadows, pretty weird if you ask me.
Here’s my code:
renderer.shadowMap.enabled = true;
var light = new THREE.DirectionalLight(0xffffff);
light.castShadow = true;
light.shadowDarkness = 1;
renderer.shadowMapSoft = true;
light.shadowCameraNear = 2;
light.shadowCameraFar = 5;
light.shadowCameraLeft = -0.5;
light.shadowCameraRight = 0.5;
light.shadowCameraTop = 0.5;
light.shadowCameraBottom = -0.5;
scene.add(light);
light.position.x = 500;
&
var gltfloader = new GLTFLoader();
gltfloader.load("./maps/dd2fix/de_dust2.glb", function(object) {
var obj = object.scene;
scene.add(obj);
obj.castShadow = true;
obj.receiveShadow = true;
obj.scale.x = obj.scale.y = obj.scale.z = 0.175;
obj.traverse(function(child) {
if(child.isMesh) {
child.castShadow = true;
child.receiveShadow = true;
}
});
});
Lastly, here is what I get to see, when running this code:
- Very obvious here:
As you can see, both in the tunnel and the side of the stairs, they are lit like there is nothing in front of them.