Bloomエフェクトを追加します。
曝光度、背景色、閾値、強さ、半径を設定できます。
戻り値は、bloom のみのオブジェクトです。
戻り値の bloom は、animate の中で呼び出すことでエフェクトを適用します。
animate の第2引数を false にしてください。
Bloomエフェクトは、画面の全ての明るい部分をぼかして輝かせるエフェクトです。
そのため、背景画像に対しても効果があります。
もし個別のオブジェクトにだけBloomエフェクトを適用したい場合は、selectedBloomを使用してください。
const { camera, create, animate, postprocessing } = init()
camera.position.set(0, 0, 2)
create.ambientLight()
create.directionalLight()
const cube = create.cube()
const { bloom } = postprocessing.bloom()
animate(({ delta }) => {
cube.rotation.x += delta
cube.rotation.y += delta
bloom()
}, false)
const { camera, create, animate, postprocessing } = init()
camera.position.set(0, 0, 2)
create.ambientLight()
create.directionalLight()
const cube = create.cube()
const { bloom } = postprocessing.bloom()
animate(({ delta, time }) => {
cube.rotation.x += delta
cube.rotation.y += delta
bloom({
strength: 2 * Math.abs(Math.sin(time))
})
}, false)