PokéRogue
    Preparing search index...

    The Blur Filter Controller.

    This filter controller manages a blur effect.

    A Gaussian blur is the result of blurring an image by a Gaussian function. It is a widely used effect, typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a smooth blur resembling that of viewing the image through a translucent screen, distinctly different from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination.

    This effect samples across an area. To avoid missing data at the edges, use controller.setPaddingOverride(null) to automatically pad game objects, or camera.getPaddingWrapper(x) to enlarge a camera.

    A Blur effect is added to a Camera via the FilterList component:

    const camera = this.cameras.main;

    camera.filters.internal.addBlur();
    camera.filters.external.addBlur();

    Hierarchy (View Summary)

    Index
    • Parameters

      • camera: Camera

        The Camera that owns this filter.

      • Optionalquality: number

        The quality of the blur effect. Can be either 0 for Low Quality, 1 for Medium Quality or 2 for High Quality. Default 0.

      • Optionalx: number

        The horizontal offset of the blur effect. Default 2.

      • Optionaly: number

        The vertical offset of the blur effect. Default 2.

      • Optionalstrength: number

        The strength of the blur effect. Default 1.

      • Optionalcolor: number

        The color of the blur, as a hex value. Default 0xffffff.

      • Optionalsteps: number

        The number of steps to run the blur effect for. This value should always be an integer. Default 4.

      Returns Blur

    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.

    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.

    color: number

    The color of the blur effect, as a packed RGB hex integer (e.g. 0xff0000 for red). This tints the blur samples, allowing colored bloom-style effects. Defaults to white (0xffffff), which produces a neutral blur with no tint.

    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.

    glcolor: number[]

    The internal gl color array.

    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.

    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.

    quality: number

    The quality of the blur effect.

    This can be:

    0 for Low Quality 1 for Medium Quality 2 for High Quality

    The higher the quality, the more complex the shader used, and the more processing time is spent on the GPU calculating the final blur. This value is used in conjunction with the steps value, as one has a direct impact on the other.

    Keep this value as low as you can, while still achieving the desired effect you need for your game.

    renderNode: string

    The ID of the RenderNode that this filter uses.

    steps: number

    The number of steps to run the Blur effect for.

    This value should always be an integer.

    The higher the value, the smoother the blur, but at the cost of exponentially more gl operations.

    Keep this to the lowest possible number you can have it, while still looking correct for your game.

    strength: number

    The strength of the blur effect. This value is multiplied with the x and y offsets and the number of steps to determine the total blur radius. Increase this to make the blur more pronounced without changing the quality or step count.

    x: number

    The horizontal offset of the blur effect. This controls the distance between blur sample points along the x axis. A larger value increases the spread of the blur horizontally.

    y: number

    The vertical offset of the blur effect. This controls the distance between blur sample points along the y axis. A larger value increases the spread of the blur vertically.

    • Destroys this Controller and nulls any references it holds.

      Returns void

    • Returns the amount of extra padding, in pixels, that this filter requires when rendering. This accounts for the blur radius extending beyond the original bounds of the filtered Game Object.undefined

      Returns Rectangle

      The padding Rectangle.

    • 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