Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用SpriteMaterial和方向光获得阴影_Javascript_Three.js - Fatal编程技术网

Javascript 如何使用SpriteMaterial和方向光获得阴影

Javascript 如何使用SpriteMaterial和方向光获得阴影,javascript,three.js,Javascript,Three.js,我的代码: 平行光: 雪碧: 结果是我的飞机有阴影,但没有精灵三个精灵中的精灵不投射阴影 一种解决方法是使用平面几何体,如下所示: scene.add( plane ); plane.lookAt( camera ); 注意:LookAt()如果平面是旋转对象的子对象,则无法正常工作;一定是现场的孩子 three.js r.74如果为精灵对象设置castShadow,我们是否可以为threejs添加警告?我认为最好在文档中添加一个符号。 var spriteMaterial = new THR

我的代码:

平行光: 雪碧:
结果是我的飞机有阴影,但没有精灵

三个精灵中的精灵不投射阴影

一种解决方法是使用
平面几何体
,如下所示:

scene.add( plane );
plane.lookAt( camera );
注意:
LookAt()
如果平面是旋转对象的子对象,则无法正常工作;一定是现场的孩子


three.js r.74

如果为精灵对象设置castShadow,我们是否可以为threejs添加警告?我认为最好在文档中添加一个符号。
var spriteMaterial = new THREE.SpriteMaterial({map: texture});
var info = new THREE.Sprite( spriteMaterial );
info.castShadow = true;
info.scale.set(infoScale, infoScale, infoScale);
info.name = continent.label;
info.userData.continent = continent;
info.userData.id = continent.id;
info.userData.type = 'info';
hubInfos.push(info);
scene.add( plane );
plane.lookAt( camera );