PokéRogue
    Preparing search index...

    The Bokeh Filter Controller.

    This filter controller manages the bokeh effect for a Camera.

    Bokeh refers to a visual effect that mimics the photographic technique of creating a shallow depth of field. This effect is used to emphasize the game's main subject or action, by blurring the background or foreground elements, resulting in a more immersive and visually appealing experience. It is achieved through rendering techniques that simulate the out-of-focus areas, giving a sense of depth and realism to the game's graphics.

    This effect can also be used to generate a Tilt Shift effect, which is a technique used to create a miniature effect by blurring everything except a small area of the image. This effect is achieved by blurring the top and bottom elements, while keeping the center area in focus.

    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 Bokeh effect is added to a Camera via the FilterList component:

    const camera = this.cameras.main;

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

    Hierarchy (View Summary)

    Index
    • Parameters

      • camera: Camera

        The Camera that owns this filter.

      • Optionalradius: number

        The radius of the bokeh effect. Default 0.5.

      • Optionalamount: number

        The amount of the bokeh effect. Default 1.

      • Optionalcontrast: number

        The color contrast of the bokeh effect. Default 0.2.

      • OptionalisTiltShift: boolean

        Is this a bokeh or Tilt Shift effect? Default false.

      • OptionalblurX: number

        If Tilt Shift, the amount of horizontal blur. Default 1.

      • OptionalblurY: number

        If Tilt Shift, the amount of vertical blur. Default 1.

      • Optionalstrength: number

        If Tilt Shift, the strength of the blur. Default 1.

      Returns Bokeh

    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.

    amount: number

    The amount of the bokeh effect. This controls how many samples are taken during the blur pass. Higher values produce a denser, more pronounced bokeh at the cost of additional GPU work. This property applies to the standard bokeh effect only; use strength to adjust the intensity of a Tilt Shift effect.

    blurX: number

    If a Tilt Shift effect this controls the amount of horizontal blur.

    Setting this value on a non-Tilt Shift effect will have no effect.

    blurY: number

    If a Tilt Shift effect this controls the amount of vertical blur.

    Setting this value on a non-Tilt Shift effect will have no effect.

    camera: Camera

    A reference to the Camera that owns this filter.

    contrast: number

    The color contrast of the bokeh effect. This controls how strongly the out-of-focus areas differ in luminance from the in-focus areas. Higher values increase the brightness contrast between the bokeh highlights and their surroundings, making the effect more visually distinct.

    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.

    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.

    isTiltShift: boolean

    Is this a Tilt Shift effect or a standard bokeh effect?

    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.

    radius: number

    The radius of the bokeh effect.

    This is a float value, where a radius of 0 will result in no effect being applied, and a radius of 1 will result in a strong bokeh. However, you can exceed this value for even stronger effects.

    renderNode: string

    The ID of the RenderNode that this filter uses.

    strength: number

    If a Tilt Shift effect this controls the strength of the blur.

    Setting this value on a non-Tilt Shift effect will have no effect.

    • 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. The padding accounts for the bokeh effect extending beyond the original bounds of the filtered Camera.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