Skip to main content
Version: Phaser v4.0.0

Types.Filters

BlockyConfig

<static> BlockyConfig

nametypeoptionaldescription
sizenumber | Phaser.Types.Math.Vector2LikeYesThe size of the blocks. If a number, it sets both x and y to the same value. If a Vector2Like, it sets x and y to the respective values.
offsetnumber | Phaser.Types.Math.Vector2LikeYesThe offset of the blocks. If a number, it sets both x and y to the same value. If a Vector2Like, it sets x and y to the respective values.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/BlockyConfig.js#L1
Since: 4.0.0


GradientMapConfig

<static> GradientMapConfig

nametypeoptionaldefaultdescription
rampPhaser.Display.ColorRamp | Phaser.Types.Display.ColorBandConfigPhaser.Display.ColorBandArray.<(Phaser.Types.Display.ColorBandConfigPhaser.Display.ColorBand)>
ditherbooleanYesfalseWhether to dither the gradient output.
colorArray.<number>Yes"[0, 0, 0, 0]"Value to add to each channel.
colorFactorArray.<number>Yes"[0.3, 0.6, 0.1, 0]"Factor to apply to each channel. Try to keep them summing to 1.
unpremultiplybooleanYestrueWhether to unpremultiply color data before processing it.
alphanumberYes1How much of the effect to blend over the original.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/GradientMapConfig.js#L1
Since: 4.0.0


ImageLightConfig

<static> ImageLightConfig

nametypeoptionaldefaultdescription
normalMapstring | Phaser.Textures.TextureYes"'__NORMAL'"The texture to use for the ImageLight effect normal map. This should match the object being filtered. The default is flat lighting.
environmentMapstring | Phaser.Textures.TextureYes"'__WHITE'"The texture to use for the ImageLight effect environment map.
modelMatrixPhaser.Math.Matrix4YesThe initial model matrix. If not provided, a default matrix will be created.
modelRotationnumberYes0The initial rotation of the model in radians.
modelRotationSourcePhaser.GameObjects.GameObject | Phaser.Types.Filters.ImageLightSourceCallbacknullYesnull
bulgenumberYes0The amount of bulge to apply to the ImageLight effect. This distorts the surface slightly, preventing flat areas in the normal map from reflecting a single flat color. A value of 0.1 is often plenty.
colorFactorArray.<number>Yes"[1, 1, 1]"The color factor to apply to the ImageLight effect. This multiplies the intensity of the light in each color channel. Use values above 1 to substitute for high dynamic range lighting.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/ImageLightConfig.js#L1
Since: 4.0.0


ImageLightSourceCallback

<static> ImageLightSourceCallback

Type: function

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/ImageLightSourceCallback.js#L1
Since: 4.0.0


KeyConfig

<static> KeyConfig

nametypeoptionaldefaultdescription
colornumber | stringArray.<number>Phaser.Display.ColorYes
alphanumberYes1The amount of alpha to remove. This should be a value between 0 and 1, but you can go outside that range for different effects.
isolatebooleanYesfalseWhether to keep the region matching the key color. If true, the region matching the key color will be kept, and the rest will be removed. If false, the region matching the key color will be removed, and the rest will be kept.
thresholdnumberYes0.0625The threshold for the key color. A pixel is considered to be the key color if the difference between the pixel and the key color is less than the threshold. This should be a value between 0 and 1. The default threshold is 1 / 16, which is a good starting point for most images.
feathernumberYes0The feathering amount for the key color. Pixels outside the threshold, but still within the feather, will be a partial match. This should be a value between 0 and 1.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/KeyConfig.js#L1
Since: 4.0.0


NormalToolsConfig

<static> NormalToolsConfig

nametypeoptionaldefaultdescription
rotationnumberYes02D rotation of the normal map in radians. For more advanced controls, manipulate the filter's viewMatrix to control 3D rotation.
rotationSourcePhaser.GameObjects.GameObject | Phaser.Types.Filters.NormalToolsSourceCallbacknullYesnull
facingPowernumberYes1Manipulate the tendency for normals to face the camera. Higher values bend normals toward the camera; lower values bend them away. This can be useful for suggesting depth in a 2D scene.
outputRatiobooleanYesfalseIf true, the output will be a grayscale texture, with the white area being the areas where the normals are facing the camera, fading to black when they're orthogonal. This can be useful as a base for other effects.
ratioVectorPhaser.Math.Vector3Yes"[0, 0, 1]"The vector to use for the ratio output. This is the direction in which the ratio will be calculated. The default is the camera's forward direction. Manipulate this to highlight parts of the map which are facing in a specific direction. This is only used if outputRatio is true.
ratioRadiusnumberYes1How much of a hemisphere to consider for the ratio output. At 1, the ratio will be calculated for the entire hemisphere. At 0, the ratio will be calculated for a single point. This uses the same algorithm as PanoramaBlur.radius. This is only used if outputRatio is true.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/NormalToolsConfig.js#L1
Since: 4.0.0


NormalToolsSourceCallback

<static> NormalToolsSourceCallback

Type: function

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/NormalToolsSourceCallback.js#L1
Since: 4.0.0


PanoramaBlurConfig

<static> PanoramaBlurConfig

nametypeoptionaldefaultdescription
radiusnumberYes1The radius of the blur effect. 1 samples an entire hemisphere; 0 samples a single point.
samplesXnumberYes32The number of samples to take along the X axis. More samples produces a more accurate blur, but at the cost of performance. The X axis in a panorama is usually wider than the Y axis.
samplesYnumberYes16The number of samples to take along the Y axis. More samples produces a more accurate blur, but at the cost of performance.
powernumberYes1An exponent applied to samples. Power above 1 increases darkness, allowing brighter colors to dominate. Power below 1 increases brightness, reducing the influence of brighter colors. To simulate an HDR environment with bright sunlight that cannot be represented in sRGB color, use low power.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/PanoramaBlurConfig.js#L1
Since: 4.0.0


QuantizeConfig

<static> QuantizeConfig

nametypeoptionaldefaultdescription
stepsArray.<number>Yes"[ 8, 8, 8, 8 ]"Number of steps to use per channel.
gammaArray.<number>Yes"[ 1, 1, 1, 1 ]"Gamma power to apply per channel.
offsetArray.<number>Yes"[ 0, 0, 0, 0 ]"Offset to apply per channel.
ditherbooleanYesfalseWhether to dither the quantization.
modenumberYes0Color space mode. 0 is RGBA. 1 is HSVA. Use HSVA for better treatment of hues.

Type: object

Member of: Phaser.Types.Filters

Source: src/filters/typedefs/QuantizeConfig.js#L1
Since: 4.0.0