PokéRogue
    Preparing search index...

    The CombineColorMatrix Filter controller.

    This filter combines color channels from two textures: a base input and a secondary transfer texture. Each source is transformed independently by its own ColorMatrix (colorMatrixSelf and colorMatrixTransfer), and the results are then blended per-channel using configurable addition weights (additions) and multiplication weights (multiplications). This makes it suitable for a wide range of compositing effects, though its primary use is alpha channel manipulation — for example, using a greyscale transfer texture as a soft mask or applying a brightness-derived alpha to the base image. Use setupAlphaTransfer to configure the matrices and weights for common alpha-transfer patterns, or set the colorMatrixSelf, colorMatrixTransfer, additions, and multiplications properties directly for custom effects.

    A CombineColorMatrix filter is added to a Camera via the FilterList component:

    const camera = this.cameras.main;
    camera.filters.internal.addCombineColorMatrix();
    camera.filters.external.addCombineColorMatrix();

    Hierarchy (View Summary)

    Index
    • Parameters

      • camera: Camera

        The camera that owns this filter.

      • Optionaltexture: string | Texture

        The texture or texture key to use for the transfer texture. Default '__WHITE'.

      Returns CombineColorMatrix

    active: boolean

    Toggle this boolean to enable or disable this filter, without removing it from and re-adding it to the Camera's filter list.

    additions: number[]

    Weight of addition for each channel (R, G, B, A). The final output includes values from the self and transfer matrices added together; those values are multiplied by this array. So values of 1 are kept, while values of 0 are discarded.

    By default, RGB values are added together in the final output.

    allowBaseDraw: boolean

    If true, this filter will be permitted to draw to the base texture. This can be unwanted if, for example, the filter doesn't actually draw anything.

    This is an internal flag used by the renderer. You should not modify this value directly.

    camera: Camera

    A reference to the Camera that owns this filter.

    colorMatrixSelf: ColorMatrix

    The color matrix which contributes values from the base input.

    colorMatrixTransfer: ColorMatrix

    The color matrix which contributes values from the transfer texture.

    currentPadding: Rectangle

    The padding currently being used by this filter. This is read during rendering via getPadding, and may be updated by subclass implementations. It is necessary for filters being used in an external list. You should not modify this value directly.

    The transfer texture used to provide extra channels.

    ignoreDestroy: boolean

    Whether this filter controller will be destroyed when the FilterList that owns it is destroyed. If you enable this, you must ensure that you clean up the filter controller at an appropriate time. This allows you to reuse a controller for multiple objects; this is not recommended unless you know what you're doing. It tends to work best with external filters.

    multiplications: number[]

    Weight of multiplication for each channel (R, G, B, A). The final output includes values from the self and transfer matrices multiplied together; those values are multiplied by this array. So values of 1 are kept, while values of 0 are discarded.

    By default, alpha values are multiplied together in the final output.

    paddingOverride: Rectangle

    Padding override. This is on by default. If this is set, the filter will use this padding instead of calculating it. Prefer using setPaddingOverride instead of modifying this directly.

    renderNode: string

    The ID of the RenderNode that this filter uses.

    • Destroys this filter, releasing all references and resources.

      Returns void

    • Returns the raw padding required for this filter. This is typically not what you want to call; use getPaddingCeil instead. Values from this method are not rounded, which can cause quality loss.

      Override this method when creating a Filter that requires extra room, e.g. a blur or glow effect.undefined

      Returns Rectangle

      The padding required by this filter.

    • Returns the rounded padding required for this filter.

      Most filters don't need extra padding, but some may sample beyond the texture boundaries, such as a blur or glow effect.

      The bounds are encoded as a Rectangle. To enlarge the bounds, the top and left values should be negative, and the bottom and right values should be positive.

      This method calls getPadding() to get the raw padding values, and uses Math.ceil() to set the values of paddingOverride and currentPadding.undefined

      Returns Rectangle

      The rounded padding required by this filter.

    • Sets the active state of this filter.

      A disabled filter will not be used.

      Parameters

      • value: boolean

        true to enable this filter, or false to disable it.

      Returns this

      This filter instance.

    • Sets the padding override. If this is set, the filter will use this padding instead of calculating it. Call setPaddingOverride(null) to clear the override. Call setPaddingOverride() to set the padding to 0.

      Parameters

      • Optionalleft: number | null

        The left padding. Default 0.

      • Optionaltop: number

        The top padding. Default 0.

      • Optionalright: number

        The right padding. Default 0.

      • Optionalbottom: number

        The bottom padding. Default 0.

      Returns void

    • Set the transfer texture. This is used as an extra channel source, transferring its data into the filtered image.

      Parameters

      • texture: string | Texture

        The texture or texture key to use for the transfer texture.

      Returns this

      This filter instance.

    • Resets both color matrices and the additions and multiplications weighting arrays, then applies a preset configuration for alpha transfer — a common use case for this filter. In the preset, RGB channels are combined by addition and the alpha channel is combined by multiplication. The boolean parameters control which color and brightness-to-alpha transformations are applied to each source before blending.

      Parameters

      • OptionalcolorSelf: boolean

        Whether to keep color from the base image.

      • OptionalcolorTransfer: boolean

        Whether to keep color from the transfer texture.

      • OptionalbrightnessToAlphaSelf: boolean

        Whether to determine the base alpha from the base brightness.

      • OptionalbrightnessToAlphaTransfer: boolean

        Whether to determine the transfer alpha from the transfer brightness.

      • OptionalbrightnessToAlphaInverseSelf: boolean

        Whether to determine the base alpha from the base brightness, inverted. This overrides brightnessToAlphaSelf.

      • OptionalbrightnessToAlphaInverseTransfer: boolean

        Whether to determine the transfer alpha from the transfer brightness, inverted. This overrides brightnessToAlphaTransfer.

      Returns this

      This filter instance.