Inheritance: Pass →
Pass for creating depth of field (DOF) effect.
const bokehPass = new BokehPass( scene, camera, {
focus: 500
aperture: 5,
maxblur: 0.01
} );
composer.addPass( bokehPass );
BokehPass is an addon, and must be imported explicitly, see Installation#Addons.
import { BokehPass } from 'three/addons/postprocessing/BokehPass.js';
Constructs a new Bokeh pass.
scene
The scene to render the DOF for.
camera
The camera.
params
The pass options.
The camera.
The pass bokeh material.
The scene to render the DOF for.
The pass uniforms. Use this object if you want to update the focus, aperture or maxblur values at runtime.
pass.uniforms.focus.value = focus;
pass.uniforms.aperture.value = aperture;
pass.uniforms.maxblur.value = maxblur;
Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app.
Overrides: Pass#dispose
Performs the Bokeh pass.
renderer
The renderer.
writeBuffer
The write buffer. This buffer is intended as the rendering destination for the pass.
readBuffer
The read buffer. The pass can access the result from the previous pass from this buffer.
deltaTime
The delta time in seconds.
maskActive
Whether masking is active or not.
Overrides: Pass#render
Sets the size of the pass.
width
The width to set.
height
The height to set.
Overrides: Pass#setSize
Constructor options of BokehPass.
focus
number
Defines the effect's focus which is the distance along the camera's look direction in world units.
Default is 1.
aperture
number
Defines the effect's aperture.
Default is 0.025.
maxblur
number
Defines the effect's maximum blur.
Default is 1.