Tuesday, April 19, 2016

ThreeJS MeshPhongMaterial renders black (MeshLambertMaterial renders correctly)

Leave a Comment

Is there a solution to this problem? If I change my materialdefinition from MeshPhone to MeshLambert, everything works as expected, otherwise, it won't (but only on some computers, my dev machine works just fine).

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

The function 'loadDefaultMaterialForObject' in the 'MaterialConfService' is where this gets loaded.

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

Swapping out the 'MeshPhongMaterial' for a 'MeshLambertMaterial' works, but I need the phong for highlights.

Does anybody have a clue what might be going on here?

1 Answers

Answers 1

couldn't reproduce the error, but I would start here:

Try commenting out 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 can't cast shadows and causes errors

for more info see https://github.com/mrdoob/three.js/issues/1192

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment