easy-three

create.hemisphereLight

create.hemisphereLight(props : Object) : Light

props - 設定オブジェクト。
  • skyColor (Hex) : 上部からのライトの色 (デフォルト : 0xeeddff)。
  • groundColor (Hex) : 下部からのライトの色 (デフォルト : 0x887777)。
  • intensity (Number) : 光の強さ (デフォルト : 0.5)。

半球光源を作成してシーンに追加します。

半球光源は、上部からの光と下部からの光を持つ光源です。
上部からの光は空の色を表し、下部からの光は地面からの反射光を表します。
環境光と同じくシーン全体を均一に照らすために使用されますが、上部と下部の光の色を別々に設定できる点が異なります。
半球光源では影は生成されません。

コードの例

半球光源

const { camera, create, animate } = init()
camera.position.set(0, 0, 2);

create.hemisphereLight({
  skyColor: 0x0000ff,
  groundColor: 0xff0000,
});

const cube = create.cube({
  option: {
    color: "#ffffff",
  }
})

animate(({ delta }) => {
  cube.rotation.x += delta;
  cube.rotation.y += delta;
});