Lighting & Shadows
Good lighting makes the difference between a toy demo and a polished scene. A three-point rig — key, fill, rim — works as well in 3D as in photography.
Three-Point Light Rig
// Key light: main illumination
const keyLight = new THREE.DirectionalLight(0xffffff, 2);
keyLight.position.set(2, 4, 3);
scene.add(keyLight);
// Fill light: soften shadows
const fillLight = new THREE.DirectionalLight(0x8888ff, 0.5);
fillLight.position.set(-3, 1, 2);
scene.add(fillLight);
// Rim light: edge definition
const rimLight = new THREE.DirectionalLight(0xffffff, 1);
rimLight.position.set(0, 3, -4);
scene.add(rimLight);
// Ambient: baseline brightness
scene.add(new THREE.AmbientLight(0xffffff, 0.2));
Shadows
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
keyLight.castShadow = true;
mesh.castShadow = true;
// A plane to receive shadows
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(10, 10),
new THREE.ShadowMaterial({ opacity: 0.3 })
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -1;
floor.receiveShadow = true;
scene.add(floor);
What to Experiment With
- Raise/lower key light intensity
- Change fill light color to warm (0xffaa44) for sunset feel
- Try
SpotLightinstead ofDirectionalLightfor theatrical focus
좋은 조명이 장난감 데모와 완성도 높은 씬의 차이를 만듭니다. 3점 조명 — 키, 필, 림 — 은 3D에서도 사진처럼 잘 작동합니다.
3점 조명 리그
// 키 라이트: 주 조명
const keyLight = new THREE.DirectionalLight(0xffffff, 2);
keyLight.position.set(2, 4, 3);
scene.add(keyLight);
// 필 라이트: 그림자 완화
const fillLight = new THREE.DirectionalLight(0x8888ff, 0.5);
fillLight.position.set(-3, 1, 2);
scene.add(fillLight);
// 림 라이트: 엣지 정의
const rimLight = new THREE.DirectionalLight(0xffffff, 1);
rimLight.position.set(0, 3, -4);
scene.add(rimLight);
// 앰비언트: 기본 밝기
scene.add(new THREE.AmbientLight(0xffffff, 0.2));
그림자
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
keyLight.castShadow = true;
mesh.castShadow = true;
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(10, 10),
new THREE.ShadowMaterial({ opacity: 0.3 })
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -1;
floor.receiveShadow = true;
scene.add(floor);
실험해보기
- 키 라이트 강도를 올리고 내려보기
- 필 라이트 색상을 따뜻하게(0xffaa44) 변경해 석양 느낌
DirectionalLight대신SpotLight로 극적인 포커스 효과