矩形の領域で光るライトを作成してシーンに追加します。
rectAreaLightは、指定した位置と回転で矩形の領域で光るライトを作成します。
明るい窓や蛍光灯などの表現に利用できます。
このライトは、影を作成しません。
このライトは他のライトと比べて計算コストが高いので、大量に設置するとパフォーマンスが低下します。
ヘルパーを使うことで、ライト部分を可視化できます。
const { camera, controls, create, animate } = init()
controls.connect();
camera.position.set(0, 2, 3);
create.cube({
position: [0, 0.5, 0],
rotation: [0, Math.PI / 4, 0],
option: {
color: 0xffffff,
},
});
create.plane({
size: 10,
rotation: [-Math.PI / 2, 0, 0],
option: {
color: 0xffffff,
},
});
create.rectAreaLight({
intensity: 3,
color: 0xff0000,
size: [1, 2],
position: [1.5, 1, -1],
rotation: [0, (3 * Math.PI) / 4, 0],
helper: true,
});
create.rectAreaLight({
intensity: 3,
color: 0x0000ff,
size: [1, 2],
position: [-1.5, 1, -1],
rotation: [0, -(3 * Math.PI) / 4, 0],
helper: true,
});
animate();
const { camera, controls, create, animate } = init()
controls.connect();
camera.position.set(0, 2, 3);
create.cube({
position: [0, 0.5, 0],
rotation: [0, Math.PI / 4, 0],
option: {
color: 0xffffff,
},
});
create.plane({
size: 10,
rotation: [-Math.PI / 2, 0, 0],
option: {
color: 0xffffff,
},
});
create.rectAreaLight({
intensity: 3,
color: 0xff0000,
size: [1, 2],
position: [1.5, 1, -1],
rotation: [0, (3 * Math.PI) / 4, 0],
});
create.rectAreaLight({
intensity: 3,
color: 0x0000ff,
size: [1, 2],
position: [-1.5, 1, -1],
rotation: [0, -(3 * Math.PI) / 4, 0],
});
animate();