Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

have no light on my three.js scene

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 :(

like image 716
user1128677 Avatar asked Dec 09 '22 15:12

user1128677


1 Answers

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

like image 197
WestLangley Avatar answered Feb 05 '23 19:02

WestLangley