have no light on my three.js scene

我与影子孤独终老i 提交于 2020-02-24 00:41:03

问题


i have a problem. i have wrote some code on three.js, it consists of scene, 2 objects, renderer and camera. but when i added the light i didnt see the it! i tried some options..but nothing helped me my code there - http://codepen.io/usf/pen/LaDwh

var light = new THREE.SpotLight(0xff0000);
light.position.set( 0, 0, 50 );

var pointLight = new THREE.PointLight( 0xffffff);
pointLight.position.set( 0, 0, 50 );

scene.add(light);
scene.add(pointLight);

//code
renderer.render(scene, camera);

i dont know, what caused that problem :(


回答1:


MeshBasicMaterial does not respond to lights. Change your material to MeshPhongMaterial, for example.



来源:https://stackoverflow.com/questions/16490619/have-no-light-on-my-three-js-scene

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!