Skip to main content
Version: Phaser v4.0.0

FilterCombineColorMatrix

A RenderNode that applies the Combine Color Matrix filter effect, as defined by Phaser.Filters.CombineColorMatrix.

This effect blends two independent color matrices: one applied to the game object itself (colorMatrixSelf) and one sourced from an external transfer texture (colorMatrixTransfer). Each matrix has its own alpha multiplier, and additional per-channel addition and multiplication values can be supplied to further adjust the final color output.

Use this filter when you need to composite or blend colour-grading from two separate sources in a single WebGL pass, for example combining a base desaturation pass with a tinted overlay texture.

Constructor

new FilterCombineColorMatrix(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/FilterCombineColorMatrix.js#L12
Since: 4.0.0

Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

setupTextures

<instance> setupTextures(controller, textures, _drawingContext)

Description:

Binds the transfer texture required by the shader.

Assigns the controller's pre-rendered GL texture to texture slot 1, which the fragment shader reads via the uTransferSampler uniform as the source for the transfer color matrix pass.

Parameters:

nametypeoptionaldescription
controllerPhaser.Filters.CombineColorMatrixNoThe filter controller providing the transfer GL texture.
texturesArray.<WebGLTexture>NoThe texture array used by the shader. The transfer texture is written to index 1.
_drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context (unused by this method).

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

Source: src/renderer/webgl/renderNodes/filters/FilterCombineColorMatrix.js#L42
Since: 4.0.0


setupUniforms

<instance> setupUniforms(controller, drawingContext)

Description:

Uploads all shader uniforms required by the Combine Color Matrix effect.

Sets the following uniforms on the active shader program:

  • uTransferSampler — texture unit index for the transfer texture.

  • uColorMatrixSelf — the 4×5 color matrix applied to the game object itself.

  • uColorMatrixTransfer — the 4×5 color matrix applied to the transfer texture.

  • uAlphaSelf — the global alpha multiplier for the self color matrix.

  • uAlphaTransfer — the global alpha multiplier for the transfer color matrix.

  • uAdditions — per-channel additive offsets applied after matrix multiplication.

  • uMultiplications — per-channel multiplicative factors applied after matrix multiplication.

Parameters:

nametypeoptionaldescription
controllerPhaser.Filters.CombineColorMatrixNoThe filter controller supplying color matrix data, alpha values, additions, and multiplications.
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.

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

Source: src/renderer/webgl/renderNodes/filters/FilterCombineColorMatrix.js#L60
Since: 4.0.0


Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:

From Phaser.Renderer.WebGL.RenderNodes.RenderNode: