Capítulo 419 de 859

Chapter 419: GaussianBlurNode

Core Idea

Post processing node for creating a gaussian blur effect.

Key Concepts

  • directionNode : Node.<(vec2|float)>: Defines the direction and radius of the blur.
  • isGaussianBlurNode : boolean (readonly): This flag can be used for type testing.
  • premultipliedAlpha : boolean: Whether the effect should use premultiplied alpha or not. Set this to true if you are going to blur texture input with transparency.
  • resolution : Vector2: The resolution scale.
  • resolutionScale : number: The resolution scale.
  • sigma : number: Controls the kernel of the blur filter. Higher values mean a wider blur radius.
  • textureNode : TextureNode: The texture node that represents the input of the effect.
  • updateBeforeType : string: The updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().

Code Examples

import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';
  • What it demonstrates: Typical usage of GaussianBlurNode.

Reference Tables

Constructor

Signature
`new GaussianBlurNode( textureNode : TextureNode, directionNode : Node.<(vec2

Properties

PropertyDescription
`.directionNode : Node.<(vec2float)>`
.isGaussianBlurNode : boolean (readonly)This flag can be used for type testing.
.premultipliedAlpha : booleanWhether the effect should use premultiplied alpha or not. Set this to true if you are going to blur texture input with transparency.
.resolution : Vector2The resolution scale.
.resolutionScale : numberThe resolution scale.
.sigma : numberControls the kernel of the blur filter. Higher values mean a wider blur radius.
.textureNode : TextureNodeThe texture node that represents the input of the effect.
.updateBeforeType : stringThe updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().

Methods

MethodDescription
.dispose()Frees internal resources. This method should be called when the effect is no longer required.
.getTextureNode() : PassTextureNodeReturns the result of the effect as a texture node.
.setSize( width : number, height : number )Sets the size of the effect.
.setup( builder : NodeBuilder ) : PassTextureNodeThis method is used to setup the effect's TSL code.
.updateBefore( frame : NodeFrame )This method is used to render the effect once per frame.

Key Takeaways

  1. GaussianBlurNode extends: EventDispatcher → Node → TempNode
  2. Most relevant properties: directionNode, isGaussianBlurNode, premultipliedAlpha, resolution.
  3. Key methods: dispose, getTextureNode, setSize, setup.

Connects To