0

该模型在地平面上投射阴影,但它不接收来自前面另一个小平面的阴影(它确实在地平面上投射阴影),更不用说来自其自身了。有任何想法吗 ???

   var light = new THREE.DirectionalLight( 0xffefee, 1.2 );
   light.position.set( 0, 40, 100 );
   light.shadow.camera.left = -100; 
   light.shadow.camera.right = 100;
   light.shadow.camera.top = 100;
   light.shadow.camera.bottom = -100;
   light.shadow.camera.far = 1000;
   light.shadow.camera.near = 1;

   light.shadow.mapSize.width = 512;  
   light.shadow.mapSize.height = 512;

   light.castShadow = true;
   light.shadowDarkness = 0.5;

   renderer.shadowMap.enabled = true;
   renderer.shadowMap.type = THREE.PCFSoftShadowMap; 


    var femModel = null;  

    mtlLoader.setMaterialOptions({ side:THREE.DoubleSide });
    mtlLoader.load( 'female02.mtl', function( materials ) {     
    materials.preload();
    var objLoader = new THREE.OBJLoader();
    objLoader.setMaterials( materials );
    objLoader.setPath( 'female02/' );
    objLoader.load( 'female02.obj', function ( object ) {

        femModel = object; 

        femModel.position.set( 0, -80, 0 );
        sceneRTTA.add( femModel );
    }, onProgress, onError );

});

setup 函数在完全加载后调用:

function setupmodel(){
    femModel.traverse( function ( child ) {
        if ( child instanceof THREE.Mesh ) {
            child.castShadow = true;
            child.receiveShadow = true; 
        }   
    } );    
}

三.js 0.91.0

4

0 回答 0