THREE.meshphongmaterial Not Working - Giving Black Color

前端 未结 1 1608
一向
一向 2021-02-19 15:42

I am trying to use THREE.meshphongmaterial from this tutorial: http://solutiondesign.com/webgl-and-three-js-texture-mapping/

But it is not working and givi

1条回答
  •  温柔的废话
    2021-02-19 16:27

    Turns out it is necessary to add light. Without light, meshphongmaterial gives black color.

    So I had to add something like this:

    var light = new THREE.DirectionalLight( 0xffffff );
    light.position.set( 0, 1, 1 ).normalize();
    scene.add(light);
    

    Got it from this link: https://github.com/mrdoob/three.js/issues/2766

    0 讨论(0)
提交回复
热议问题