Shadow problem with env map

When adding env map, there is no shadow in the object; how can i solve this problem;

Screenshot_1

loader code

Blockquote
var loader = new GLTFLoader( );
var a=‘models/xx.glb’;
//loader.crossOrigin = ‘’;
loader.load(a, function ( gltf ) {

					editor.clear();
				 const color = 0xFFFFFF;
const intensity = 1;
const light = new THREE.DirectionalLight(color, intensity);
light.castShadow = true;
light.position.set(0, 10, 0);
light.target.position.set(-4, 0, -4);


	editor.execute( new AddObjectCommand( editor, light ) );
	
	editor.execute( new AddObjectCommand( editor, light.target ) );
	
	
					
					var scenek = gltf.scene;
				//scenek.scale.set(10,10,10);
				
					editor.addAnimation( scenek, gltf.animations );
				editor.execute( new AddObjectCommand( editor, scenek ) );
					
				scenek.receiveShadow=true;
				scenek.castShadow=true;

scenek .traverse( ( child ) => {
if ( child instanceof THREE.Mesh ) {
child.material.emissiveIntensity = 2;
//console.log(child.material);
child.castShadow = true;

child.receiveShadow = true
}

});

				} );

Example link: https://pirega.com/demohane/three_master/editor/

Please explain in more detail the expected result. I’m afraid it’s not yet clear what you are looking for.

Screenshot_2

why there is no shadow in this part

Well, you need shadow casting lights in your scene e.g. a directional light. Environment maps do not cast shadows. Or in other words: They can be used in combination with shadow mapping.

2 Likes

Okey, thanks