actions-and-utilities
Use this skill when working with Phaser 4 utility functions, actions, alignment, grid layout, or batch operations on game objects. Triggers on: align, grid…
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.
$ npx -y skills add phaserjs/phaser --skill filters-and-postfx --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/filters-and-postfxContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
name: filters-and-postfx description: "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."
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);
---
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.
Every `FilterList` exposes two sub-lists: `filters.internal` and `filters.external`. The distinction controls **when** the filter runs relative to the camera/object transform:
Use internal filters wherever possible for better performance.
`FilterList` (`Phaser.GameObjects.Components.FilterList`) is the container that holds filter controllers. It provides:
Every filter is a `Phaser.Filters.Controller` subclass. Common Controller properties:
| Property | Type | Description | |---|---|---| | `active` | boolean | Toggle the filter on/off without removing it | | `camera` | Camera | The camera that owns this filter | | `renderNode` | string | The render node ID for the shader | | `paddingOverride` | Rectangle | Override automatic padding calculation | | `ignoreDestroy` | boolean | If true, the filter survives when its FilterList is destroyed (for reuse) |
Key methods: `setActive(bool)`, `setPaddingOverride(left, top, right, bottom)`, `getPadding()`, `destroy()`.
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:
| Property | Default | Description | |---|---|---| | `filterCamera` | null -> Camera | The internal camera used for filter rendering | | `filters` | null -> {internal, external} | Access to the FilterList pair | | `renderFilters` | true | Master toggle for all filter rendering | | `filtersAutoFocus` | true | Auto-adjust camera to follow the object | | `filtersFocusContext` | false | Focus on the rendering context instead of the object bounds | | `filtersForceComposite` | false | Always draw to a framebuffer even with no active filters | | `maxFilterSize` | null -> Vector2 | Maximum texture size for filter framebuffers |
Use `willRenderFilters()` to check if any active filters will actually render.
---
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);
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();
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.ad
Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop and mobile web browsers and has been actively developed for over 13 years.
Repo: phaserjs/phaser
Use this skill when working with Phaser 4 utility functions, actions, alignment, grid layout, or batch operations on game objects. Triggers on: align, grid…
Use this skill when creating or controlling sprite animations in Phaser 4. Covers spritesheets, atlases, AnimationManager, AnimationState, play/stop/chain,…
Use this skill when adding audio or sound to a Phaser 4 game. Covers loading audio, playing sounds, music, volume, spatial audio, Web Audio API, and…
Use this skill when working with cameras in Phaser 4. Covers camera effects (shake, fade, flash, pan, zoom), following sprites, scroll, bounds, viewports,…
Use this skill when working with curves and paths in Phaser 4. Covers splines, bezier curves, lines, ellipses, path followers, and mathematical curve types.…
Use this skill when using the Phaser 4 DataManager to store custom key-value data on game objects, listen for data change events, or manage game state.…