MCPInstall

filters-and-postfx

Use this skill when applying visual filters or post-processing effects in Phaser 4. Covers bloom, blur, glow, color matrix, barrel distortion, displacement, custom shaders, and the filter pipeline. Triggers on: filter, post-processing, shader, bloom, blur, glow, color effects.

Installs
781
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/phaserjs/phaser --skill filters-and-postfx
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads filters-and-postfx automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Phaser 4 Filters and Post-FX

Quick Start

Add a glow effect to a sprite:

// In your Scene's create() method:
const sprite = this.add.sprite(400, 300, 'player');

// Step 1: Enable the filter system on the game object (WebGL only)
sprite.enableFilters();

// Step 2: Add filters via .filters.internal or .filters.external
sprite.filters.internal.addGlow(0xff00ff, 4, 0, 1);

Add a blur to the camera:

// Cameras have filters enabled by default - no enableFilters() needed
const camera = this.cameras.main;
camera.filters.internal.addBlur(0, 2, 2, 1);

Core Concepts

How Filters Work in v4

Filters are GPU-based post-processing effects applied after an object or camera renders to a texture. Each filter runs a shader pass over that texture, producing the final visual output. Filters are WebGL only.

The rendering pipeline for a camera with filters:

  1. Objects render to a texture the size of the camera.
  2. Internal filters process that texture, applying effects in object/camera local space.
  3. The texture is drawn to a context-sized texture, applying camera transformations (position, rotation, zoom).
  4. External filters process that context texture, applying effects in screen space.
  5. The final texture is composited into the output.

Internal vs External Filters

Every FilterList exposes two sub-lists: filters.internal and filters.external. The distinction controls when the filter runs relative to the camera/object transform:

  • Internal -- applied before the camera transform. Effects operate in the object's local coordinate space. A horizontal blur on a rotated object appears rotated with the object. Internal filters only cover the object/camera region, so they are cheaper.
  • External -- applied after the camera transform. Effects operate in screen space. A horizontal blur on a rotated object always blurs horizontally on screen. External filters are full-screen and more expensive.

Use internal filters wherever possible for better performance.

FilterList

FilterList (Phaser.GameObjects.Components.FilterList) is the container that holds filter controllers. It provides:

  • add(filter, index) -- add a Controller instance at an optional index
  • remove(filter, forceDestroy) -- remove and destroy a filter
  • clear() -- remove and destroy all filters
  • getActive() -- return all filters where active === true
  • list -- the raw array of Controllers (safe to reorder)
  • Convenience factory methods: addBlur(), addGlow(), addMask(), etc.

Filter Controllers

Every filter is a Phaser.Filters.Controller subclass. Common Controller properties:

PropertyTypeDescription
activebooleanToggle the filter on/off without removing it
cameraCameraThe camera that owns this filter
renderNodestringThe render node ID for the shader
paddingOverrideRectangleOverride automatic padding calculation
ignoreDestroybooleanIf true, the filter survives when its FilterList is destroyed (for reuse)

Key methods: setActive(bool), setPaddingOverride(left, top, right, bottom), getPadding(), destroy().

Enabling Filters on Game Objects

Cameras have filters available by default. Game objects do not -- you must call enableFilters() first:

const sprite = this.add.sprite(400, 300, 'hero');
sprite.enableFilters();

// Now sprite.filters is available
sprite.filters.internal.addGlow();
sprite.filters.external.addVignette();

enableFilters() creates an internal filterCamera on the game object that handles rendering the object to a texture for filter processing. It returns this for chaining.

Related properties on game objects after enabling:

PropertyDefaultDescription
filterCameranull -> CameraThe internal camera used for filter rendering
filtersnull -> {internal, external}Access to the FilterList pair
renderFilterstrueMaster toggle for all filter rendering
filtersAutoFocustrueAuto-adjust camera to follow the object
filtersFocusContextfalseFocus on the rendering context instead of the object bounds
filtersForceCompositefalseAlways draw to a framebuffer even with no active filters
maxFilterSizenull -> Vector2Maximum texture size for filter framebuffers

Use willRenderFilters() to check if any active filters will actually render.


Common Patterns

Adding Filters to Game Objects

const sprite = this.add.sprite(400, 300, 'enemy');
sprite.enableFilters();

// Add a glow
const glow = sprite.filters.internal.addGlow(0x00ff00, 4);

// Modify at runtime
glow.outerStrength = 8;
glow.color = 0xff0000;

// Temporarily disable
glow.setActive(false);

// Remove and destroy
sprite.filters.internal.remove(glow);

Camera Filters

const camera = this.cameras.main;

// Internal: effect in camera-local space
const blur = camera.filters.internal.addBlur(0, 2, 2, 1);

// External: effect in screen space
const vignette = camera.filters.external.addVignette(0.5, 0.5, 0.5, 0.5);

// Color grading via ColorMatrix
const cm = camera.filters.internal.addColorMatrix();
cm.colorMatrix.sepia();

Chaining Multiple Filters

Filters execute in list order. Each filter receives the output of the previous one:

const cam = this.cameras.main;

// First: apply color grading
const cm = cam.filters.internal.addColorMatrix();
cm.colorMatrix.brightness(0.2);

// Second: apply blur to the color-graded result
cam.filters.internal.addBlur(1, 2, 2, 1);

// Third: add a vignette on top
cam.filters.external.addVignette(0.5, 0.5, 0.5, 0.8);

Masks via Filters

Masks in v4 are implemented as filters. They use the alpha channel of a texture or game object to control visibility:

// Mask with a static texture
sprite.enableFilters();
sprite.filters.internal.addMask('maskTexture');

// Mask with a game object (renders to DynamicTexture automatically)
const maskShape = this.add.circle(0, 0, 100, 0xffffff);
sprite.enableFilters();
const mask = sprite.filters.internal.addMask(maskShape);

// Invert the mask
mask.invert = true;

// Control auto-updating for game object masks
mask.autoUpdate = true;  // default: re-renders each frame
mask.needsUpdate = true; // force a one-time update

// Use a specific camera for viewing the mask object
sprite.filters.external.addMask(maskShape, false, this.cameras.main);

Internal masks match the object being filtered. External masks match the camera context. Use a viewCamera parameter to control which camera renders the mask game object.

Wipe / Reveal Transitions

const camera = this.cameras.main;
const wipe = camera.filters.external.addWipe(0.1, 0, 0);

// Animate via tween
this.tweens.add({
    targets: wipe,
    progress: 1,
    duration: 2000,
    ease: 'Linear'
});

// Direction helpers
wipe.setLeftToRight();
wipe.setTopToBottom();
wipe.setRevealEffect();   // reveal mode
wipe.setWipeEffect();     // wipe mode

// Wipe to another texture (for scene transitions)
wipe.setTexture('nextSceneCapture');

ParallelFilters (Custom Bloom and Compositing)

ParallelFilters splits the input into two paths, processes each independently, then blends the results. This replaces the dedicated Bloom filter from v3:

const camera = this.cameras.main;
const pf = camera.filters.internal.addParallelFilters();

// Top path: threshold bright areas, then blur them
pf.top.addThreshold(0.5, 1);
pf.top.addBlur();

// Configure the blend (how top combines onto bottom)
pf.blend.blendMode = Phaser.BlendModes.ADD;
pf.blend.amount = 0.5;

// Bottom path: left empty = uses original input

CaptureFrame for Scene-Level Effects

CaptureFrame captures the current render state at the point it appears in the display list. Objects rendered before it are captured; objects after it are not:

// Requires composite mode on the camera
this.cameras.main.setForceComposite(true);

// Objects rendered before CaptureFrame are captured
const bg = this.add.image(400, 300, 'background');

// Create the capture point
const capture = this.add.captureFrame('myCapture');

// Display the captured texture with filters applied
const display = this.add.image(400, 300, 'myCapture');
display.enableFilters();
display.filters.internal.addBlur(0, 4, 4, 2);

All Built-in Filters

FilterAdd MethodDescription
BarreladdBarrel(amount)Pinch/expand distortion. amount=1 is neutral.
BlendaddBlend(texture, blendMode, amount, color)Blend another texture using a blend mode. Supports modes not available in standard WebGL.
BlockyaddBlocky(config)Pixelation that preserves original colors (no blending). Best without anti-aliasing.
BluraddBlur(quality, x, y, strength, color, steps)Gaussian blur. Quality: 0=low, 1=medium, 2=high.
BokehaddBokeh(radius, amount, contrast)Depth-of-field bokeh blur effect.
ColorMatrixaddColorMatrix()Color manipulation via matrix. Access .colorMatrix for sepia, grayscale, brightness, hue, etc.
CombineColorMatrixaddCombineColorMatrix(texture)Combine channels from two textures via color matrices. Useful for alpha transfer.
DisplacementaddDisplacement(texture, x, y)Pixel displacement using a displacement map texture. Values are very small floats (e.g. 0.005).
GlowaddGlow(color, outerStrength, innerStrength, scale, knockout, quality, distance)Luminous halo around edges. Supports inner/outer glow and knockout mode.
GradientMapaddGradientMap(config)Recolor image using a ColorRamp based on brightness.
ImageLightaddImageLight(config)Image-based lighting using a panorama environment map and normal map.
KeyaddKey(config)Chroma key: remove or isolate a specific color. Config: { color, threshold, feather, isolate }.
MaskaddMask(mask, invert, viewCamera, viewTransform, scaleFactor)Alpha masking via texture or game object.
NormalToolsaddNormalTools(config)Manipulate normal maps: rotate, adjust facing power, output grayscale facing data.
PanoramaBluraddPanoramaBlur(config)Spherically-correct blur for panorama images. For use with ImageLight. Very slow.
ParallelFiltersaddParallelFilters()Split input into two filter paths, blend results. Use for custom bloom.
PixelateaddPixelate(amount)Mosaic/pixelation effect. Pixel size = 2 + amount. Blends colors (unlike Blocky).
QuantizeaddQuantize(config)Reduce color palette. Supports RGBA/HSVA modes, gamma, offset, dithering.
SampleraddSampler(callback, region)Extract pixel data from the render. Does not alter the image. Expensive.
ShadowaddShadow(x, y, decay, power, color, samples, intensity)Drop shadow with offset, decay, and color.
ThresholdaddThreshold(edge1, edge2, invert)Binary threshold per channel. Edges can be arrays for per-channel control.
TiltShiftaddTiltShift(radius, amount, contrast, blurX, blurY, strength)Miniature/tilt-shift effect (uses Bokeh internally).
VignetteaddVignette(x, y, radius, strength, color, blendMode)Edge darkening/coloring. Supports NORMAL, ADD, MULTIPLY, SCREEN blend modes.
WipeaddWipe(wipeWidth, direction, axis, reveal, wipeTexture)Wipe/reveal transition. Animate progress via tween.

API Quick Reference

Enabling and Accessing Filters

// Game objects: must enable first
gameObject.enableFilters();
gameObject.filters.internal.addBlur();
gameObject.filters.external.addGlow();

// Cameras: filters available immediately
camera.filters.internal.addBlur();
camera.filters.external.addGlow();

FilterList Methods

const list = camera.filters.internal;

list.addBlur();                    // Factory method (one per filter type)
list.add(controllerInstance);      // Add a pre-built controller
list.add(controller, 2);           // Insert at index 2
list.remove(controller);           // Remove and destroy
list.clear();                      // Remove and destroy all
list.getActive();                  // Get all active controllers
list.list;                         // Raw array (reorder safely)

Controller Common API

controller.active = false;                  // Disable without removing
controller.setActive(true);                 // Enable (returns this)
controller.setPaddingOverride(10, 10, 10, 10); // Override padding
controller.setPaddingOverride(null);        // Clear override
controller.ignoreDestroy = true;            // Survive FilterList.destroy()
controller.destroy();                       // Manual cleanup

Mask Filter API

const mask = list.addMask('texKey');       // From texture key
const mask = list.addMask(gameObject);     // From game object
mask.invert = true;                         // Invert mask
mask.autoUpdate = false;                    // Stop auto-updating GO masks
mask.needsUpdate = true;                    // Force one update
mask.setTexture('newKey');                  // Change texture source
mask.setGameObject(newGO);                 // Change GO source
mask.viewCamera = otherCamera;             // Camera for GO rendering
mask.viewTransform = 'local';              // 'local' or 'world'
mask.scaleFactor = 0.5;                    // Scale mask texture size

ColorMatrix Presets

const cm = list.addColorMatrix();
cm.colorMatrix.sepia();
cm.colorMatrix.grayscale(1);
cm.colorMatrix.brightness(0.3);
cm.colorMatrix.hue(90);
cm.colorMatrix.saturate(-0.5);
cm.colorMatrix.contrast(0.3);
cm.colorMatrix.blackWhite();
cm.colorMatrix.negative();
cm.colorMatrix.desaturate();
cm.colorMatrix.night(0.5);
cm.colorMatrix.lsd();
cm.colorMatrix.brown();
cm.colorMatrix.vintagePinhole();
cm.colorMatrix.kodachrome();
cm.colorMatrix.technicolor();
cm.colorMatrix.polaroid();
cm.colorMatrix.shiftToBGR();

Gotchas

  1. WebGL only -- Filters do not work in Canvas renderer. enableFilters() returns early if WebGL is not available.

  2. enableFilters() required for game objects -- Cameras have filters by default. Sprites, images, containers, and other game objects require enableFilters() before accessing filters.

  3. Performance cost -- Each object with active filters creates extra draw calls (one for the base render plus one per active filter). Use sparingly and performance test early.

  4. Internal vs external matters -- Internal filters are cheaper (object-region sized). External filters are full-screen. A blur that should rotate with the object must be internal; a blur that should stay screen-aligned must be external.

  5. Filter order matters -- Filters are applied sequentially in list order. The output of one feeds into the next.

  6. Glow quality and distance are immutable -- quality and distance on the Glow filter cannot be changed after creation. Destroy and recreate the filter to change them.

  7. CaptureFrame requires forceComposite -- The camera must have setForceComposite(true) or otherwise render into a framebuffer for CaptureFrame to work.

  8. Padding for expanding effects -- Filters like Blur, Glow, and Shadow can automatically calculate padding to expand the render texture. Override with setPaddingOverride() if needed. Pass null to clear the override. When used on a camera, use camera.getPaddingWrapper(x) to render more world outside the image edge.

  9. Controller reuse -- By default, controllers are destroyed when their FilterList is destroyed. Set ignoreDestroy = true to reuse a controller across multiple objects, but you must manage its lifecycle manually. Works best with external filters.

  10. Mask game object rendering -- When using a game object as a mask source, it is rendered to a DynamicTexture each frame (if autoUpdate is true). Set autoUpdate = false and use needsUpdate = true for one-shot updates to improve performance for static masks.

  11. No Bloom filter -- v4 does not have a dedicated Bloom filter. Use ParallelFilters with Threshold + Blur + ADD blend instead (see Common Patterns), or use Phaser.Actions.AddEffectBloom to automate the process.


v4 Changes from v3

v3 (FX)v4 (Filters)Notes
gameObject.preFX / gameObject.postFXgameObject.filters.internal / gameObject.filters.externalpreFX/postFX replaced by internal/external filter lists
camera.postFXcamera.filters.internal / camera.filters.externalCameras now have both internal and external lists
FX.addBloom()Use ParallelFilters + Threshold + BlurNo dedicated Bloom filter; build it with ParallelFilters or Phaser.Actions.AddEffectBloom
FX.addCircle()Use Vignette or MaskCircle effect removed; use Vignette with radius or a circular Mask, or automate with Phaser.Actions.AddMaskShape
FX.addGradient()Use Gradient GameObject + QuantizeNew Gradient GameObject renders gradients; Quantize adds steps if wanted
Glow quality was 0-1 fractionGlow quality is an integer (default 10)Stochastic sampling replaces line sampling; higher quality at lower values
camera.setMask()camera.filters.internal.addMask()Masks are now filters, not a separate system
gameObject.setMask()gameObject.filters.internal.addMask()Same unified filter system
FX controllersPhaser.Filters.Controller subclassesSame pattern: returned controller objects with mutable properties
--enableFilters() required for game objectsNew explicit opt-in step for game objects
--Blocky, Quantize, Key, Blend, CombineColorMatrix, ImageLight, NormalTools, PanoramaBlur, ParallelFilters, SamplerNew filters added in v4

Source File Map

FileDescription
src/gameobjects/components/Filters.jsMixin that adds enableFilters(), filterCamera, filters to game objects
src/gameobjects/components/FilterList.jsFilterList class with all add*() factory methods
src/filters/Controller.jsBase Controller class for all filters
src/filters/Barrel.jsBarrel distortion filter
src/filters/Blend.jsTexture blend filter
src/filters/Blocky.jsColor-preserving pixelation filter
src/filters/Blur.jsGaussian blur filter
src/filters/Bokeh.jsBokeh / tilt shift filter
src/filters/ColorMatrix.jsColor matrix filter (sepia, grayscale, etc.)
src/filters/CombineColorMatrix.jsDual-texture channel combining filter
src/filters/Displacement.jsDisplacement map filter
src/filters/Glow.jsGlow/outline filter
src/filters/GradientMap.jsGradient map recoloring filter
src/filters/ImageLight.jsImage-based lighting filter
src/filters/Key.jsChroma key filter
src/filters/Mask.jsAlpha mask filter (texture or game object)
src/filters/NormalTools.jsNormal map manipulation filter
src/filters/PanoramaBlur.jsSpherical panorama blur filter
src/filters/ParallelFilters.jsParallel filter paths with blend
src/filters/Pixelate.jsPixelation filter
src/filters/Quantize.jsColor quantization filter
src/filters/Sampler.jsPixel sampling/readback filter
src/filters/Shadow.jsDrop shadow filter
src/filters/Threshold.jsThreshold filter
src/filters/Vignette.jsVignette filter
src/filters/Wipe.jsWipe/reveal transition filter
src/gameobjects/captureframe/CaptureFrame.jsCaptureFrame game object for scene-level capture

Related: sprites-and-images.md, cameras.md, v4-new-features.md

FAQ

What does the filters-and-postfx skill do?

Use this skill when applying visual filters or post-processing effects in Phaser 4. Covers bloom, blur, glow, color matrix, barrel distortion, displacement, custom shaders, and the filter pipeline. Triggers on: filter, post-processing, shader, bloom, blur, glow, color effects.

How do I install filters-and-postfx?

Run npx skills add https://github.com/phaserjs/phaser --skill filters-and-postfx in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/filters-and-postfx/ (personal) or .claude/skills/filters-and-postfx/ (project).

Which AI agents can use filters-and-postfx?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is filters-and-postfx safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains filters-and-postfx?

It is published by phaserjs in phaserjs/phaser. It has 781 recorded installs.

More from phaserjs/phaser

View all →

game-setup-and-config

phaserjs/phaser

Use this skill when creating a new Phaser 4 game instance or configuring GameConfig options. Covers renderer selection, canvas setup, scaling, pixel art, FPS settings, boot sequence, and all config sub-objects. Triggers on: new Phaser.Game, GameConfig, game setup, renderer, pixel art, FPS.

Media & Creative1.2K installs

sprites-and-images

phaserjs/phaser

Use this skill when creating Sprites or Images in Phaser 4. Covers factory methods, texture/frame selection, position, scale, rotation, tint, flip, alpha, origin, depth, and the component mixin system. Triggers on: Sprite, Image, this.add.sprite, this.add.image, texture, setTint, setAlpha.

Media & Creative1.1K installs

animations

phaserjs/phaser

Use this skill when creating or controlling sprite animations in Phaser 4. Covers spritesheets, atlases, AnimationManager, AnimationState, play/stop/chain, frame callbacks, and animation events. Triggers on: sprite animation, spritesheet, play animation, animation frames.

Frontend & Design1.1K installs

tilemaps

phaserjs/phaser

Use this skill when working with tilemaps in Phaser 4. Covers loading Tiled JSON maps, creating tilemap layers, tile collision, dynamic tiles, tile properties, and tilemap camera culling. Triggers on: Tilemap, Tiled, tilemap layer, tile collision, tile properties.

972 installs

v4-new-features

phaserjs/phaser

Use this skill when learning about new features, game objects, components, and rendering capabilities added in Phaser 4. Covers Filters, RenderNodes, CaptureFrame, Gradient, Noise, SpriteGPULayer, TilemapGPULayer, Lighting component, RenderSteps, and new tint modes. Triggers on: new in v4, Phaser 4 features, RenderNode, SpriteGPULayer, CaptureFrame, Gradient game object, Noise game object, new tint modes. For migrating v3 code to v4, see the v3-to-v4-migration skill instead.

Media & Creative965 installs

scenes

phaserjs/phaser

Use this skill when working with Phaser 4 scenes. Covers scene lifecycle methods, scene transitions, parallel scenes, scene communication, sleeping, pausing, restarting, and the SceneManager. Triggers on: Scene, scene lifecycle, preload, create, update, scene transition, SceneManager.

956 installs

Popular other skills

View category →

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.3M installs

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1M installs

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

778.4K installs

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

508.9K installs

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

459.7K installs

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

447.9K installs