ThreeJS MeshPhongMaterial渲染黑色(MeshLambertMaterial渲染正确)

时间:2016-04-02 15:14:19

标签: three.js

这个问题有解决方法吗?如果我将我的materialdefinition从MeshPhone更改为MeshLambert,一切都按预期工作,否则,它不会(但只在某些计算机上,我的开发机器工作正常)。

http://peppr-configurator.herokuapp.com/#/

函数' loadDefaultMaterialForObject'在' MaterialConfService'是加载的地方。

var threeMaterial = new THREE.MeshPhongMaterial({
    specular: material.properties.specular,
    emissive: material.properties.emissive,
    shininess: material.properties.shininess,
});

更换“MeshPhongMaterial”'对于一个' MeshLambertMaterial'有效,但我需要phong才能突出亮点。

有没有人知道这里会发生什么?

1 个答案:

答案 0 :(得分:3)

无法重现错误,但我会从这里开始:

尝试注释掉light.castShadow = true:

  var pLight = new THREE.PointLight(0xffffff,0.25);
  //pLight.castShadow = true;
  pLight.position.set(50,100,50);
  _this.scene.add(pLight);

  var pLight02 = new THREE.PointLight(0xefeeeee,0.2);
  //pLight02.castShadow = true;
  pLight02.position.set(-50,100,50);
  _this.scene.add(pLight02);

  var pLight03 = new THREE.PointLight(0xffffff,0.2);
  //pLight03.castShadow = true;
  pLight03.position.set(0,75,-75);
  _this.scene.add(pLight03);  

THREE.PointLight无法投射阴影并导致错误

有关详细信息,请参阅https://github.com/mrdoob/three.js/issues/1192