A Stencil is a special type of Game Object used to place stencils over the canvas.
You can use it to efficiently control where subsequent objects are rendered.
It is WebGL-only.
Study the documentation carefully to understand how it works.
A Stencil is an extended Container Game Object.
It contains a list of child Game Objects to render to the stencil buffer.
Think of these as opaque sheets of card held up over the canvas,
preventing anything from being drawn through them.
The stencil buffer is provided by WebGL.
It is available if the game render config set stencil to true.
It is an 8-bit attachment to framebuffers, like an extra alpha channel.
But if the stencil channel is not 0 at a pixel, WebGL will skip rendering that pixel.
There are no degrees of transparency, only on or off.
Stencil is best used for efficient, sharp-edged, reused masks.
You can draw a stencil once, and it will affect everything that is drawn later.
Its rendering cost is minimal: it is just the draw cost of its children.
If you need better quality alpha handling, consider using a Mask filter instead.
Filters have a higher rendering cost, and apply to just 1 object at a time,
but they have the best quality.
A Stencil Game Object.
A Stencil is a special type of Game Object used to place stencils over the canvas. You can use it to efficiently control where subsequent objects are rendered. It is WebGL-only. Study the documentation carefully to understand how it works.
A Stencil is an extended Container Game Object. It contains a list of child Game Objects to render to the stencil buffer. Think of these as opaque sheets of card held up over the canvas, preventing anything from being drawn through them.
The stencil buffer is provided by WebGL. It is available if the game render config set
stenciltotrue. It is an 8-bit attachment to framebuffers, like an extra alpha channel. But if the stencil channel is not 0 at a pixel, WebGL will skip rendering that pixel. There are no degrees of transparency, only on or off.Stencil is best used for efficient, sharp-edged, reused masks. You can draw a stencil once, and it will affect everything that is drawn later. Its rendering cost is minimal: it is just the draw cost of its children.
If you need better quality alpha handling, consider using a Mask filter instead. Filters have a higher rendering cost, and apply to just 1 object at a time, but they have the best quality.