File: DepthOfFieldNode.md | Updated: 11/15/2025
Post processing node for creating depth of field (DOF) effect.
References:
DepthOfFieldNode is an addon, and must be imported explicitly, see Installation#Addons.
import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js';
Constructs a new DOF node.
textureNode | The texture node that represents the input of the effect.
---|---
viewZNode | Represents the viewZ depth values of the scene.
focusDistanceNode | Defines the effect's focus which is the distance along the camera's look direction in world units.
focalLengthNode | How far an object can be from the focal plane before it goes completely out-of-focus in world units.
bokehScaleNode | A unitless value for artistic purposes to adjust the size of the bokeh.
A unitless value for artistic purposes to adjust the size of the bokeh.
How far an object can be from the focal plane before it goes completely out-of-focus in world units.
Defines the effect's focus which is the distance along the camera's look direction in world units.
The texture node that represents the input of the effect.
The updateBeforeType is set to NodeUpdateType.FRAME since the node updates its internal uniforms once per frame in updateBefore().
Default is 'frame'.
Overrides: TempNode#updateBeforeType
Represents the viewZ depth values of the scene.
Frees internal resources. This method should be called when the effect is no longer required.
Overrides: TempNode#dispose
Returns the result of the effect as a texture node.
Returns: A texture node that represents the result of the effect.
Sets the size of the effect.
width | The width of the effect.
---|---
height | The height of the effect.
This method is used to setup the effect's TSL code.
builder | The current node builder.
---|---
Overrides: TempNode#setup
This method is used to update the effect's uniforms once per frame.
frame | The current node frame.
---|---
Overrides: TempNode#updateBefore