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
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
Scope: static
Extends
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:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.Blend | No | The filter controller providing the blend texture. |
| textures | Array.<WebGLTexture> | No | The texture array to populate. Index 1 is set to the blend texture. |
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The 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, where0shows only the main textureand
1applies the full blend effect. -
color— a tint color applied to the blend texture during compositing.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.Blend | No | The filter controller providing uniform values. |
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The 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:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.Blend | No | The filter controller providing the blend mode. |
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#updateShaderConfig
Source: src/renderer/webgl/renderNodes/filters/FilterBlend.js#L72
Since: 4.0.0