2014-06-26 80 views
0

我想使用三維物體對完整物體應用陰影,如果我旋轉物體,陰影必須與物體相連,這意味着我要將孔洞物體應用於陰影,試圖與Spotlight,但沒有運氣我沒有得到我的對象上的任何變化,所以這裏下面是我的代碼如何將陰影應用於三維物體中的全部物體

light = new THREE.SpotLight(0xffffff); 
light.position.set(200, 200, -200); 
light.castShadow = true; 
light.shadowMapWidth = 1024; // power of 2 
light.shadowMapHeight = 1024; 

light.shadowCameraNear = 200; // keep near and far planes as tight as possible 
light.shadowCameraFar = 500; // shadows not cast past the far plane 
light.shadowCameraFov = 20; 
light.shadowBias = -0.00022; // a parameter you can tweak if there are artifacts 
light.shadowDarkness = 0.5; 

light.shadowCameraVisible = true; 
scene.add(light); 

回答

1

你有沒有嘗試設置上的陰影應該呈現的對象object.receiveShadow = true;

+0

no @ vincent,我必須在這裏設置?謝謝你的回答 –

+0

你必須在接受陰影的對象上設置這個屬性,就像我說的那樣。例如,您可以在創建對象後直接設置它。 – vincent

+0

它不起作用@vincent –