개발 · 컴퓨터공학
three.js PointLight와 SpotLight
막
2022. 10. 7. 12:16
728x90
반응형
https://threejs.org/docs/index.html?q=pointlight#api/en/lights/PointLight
three.js docs
threejs.org
PointLight는 특정 광원으로부터 전 방향으로 나아가는 light이다.
빛이 영향을 미치는 거리, 또한 거리에 따라 얼마나 어두워지는지 정도를 decay로 정할 수 있다.
const light = new THREE.PointLight('white', 1, 100, 2);
light.position.y = 3;
scene.add(light);
const lightHelper = new THREE.PointLightHelper(light);
scene.add(lightHelper);
PointLight의 생성자의 값들을 변경해보면서 테스트 해보자.
https://threejs.org/docs/index.html?q=spotlight#api/en/lights/SpotLight
three.js docs
threejs.org
const light = new THREE.SpotLight('white', 1, 30, Math.PI / 6);
light.position.x = -5;
light.position.y = 3;
scene.add(light);
const lightHelper = new THREE.SpotLightHelper(light);
scene.add(lightHelper);
원뿔 모양의 방향으로 빛이 나아가는 SpotLight의 경우 angle을 설정하여 각도를 설정할 수 있다.
728x90
반응형