When adding env map, there is no shadow in the object; how can i solve this problem;
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/