Filters, sometimes called shaders allows us to use our Graphics Cards to create special visual effects.
PixelPAD2D gives us access to a collection of filters that we can use. To use them you just need to add them
to a GameObject, or the Game object itself.
add_filter(obj: GameObject, filter : Filter) -> filter id
Example
Description
Adds a filter to a game object, or globally if set to the Game object.
Parameters
obj The game object to apply the filter on. You may also use the game object, which applies the filter globally
filter The filter to use. For example, you can create a new glow filter by calling new_glow_filter()
This filter allows you to add bloom to the GameObject's sprite. Bloom is an effect to make the sprite
look more like it would if taken by a real world camera.
Parameters
filterSettings A dictionary that holds the filter's configuration.
filterSettings["threshold"] The threshold of brightness at which bloom will start appearing. Default: 0.5
filterSettings["bloomScale"] The intensity of the effect. Default: 1.0
filterSettings["brightness"] How bright the bloom effect will be. Default: 1.0
filterSettings["blur"] The amount to blur the bloom. Default: 8
filterSettings["quality"] quality of the blur Default: 4
filterSettings["kernels"] the kernels of the blur Default: null
filterSettings["pixelSize"] The pixel size of the Blur Default: 1
filterSettings["resolution"] The resolution of the Blur. Default: Resolution of canvas
Embossing is a computer graphics technique. Each pixel of the GameObject's sprite is exchanged with a shadow or highlight.
Parameters
filterSettings A dictionary that holds the filter's configuration.
filterSettings["slices"] The maximum number of slices. Default: 5
filterSettings["offset"] The maximum offset amount of slices. Default: 100
filterSettings["direction"] The angle in degree of the offset of slices. Default: 0
filterSettings["fillMode"] The fill mode of the space after the offset. Acceptable values: 1,2,3,4,5 Default: 0
filterSettings["seed"] A seed value for randomizing glitch effect. Default: 0
filterSettings["average"] true will divide the bands roughly based on equal amounts where as setting to false will vary the band sizes dramatically (more random looking). Default: False
filterSettings["minSize"] Minimum size of individual slice. Segment of total sampleSize Default: 8
filterSettings["sampleSize"] The resolution of the displacement map texture. Default: 512
filterSettings["red"] Red offset Default: [0,0]
filterSettings["green"] Green offset Default: [0,0]
filterSettings A dictionary that holds the filter's configuration.
filterSettings["sepia"] The amount of saturation of sepia effect, a value of 1 is more saturation and closer to 0 is less, and a value of 0 produces no sepia effect Default:0.3
filterSettings["noise"] Opacity/intensity of the noise effect between 0 and 1 Default:0.3
filterSettings["noiseSize"] The size of the noise particles Default:1.0
filterSettings["scratch"] How often scratches appear Default:0.5
filterSettings["scratchDensity"] The density of the number of scratches Default:0.3
filterSettings["scratchWidth"] The width of the scratches Default:1.0
filterSettings["vignetting"] The radius of the vignette effect, smaller values produces a smaller vignette Default:0.3
filterSettings["vignettingAlpha"] Amount of opacity of vignette Default:1.0
filterSettings["vignettingBlur"] Blur intensity of the vignette Default:0.3
filterSettings A dictionary that holds the filter's configuration.
filterSettings["thickness"] The tickness of the outline. Default:1
filterSettings["color"] The color of the outline. Default:0x000000
filterSettings["quality"] The quality of the outline from 0 to 1, using a higher quality setting will result in slower performance and more accuracy. Default:0.1