我有一个球体内的物体。我想在物体上使用灯光,阴影应该显示在球体上。我使用SpotLight并检查但它没有用。建议我如何设置灯光以及哪种类型的灯光最适合阴影。 这是我的代码:
var group1 = new THREE.Group();
var obj = new THREE.Object3D();
var loader = new THREE.JSONLoader();
loader.load( 'obj.json', function ( geometry, materials ) {
var phongMaterials = materials.map( function ( material ) {
return new THREE.MeshPhongMaterial( {
color: new THREE.Color( material.color ),
shading: THREE.FlatShading,
shininess: 50,
//specular: 0xc00162
//wireframe: true
} )
} );
obj = new THREE.Mesh(
geometry,
new THREE.MeshFaceMaterial( phongMaterials )
);
obj.castShadow = true;
scene.add(obj);
group1.add( obj );
group1.position.set( 0, -180, -150 );
group1.rotation.set( 0, Math.PI/2, 0 );
group1.scale.set( 20, 20, 20 );
} );
scene.add( group1 );
//Sphere
group = new THREE.Group();
sphereMesh = new THREE.Group();
var material = new THREE.MeshPhongMaterial({
color : 0xffffff,
// emissive : 0xffffff,
transparent: true,
opacity : 0.5,
});
material.side = THREE.DoubleSide;
var icogeo = new THREE.IcosahedronGeometry(70,3);
icogeo.verticesNeedUpdate=true;
var sphere = new THREE.Mesh(icogeo, material);
sphere.receiveShadow = true;
group.add(sphere);
group.position.z=150;
scene.add(group);

答案 0 :(得分:0)
好的,以下是您应该看到的材料,以帮助您实现您想要做的事情,我的意思是: