Skip to main content
Version: Phaser v4.0.0

FilterBlend

This RenderNode renders the Blend filter effect, compositing the main rendered texture with a secondary blend texture using a specified blend mode (such as Normal, Multiply, Screen, or Overlay). The active blend mode is injected into the fragment shader as a preprocessor define at draw time, allowing a single shader program to support multiple compositing algorithms via shader additions.

Use this RenderNode indirectly through the Phaser.Filters.Blend filter controller, which exposes the blend mode, blend texture, blend amount, and tint color as configurable properties.

See Phaser.Filters.Blend.

Constructor

new FilterBlend(manager)

Parameters

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader

Source: src/renderer/webgl/renderNodes/filters/FilterBlend.js#L14
Since: 4.0.0

Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

setupTextures

<instance> setupTextures(controller, textures, drawingContext)

Description:

Assigns the blend texture from the filter controller to texture slot 1. The main rendered texture occupies slot 0; slot 1 is the secondary texture that the fragment shader blends against using the active blend mode.

Parameters:

nametypeoptionaldescription
controllerPhaser.Filters.BlendNoThe filter controller providing the blend texture.
texturesArray.<WebGLTexture>NoThe texture array to populate. Index 1 is set to the blend texture.
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.

Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#setupTextures

Source: src/renderer/webgl/renderNodes/filters/FilterBlend.js#L99
Since: 4.0.0


setupUniforms

<instance> setupUniforms(controller, drawingContext)

Description:

Sets the WebGL uniforms required by the blend fragment shader:

  • uMainSampler2 — bound to texture unit 1 (the blend texture).

  • amount — the blend strength, where 0 shows only the main texture

    and 1 applies the full blend effect.

  • color — a tint color applied to the blend texture during compositing.

Parameters:

nametypeoptionaldescription
controllerPhaser.Filters.BlendNoThe filter controller providing uniform values.
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.

Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#setupUniforms

Source: src/renderer/webgl/renderNodes/filters/FilterBlend.js#L117
Since: 4.0.0


updateShaderConfig

<instance> updateShaderConfig(controller, drawingContext)

Description:

Updates the shader configuration to match the blend mode specified by the filter controller. The blend mode is resolved to its string name and injected into the fragment shader as a #define BLEND preprocessor directive via a tagged shader addition. If the controller specifies SKIP_CHECK, the blend mode falls back to NORMAL. If the blend mode is not found in the internal map, NORMAL is used as a safe default.

Parameters:

nametypeoptionaldescription
controllerPhaser.Filters.BlendNoThe filter controller providing the blend mode.
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.

Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#updateShaderConfig

Source: src/renderer/webgl/renderNodes/filters/FilterBlend.js#L72
Since: 4.0.0