对我的three.js场景没有任何启发 [英] have no light on my three.js scene
本文介绍了对我的three.js场景没有任何启发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在three.js上写了一些代码,它包括场景,2个对象,渲染器和相机。但当我添加光线时,我没有看到它!
i尝试了一些选项..但没有任何帮助我
我的代码 - 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);
//代码
renderer.render(场景,相机);
我不知道是什么导致了这个问题:(
解决方案
MeshBasicMaterial
不响应灯光。将材料更改为 MeshPhongMaterial $ c $例如,c>。
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 :(
解决方案
MeshBasicMaterial
does not respond to lights. Change your material to MeshPhongMaterial
, for example.
这篇关于对我的three.js场景没有任何启发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文