
v4-new-features
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.
- Installs
- 965
- 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 v4-new-features- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads v4-new-features automatically when relevant.
- 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 New Features
New features and capabilities in Phaser 4: Filters (replacing FX/BitmapMask), RenderNodes (replacing Pipelines), CaptureFrame, Gradient, Noise game objects, SpriteGPULayer, TilemapGPULayer, Lighting component, RenderSteps, and new tint modes.
Related skills: ../v3-to-v4-migration/SKILL.md, ../filters-and-postfx/SKILL.md, ../game-object-components/SKILL.md, ../tilemaps/SKILL.md
Migrating from v3? See the v3 to v4 Migration Guide for step-by-step code changes, removed APIs, and a migration checklist.
Overview: What Changed in v4
Phaser 4 is a complete overhaul of the WebGL rendering engine. The v3 renderer let each subsystem manage WebGL state independently, causing conflicts (e.g. certain FX breaking Masks). v4 centralizes WebGL state management through a RenderNode graph, where each node handles exactly one rendering task.
Key Removals
| v3 Feature | v4 Replacement |
|---|---|
Pipeline | RenderNode (per-task rendering nodes) |
FX (preFX / postFX) | Filters (filters.internal / filters.external) |
BitmapMask | FilterMask (via filters system) |
GeometryMask (WebGL) | FilterMask (Canvas still uses GeometryMask) |
| Derived FX: Bloom, Circle, Gradient, Shine | Actions (AddEffectBloom, AddEffectShine, AddMaskShape) or GameObjects |
Mesh and Plane | Removed (proper 3D planned for future) |
Point | Use Vector2 instead |
Key Additions
- New GameObjects:
CaptureFrame,Gradient,Noise,NoiseCell2D/3D/4D,NoiseSimplex2D/3D,SpriteGPULayer,Stamp,TilemapGPULayer - New Components:
Lighting,RenderSteps,RenderNodes - New Tint Modes:
MULTIPLY,FILL,ADD,SCREEN,OVERLAY,HARD_LIGHT - New Filters: Blend, Blocky, CombineColorMatrix, GradientMap, ImageLight, Key, Mask, NormalTools, PanoramaBlur, ParallelFilters, Quantize, Sampler, Threshold
- GL Orientation: v4 uses standard GL orientation (Y=0 at bottom for textures)
Filters System (Replacing FX and BitmapMask)
Full reference:
filters-and-postfx.md
Filters unify the v3 FX and Mask systems. Every filter takes an input image and produces an output image via a shader pass. Filters can be applied to any game object or camera -- v3 had restrictions on which objects supported FX.
// v3 approach (FX):
sprite.preFX.addGlow(0xff00ff, 4);
sprite.postFX.addBlur(0, 2, 2, 1);
// v4 approach (Filters):
sprite.enableFilters();
sprite.filters.internal.addGlow(0xff00ff, 4, 0, 1);
sprite.filters.external.addBlur(0, 2, 2, 1);
// v3 approach (BitmapMask):
const mask = new Phaser.Display.Masks.BitmapMask(scene, maskImage);
sprite.setMask(mask);
// v4 approach (FilterMask):
sprite.enableFilters();
sprite.filters.internal.addMask(maskImage);
Internal vs External: Internal filters run before the camera transform (object-local space, cheaper). External filters run after (screen space, full-resolution).
RenderNodes (Replacing Pipelines)
In v3, a Pipeline was a rendering system that often handled multiple responsibilities. In v4, each RenderNode handles a single rendering task via its run() method. Some nodes also have a batch() method to accumulate state before drawing.
Architecture
The RenderNodeManager (on the WebGL renderer) owns all render nodes. Game objects reference nodes through role-based maps.
// RenderNode roles on a game object:
// - 'Submitter': runs other node roles for each element
// - 'Transformer': provides vertex coordinates
// - 'Texturer': handles textures
// GameObjects have default and custom render node maps:
gameObject.defaultRenderNodes // built-in nodes per role
gameObject.customRenderNodes // overrides per role
gameObject.renderNodeData // data keyed by node name
Setting Custom RenderNodes
// Override a specific render role:
gameObject.setRenderNodeRole('Submitter', 'MyCustomSubmitter');
// Pass data to a render node:
gameObject.setRenderNodeRole('Transformer', 'MyTransformer', {
customProperty: 42
});
// Remove a custom node (falls back to default):
gameObject.setRenderNodeRole('Submitter', null);
Built-in RenderNode Types
Batch Handlers (accumulate and draw multiple objects per draw call):
BatchHandlerQuad-- standard quad batching (Image, Sprite, BitmapText, etc.)BatchHandlerQuadSingle-- single-quad variantBatchHandlerTileSprite-- TileSprite batchingBatchHandlerTriFlat-- flat triangle batching (Graphics, Shape)BatchHandlerPointLight-- point light batchingBatchHandlerStrip-- triangle strip batching
Submitters (coordinate rendering per object type):
SubmitterQuad,SubmitterTile,SubmitterTileSpriteSubmitterSpriteGPULayer,SubmitterTilemapGPULayer
Transformers (compute vertex positions):
TransformerImage,TransformerStamp,TransformerTile,TransformerTileSprite
Texturers (manage texture binding):
TexturerImage,TexturerTileSprite
Filters (post-processing -- see filters-and-postfx.md):
BaseFilter,BaseFilterShaderFilterBarrel,FilterBlend,FilterBlocky,FilterBlur(Low/Med/High variants)FilterBokeh,FilterColorMatrix,FilterCombineColorMatrixFilterDisplacement,FilterGlow,FilterGradientMap,FilterImageLightFilterKey,FilterMask,FilterNormalTools,FilterPanoramaBlurFilterParallelFilters,FilterPixelate,FilterQuantizeFilterSampler,FilterShadow,FilterThreshold,FilterVignette,FilterWipe
Other:
Camera,FillCamera,FillRect,FillPath,FillTriDrawLine,StrokePath,ShaderQuadListCompositor,RebindContext,YieldContextDynamicTextureHandler
Extending: Custom RenderNodes
// Register a custom node constructor:
renderer.renderNodes.addNodeConstructor('MyNode', MyNodeClass);
// Or add a pre-built node instance:
renderer.renderNodes.addNode('MyNode', myNodeInstance);
New Game Objects
CaptureFrame
Captures the current framebuffer contents to a texture at the point in the display list where it sits. Does not render anything itself. WebGL only.
// Everything above this in the display list gets captured:
const image1 = this.add.image(400, 300, 'background');
// Enable framebuffer usage on the camera:
this.cameras.main.setForceComposite(true);
// Create the capture point:
const capture = this.add.captureFrame('myCapturedTexture');
// Use the captured texture on another object:
const overlay = this.add.image(400, 300, 'myCapturedTexture');
// Add filters to the overlay to distort the captured scene
Key details:
- Requires
camera.setForceComposite(true)or a framebuffer context (Filters, DynamicTexture, camera with partial alpha) - Inside a Container with filters, captures only that Container's contents
- Setting
visible = falsestops capturing - Components: BlendMode, Depth, RenderNodes, Visible
Source: src/gameobjects/captureframe/CaptureFrame.js
Gradient
Displays GPU-rendered color gradients. Extends Shader. Supports linear, radial, and other shape modes with configurable ColorRamp containing ColorBand objects.
// Simple linear gradient:
const grad = this.add.gradient(undefined, 100, 100, 200, 200);
// Complex radial gradient with multiple color bands:
const halo = this.add.gradient({
bands: [
{ start: 0.5, end: 0.6, colorStart: [0.5, 0.5, 1, 0], colorEnd: 0xffffff, colorSpace: 1, interpolation: 4 },
{ start: 0.6, end: 1, colorStart: 0xffffff, colorEnd: [1, 0.5, 0.5, 0], colorSpace: 1, interpolation: 3 }
],
dither: true,
repeatMode: 1,
shapeMode: 2, // radial
start: { x: 0.5, y: 0.5 },
shape: { x: 0.5, y: 0.0 }
}, 400, 300, 800, 800);
// Animate:
halo.offset = 0.1 * (1 + Math.sin(time / 1000));
Key details:
- Config:
GradientQuadConfigwithbands,shapeMode,repeatMode,start,shape,dither - Colors defined via
ColorRampwithColorBandobjects (supports HSV, various interpolation modes) - Call
gradient.ramp.encode()after modifying ramp data at runtime
Source: src/gameobjects/gradient/Gradient.js
Noise Game Objects
All noise types extend Shader and are WebGL only. Six variants available:
| Type | Factory | Description |
|---|---|---|
Noise | this.add.noise() | White noise (random hash-based) |
NoiseCell2D | this.add.noiseCell2D() | 2D cellular/Worley/Voronoi noise |
NoiseCell3D | this.add.noiseCell3D() | 3D cellular noise (Z-axis slicing for animation) |
NoiseCell4D | this.add.noiseCell4D() | 4D cellular noise (Z+W axis slicing) |
NoiseSimplex2D | this.add.noiseSimplex2D() | 2D simplex/gradient noise (clouds, fire, water) |
NoiseSimplex3D | this.add.noiseSimplex3D() | 3D simplex noise |
// Basic white noise:
const noise = this.add.noise({
noiseOffset: [0, 0],
noisePower: 1
}, 100, 100, 256, 256);
// Cellular noise with customization:
const cells = this.add.noiseCell2D({
noiseOffset: [0, 0],
noiseIterations: 3,
noiseNormalMap: true // output as normal map for lighting
}, 200, 200, 256, 256);
// Simplex noise for natural effects:
const simplex = this.add.noiseSimplex2D({
noiseFlow: 0, // animate this for evolution
noiseIterations: 4,
noiseWarpAmount: 0.5, // turbulence
noiseSeed: 42,
noiseNormalMap: false
}, 300, 300, 256, 256);
Common properties across noise types:
noiseOffset--[x, y]array to scroll the patternnoisePower-- sculpt output levels (higher suppresses high values)noiseNormalMap-- output normal map (for lighting integration)noiseIterations-- detail level (cellular/simplex types)
Math equivalents: Phaser.Math.Hash(), Phaser.Math.HashCell(), Phaser.Math.HashSimplex()
Source: src/gameobjects/noise/
SpriteGPULayer
Renders very large numbers of quads (up to millions) in a single draw call by storing data in a static GPU buffer. Up to 100x faster than individual sprites. WebGL only.
const layer = this.add.spriteGPULayer(texture, size); // size = max number of members
// Add members (do this all at once, not incrementally):
const member = { x: 100, y: 200, frame: 'tree', scaleX: 1, scaleY: 1, alpha: 1 };
layer.addMember(member);
// Reuse the member object for efficiency with millions of entries:
member.x = 300;
member.y = 400;
member.frame = 'bush';
layer.addMember(member);
// Enable lighting on the layer:
layer.setLighting(true);
Key details:
- Single texture only (no multi-atlas), single image per layer
- Members support tween-like animations (fade, bounce, wave, color shift) defined at creation
- Updating buffer contents is expensive -- populate once, leave unchanged
- Power-of-two textures recommended for pixel art to avoid seaming
- "Remove" members visually by setting
scaleX/scaleY/alphato 0 (avoids buffer rebuild) - Components: Alpha, BlendMode, Depth, ElapseTimer, Lighting, Mask, RenderNodes, TextureCrop, Visible
Source: src/gameobjects/spritegpulayer/SpriteGPULayer.js
New Components
Full component reference:
game-object-components.md
Lighting Component
Replaces the v3 approach of assigning a lighting pipeline. WebGL only.
// v3 approach:
sprite.setPipeline('Light2D');
// v4 approach:
sprite.setLighting(true);
// Self-shadowing (simulates surface shadows from texture brightness):
sprite.setSelfShadow(true, 0.5, 1/3);
// Args: enabled, penumbra (lower = sharper), diffuseFlatThreshold (0-1)
// Use game-wide default for self-shadow:
sprite.setSelfShadow(null); // reads from config.render.selfShadow
Supported on: BitmapText, Blitter, Graphics, Shape, Image, Sprite, Particles, SpriteGPULayer, Stamp, Text, TileSprite, Video, TilemapLayer, TilemapGPULayer.
Batching note: Lighting changes the shader, which breaks batches. Group lit objects together and unlit objects together for best performance.
Source: src/gameobjects/components/Lighting.js
RenderSteps Component
Allows injecting custom logic into the render process of a game object. WebGL only. The Filters system uses RenderSteps internally.
// Add a custom render step:
gameObject.addRenderStep(function (renderer, gameObject, drawingContext, parentMatrix, renderStep, displayList, displayListIndex) {
// Custom rendering logic here
// Call next step when ready:
var nextFn = gameObject._renderSteps[renderStep + 1];
if (nextFn) {
nextFn(renderer, gameObject, drawingContext, parentMatrix, renderStep + 1, displayList, displayListIndex);
}
});
Key details:
- Steps are stored in
_renderStepsarray, executed viarenderWebGLStep() - First step runs first and is responsible for calling subsequent steps
- This is how Filters defer and control the
renderWebGLflow
Source: src/gameobjects/components/RenderSteps.js
RenderNodes Component
Provides defaultRenderNodes, customRenderNodes, and renderNodeData maps on game objects. See the RenderNodes section above for usage.
Source: src/gameobjects/components/RenderNodes.js
TilemapGPULayer
Full tilemap reference:
tilemaps.md
High-performance GPU-based tilemap rendering. Renders the entire layer as a single quad via a specialized shader. WebGL only.
// Create via Tilemap with the gpu flag:
const map = this.make.tilemap({ key: 'level1' });
const tileset = map.addTilesetImage('tiles', 'tilesImage');
const gpuLayer = map.createLayer('Ground', tileset, 0, 0, true); // last arg: gpu = true
Capabilities:
- Single tileset with single texture image
- Maximum 4096x4096 tiles, up to 2^23 unique tile IDs
- Tile flipping and animation supported
- Orthographic tilemaps only (no isometric/hexagonal)
- Perfect texture filtering in LINEAR mode (no tile seams)
- Cost is per-pixel, not per-tile -- no performance loss with many visible tiles
Restrictions:
- Cannot use multiple tilesets
- Editing requires manual
generateLayerDataTexture()call to update - Orthographic only
Internal data: Tile data stored in a texture (4 bytes/tile: 2 flip bits, 1 animation bit, 1 unused, 28-bit tile index). Animation data in a separate texture.
Source: src/tilemaps/TilemapGPULayer.js
For detailed configuration options, API reference tables, and source file maps, see the reference guide.
FAQ
What does the v4-new-features skill do?
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.
How do I install v4-new-features?
Run npx skills add https://github.com/phaserjs/phaser --skill v4-new-features 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/v4-new-features/ (personal) or .claude/skills/v4-new-features/ (project).
Which AI agents can use v4-new-features?
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 v4-new-features 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 v4-new-features?
It is published by phaserjs in phaserjs/phaser. It has 965 recorded installs.
More from phaserjs/phaser
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.
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.
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.
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.
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.
input-keyboard-mouse-touch
phaserjs/phaser
Use this skill when handling user input in Phaser 4. Covers keyboard keys, mouse clicks and movement, touch events, pointer handling, drag and drop, hit areas, interactive objects, and gamepad support. Triggers on: keyboard, mouse, touch, pointer, drag, drop, click, input, gamepad, cursor keys.
Popular media & creative skills
hyperframes
heygen-com/hyperframes
Read first to make, edit, animate or render any video with HyperFrames (HTML rendered to video), including launch films, explainers, music videos, charts, maps, vertical clips, title cards, captions and overlays. Holds the render contract, the work loop and what each kind of video needs.
media-use
heygen-com/hyperframes
Get or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.
hyperframes-registry
heygen-com/hyperframes
About 450 ready-made HyperFrames blocks and components installed as editable source - transitions, overlays, titles, kinetic type, captions, charts, map overlays, 3D, camera moves. Use it before hand-building any named visual (CRT scanlines, glitch, film grain, a chart); also for hyperframes add and catalog.
hyperframes-creative
heygen-com/hyperframes
Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use hyperframes-animation.
ai-video-generation
101-skills/superpowers
Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0, HappyHorse 1.0, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, reference-to-video, video editing, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative, seedance, happyhorse
ai-image-generation
101-skills/superpowers
Generate AI images with GPT-Image-2, FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: GPT-Image-2, FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image, gpt image, openai image, chatgpt image