3 Matching Annotations
  1. Feb 2024
    1. A loaded glTF asset does not cast shadows if you just set gltf.scene.castShadow to true. You have to do this for recursively for all meshes.
    2. You have not configured the shadow frustum for your instance of DirectionalLight correctly. Try it with this code: var dlight = new THREE.DirectionalLight( 0xaabbff, 0.3 ); dlight.position.x = 0; dlight.position.y = 750; dlight.position.z = 0; dlight.castShadow = true; dlight.shadow.camera.top = 2500; dlight.shadow.camera.bottom = - 2500; dlight.shadow.camera.left = - 2500; dlight.shadow.camera.right = 2500; dlight.shadow.camera.near = 1; dlight.shadow.camera.far = 1000; dlight.shadow.mapSize.set( 2048, 2048 );
    3. Since MeshBasicMaterial is an unlit material, it can't receive shadows. That means you should use e.g. MeshPhongMaterial for your tiles and floors otherwise you won't see any shadows.