pixi.js
    Preparing search index...

    Class RenderTargetAdvanced

    A class that describes what the renderers are rendering to. This can be as simple as a Texture, or as complex as a multi-texture, multi-sampled render target. Support for stencil and depth buffers is also included.

    If you need something more complex than a Texture to render to, you should use this class. Under the hood, all textures you render to have a RenderTarget created on their behalf.

    A render target can have several color attachments, each with its own format (for example rgba16float color, rg16float velocity and r32uint ids). A draw writes only the attachments its fragment shader has an output for and leaves the rest alone, so a 2D sprite drawn into such a target changes attachment 0 only. Every attachment a draw writes blends with the draw's blend mode, except integer formats, which never blend, and a blended draw needs a vec4 output for each attachment it writes, as the blend reads its alpha. A clear sets each attachment to its own clearValue, or to the clear color given with the bind where it has none; integer attachments take the numbers as integers, so a normal clear color (0 to 1) clears them to 0 or 1. The bind's clear decides whether anything clears; an attachment with loadOp: 'load' keeps its contents even when the bind clears. An antialiased target can't have an integer attachment.

    Several render targets can be built over the same textures, for example one that writes a depth texture and one that only tests against it. They draw into the same pixels: an antialiased texture's samples are kept with the texture, not with a target. They are made when the texture is first drawn into and go with its GPU texture, when it is destroyed, unloaded or resized; destroying a target frees only what the target owns, not the samples of textures passed to it. Targets that share a depth/stencil texture must all be antialiased, or none of them. On WebGPU a canvas can have only one render target. Building a second reconfigures its context, and destroying one unconfigures it.

    Hierarchy

    Index
    colorAttachments: PixiColorAttachment[] = []

    An array of attachments that define exactly how the GPU should render to the color textures. This includes the texture itself, as well as load/store operations and clear values.

    depthStencilAttachment?: PixiDepthStencilAttachment

    An attachment that defines exactly how the GPU should render to the depth/stencil texture. Includes the texture, load/store operations, and depth/stencil specific clear values.

    dirtyId: number = 0
    flipY?: boolean

    Opt-in toggle that inverts this target's Y orientation, resolved at bind time.

    Defaults to undefined/false — a no-op, so rendering is exactly what it has always been (texture targets flip so they sample upright in the 2D pipeline; the screen does not). Set true to invert that automatic orientation — e.g. to store a capture in screen orientation for 3D, where geometry UVs expect the un-flipped result.

    When true, the projection Y-flip and the winding/cull inversion flip together, so a front-facing triangle stays front-facing — back-face culling of content rendered into the target stays correct.

    isRoot: boolean = false
    label?: string

    a label for debugging — shows up on the render pass in GPU debuggers (WebGPU)

    uid: number = ...

    unique id for this render target

    defaultOptions: RenderTargetOptions = ...

    The default options for a render target

    • get colorTextures(): TextureSource<any>[]

      An array of textures that can be written to by the GPU - mostly this has one texture in Pixi, but you could write to multiple if required! (eg deferred lighting). This is a backwards-compatible getter that extracts the textures from colorAttachments.

      Returns TextureSource<any>[]

    • get depth(): boolean

      Whether this target provides a depth buffer — requested via options or implied by its attachment's format.

      Returns boolean

    • get height(): number

      Returns number

    • get pixelHeight(): number

      Returns number

    • get pixelWidth(): number

      Returns number

    • get resolution(): number

      Returns number

    • get size(): [number, number]

      Returns [number, number]

    • get sizeSource(): TextureSource

      The texture that drives size, resolution, and resize events. For standard targets this is colorAttachments[0].texture; for depth-only targets it is depthStencilAttachment.texture.

      Returns TextureSource

    • get stencil(): boolean

      Whether this target provides a stencil buffer — requested via options or implied by its attachment's format.

      Returns boolean

    • get width(): number

      Returns number

    • Returns void

    • Parameters

      • width: number
      • height: number
      • resolution: number = ...
      • skipColorTexture: boolean = false

      Returns void