render-textures

Paint game objects onto RenderTexture or DynamicTexture for off-screen rendering in Phaser 4.

40.1k|7.2k|Updated Apr 12, 2013
One-click install
npx skills add https://github.com/phaserjs/phaser --skill render-textures-phaserjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: render-textures
Source: https://github.com/phaserjs/phaser/tree/main/skills/render-textures
Command: npx skills add https://github.com/phaserjs/phaser --skill render-textures-phaserjs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Off-screen rendering of game content to textures enables HUDs, minimaps, and dynamic texture workflows without modifying on-screen objects.

Core Features & Use Cases

  • RenderTexture and DynamicTexture support drawing game objects, textures, groups, and scene lists to an off-screen texture.
  • Stamp and capture allow precise control over drawing with transforms, temporary overrides, and re-use across frames.
  • Render modes (render, redraw, all) control when and how textures are updated and displayed.
  • Procedural generation and minimap patterns become feasible by rendering multiple passes to shared textures.

Quick Start

Create a RenderTexture in your scene, draw objects onto it, and call render() to flush the command buffer.

Frequently Asked Questions about render-textures

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render game objects to an off-screen texture in Phaser?

To render game objects to an off-screen texture, use RenderTexture or DynamicTexture to paint objects and call the render() method to flush the command buffer and update the texture.

What is the difference between RenderTexture and DynamicTexture for off-screen rendering?

RenderTexture and DynamicTexture both support off-screen rendering by drawing textures, groups, and scene lists. They utilize stamp and capture techniques with render modes to control texture update timing and cross-scene reusability.

How do I create a minimap or HUD without modifying on-screen objects?

Create a minimap or HUD by drawing game objects onto an off-screen RenderTexture or DynamicTexture, which captures the visual state independently and allows procedural generation without altering on-screen elements.

Can I reuse dynamically generated textures across different scenes in Phaser?

Yes, you can reuse dynamically generated textures across different scenes by drawing them onto a DynamicTexture and utilizing the stamp, capture, and render modes to manage updates and display states efficiently.

How does the command buffer rendering work when drawing to a DynamicTexture?

Command buffer rendering accumulates draw, erase, fill, and clear instructions for DynamicTexture. Calling render() or applying render modes flushes this buffer, executing the queued drawing operations onto the texture.

What are the limitations of using off-screen textures for texture compositing?

Limitations of off-screen texture compositing involve managing render modes correctly; improper timing of render, redraw, or all modes can cause stale textures, while camera integration requires precise transform overrides during stamping.