# phaser v4.2.0 — Phaser v4.2.0 - Product: phaser (https://whatsnew.fyi/product/phaser) - Vendor: phaserjs - Date: 2026-06-19 - Version: v4.2.0 - Original notes: https://github.com/phaserjs/phaser/releases/tag/v4.2.0 - Permalink: https://whatsnew.fyi/product/phaser/releases/v4.2.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- - **added** — New game config options render.alphaStrategy, render.stencil, and render.stencilAlphaStrategy for controlling alpha handling and stencil buffer creation - **added** — CustomContext game object to modify DrawingContext at render time, enabling stencil testing, alpha handling strategies, and GL scissor modification - **added** — Mesh2D game object to render textured triangles with batching support for regular sprites - **added** — Mesh2D#buildOrderedIndices method to precompute optimized index lists for triangle-to-quad arrangements with configurable optimization strategies - **added** — Mesh2D#useOrderedIndices and Mesh2D#setUseOrderedIndices to toggle between ordered and unordered index lists without rebuilding - **added** — Mesh2D#renderAsTriangles and Mesh2D#setRenderAsTriangles to render mesh as individual triangles via BatchHandlerTri - **added** — BatchHandlerTri render node to draw individual textured triangles as a batch, extending BatchHandlerQuad with a batchTriangles method - **added** — TransformerVertex render node now splits per-vertex run into setupMatrix and transformVertex to cache transform matrices for mesh rendering - **added** — Stencil game object as a persistent container whose contents modify the stencil buffer with operating modes including addLayer, subtractLayer, clear, and clearRegion - **added** — StencilReference game object to re-render a target Stencil with different settings - **added** — AlphaStrategy setting to use GLSL discard instead of alpha in shaders, with strategies including keep, dither, and threshold - **added** — BatchHandler render node now supports config option for topology to allow extended nodes to opt into different triangulation modes - **added** — DrawingContext now includes controls for alpha strategy, color writemask, and stencil parameters - **added** — WebGLGlobalWrapper now handles stencil write mask - **added** — TintModes.MULTIPLY_TWO tint mode using a secondary color for new tint effects - **added** — Game objects with Tint component now support second tint per corner with tint2TopLeft properties and setTint2() method - **added** — Mesh2D and Tile objects support constant tint via tint2 - **added** — Timestep#setFPSLimit method to change the frame rate at runtime with proper property updates - **added** — Cone lights as directional light sources with coneEnabled, coneRotation, coneInnerAngle, and coneOuterAngle properties - **changed** — inTintEffect shader attribute changed from float to vec4 with encoding changed from float32 to four uint8s in ApplyTint shader addition - **changed** — WebGLStencilParametersFactory now takes an extra writeMask parameter ##### Version 4.2.0 - Giedi - 19th June 2026 ###### New Features - New game config options: - `render.alphaStrategy`: hint to shaders to handle alpha in different ways. - `render.stencil`: disable stencil buffer creation in a game, saving memory. - `render.stencilAlphaStrategy`: set the default alpha strategy used within `Stencil` objects, where regular alpha does nothing. - `CustomContext` game object is a container which can modify the `DrawingContext` at render time. This is an advanced rendering technique which reaches into the deep settings of the renderer. Potential uses include: - Toggling stencil testing - Selectively activating alpha handling strategies - Freehand GL scissor modification - `Mesh2D` game object renders textured triangles. It batches with regular sprites. - `Mesh2D#buildOrderedIndices` precomputes an optimized index list (`Mesh2D#indicesOrdered`) which arranges triangles into quad-forming pairs, synthesizing degenerate triangles where a triangle has no edge-sharing partner. You choose the optimization strategy (`0` fast, `1` medium, `2` high), paying the cost once when the topology is stable. Use `Mesh2D#useOrderedIndices` (and `Mesh2D#setUseOrderedIndices`) to toggle between the ordered and unordered lists without rebuilding. - `Mesh2D#renderAsTriangles` (and `Mesh2D#setRenderAsTriangles`) renders the mesh as individual triangles via the new `BatchHandlerTri` render node, which is suitable for dynamic topology that cannot be optimized into quads. - `BatchHandlerTri` render node draws individual textured triangles (`gl.TRIANGLES`) as a batch. It extends `BatchHandlerQuad`, reusing its shader, vertex layout, and texture handling, and adds a `batchTriangles` method which accepts vertex and index arrays directly. - `TransformerVertex` render node now splits its per-vertex `run` into `setupMatrix` (build the transform matrix once per GameObject) and `transformVertex` (project a single vertex with the cached matrix). Mesh rendering uses this to avoid rebuilding the transform matrix for every vertex. `run` is unchanged for existing callers. - `Stencil` game object is a container whose contents modify the stencil buffer. This is a fast way to persistently mask the game canvas. There are many ways to combine stencils. The default approach is to add layers to the stencil mask. - Unlike stencil masks in Phaser 3, Stencil objects are universal, persistent, and support anything as a stencil source, so long as it draws pixels. Use sprites and filter outputs as stencil sources! - Operating modes include `addLayer`, `subtractLayer`, `clear`, and `clearRegion`. Add and subtract can be inverted. - `StencilReference` game object re-renders a target `Stencil` with different settings. This is useful for removing or reusing stencil geometry. - `AlphaStrategy` setting used in the render system allows you to use GLSL `discard` instead of alpha in many shaders. This is inefficient, but is useful for some effects and situations. - Game config can set a default alpha strategy. - Stencil and CustomContext allow you to set an alpha strategy. - Most Phaser shaders handle alpha strategy. Custom shaders must implement it themselves, but you can use compositing (`filtersForceComposite`) to run graphics through a compatible shader. - Strategies include: - `keep`: use alpha as normal. - `dither`: use a dithering algorithm to select pixels to discard. - `threshold`: discard all pixels below a certain alpha. - `BatchHandler` render node now has a config option for `topology`, allowing extended nodes to opt into different triangulation modes. - `BatchHandlerTri` render node renders textured triangles. It is used by `Mesh2D` in triangle rendering mode. This can be more efficient than attempting to compile triangles into quads, which is the default strategy. - `DrawingContext` adds more controls: - Alpha strategy - Color _[Truncated at 4000 characters — full notes: https://github.com/phaserjs/phaser/releases/tag/v4.2.0]_