# Class: RenderTarget

**`Advanced`**

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.

## Extends

- `EventEmitter`\<\{ `destroy`: `RenderTarget`; \}\>

## Constructors

### Constructor

> **new RenderTarget**(`options`): `RenderTarget`

#### Parameters

##### options

Options for creating a render target, or a WebGPU-flavored descriptor.

[`RenderTargetOptions`](rendering.RenderTargetOptions.html.md) | [`RenderTargetDescriptor`](rendering.RenderTargetDescriptor.html.md)

#### Returns

`RenderTarget`

#### Overrides

`EventEmitter<{ destroy: RenderTarget, }>.constructor`

## Properties

### colorAttachments

> **colorAttachments**: [`PixiColorAttachment`](rendering.PixiColorAttachment.html.md)[] = `[]`

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?

> `optional` **depthStencilAttachment**: [`PixiDepthStencilAttachment`](rendering.PixiDepthStencilAttachment.html.md)

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

> **dirtyId**: `number` = `0`

***

### flipY?

> `optional` **flipY**: `boolean`

**`Advanced`**

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

> **isRoot**: `boolean` = `false`

***

### label?

> `optional` **label**: `string`

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

***

### uid

> `readonly` **uid**: `number`

unique id for this render target

***

### defaultOptions

> `static` **defaultOptions**: [`RenderTargetOptions`](rendering.RenderTargetOptions.html.md)

The default options for a render target

## Accessors

### colorTexture

#### Get Signature

> **get** **colorTexture**(): [`TextureSource`](rendering.TextureSource.html.md)

##### Returns

[`TextureSource`](rendering.TextureSource.html.md)

***

### colorTextures

#### Get Signature

> **get** **colorTextures**(): [`TextureSource`](rendering.TextureSource.html.md)\<`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`](rendering.TextureSource.html.md)\<`any`\>[]

***

### depth

#### Get Signature

> **get** **depth**(): `boolean`

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

##### Returns

`boolean`

***

### depthStencilTexture

#### Get Signature

> **get** **depthStencilTexture**(): [`TextureSource`](rendering.TextureSource.html.md)\<`any`\>

The stencil and depth buffer will write to this texture in WebGPU.

##### Returns

[`TextureSource`](rendering.TextureSource.html.md)\<`any`\>

***

### height

#### Get Signature

> **get** **height**(): `number`

##### Returns

`number`

***

### pixelHeight

#### Get Signature

> **get** **pixelHeight**(): `number`

##### Returns

`number`

***

### pixelWidth

#### Get Signature

> **get** **pixelWidth**(): `number`

##### Returns

`number`

***

### resolution

#### Get Signature

> **get** **resolution**(): `number`

##### Returns

`number`

***

### size

#### Get Signature

> **get** **size**(): \[`number`, `number`\]

##### Returns

\[`number`, `number`\]

***

### sizeSource

#### Get Signature

> **get** **sizeSource**(): [`TextureSource`](rendering.TextureSource.html.md)

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`](rendering.TextureSource.html.md)

***

### stencil

#### Get Signature

> **get** **stencil**(): `boolean`

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

##### Returns

`boolean`

***

### width

#### Get Signature

> **get** **width**(): `number`

##### Returns

`number`

## Methods

### destroy()

> **destroy**(): `void`

#### Returns

`void`

***

### resize()

> **resize**(`width`, `height`, `resolution`, `skipColorTexture`): `void`

#### Parameters

##### width

`number`

##### height

`number`

##### resolution

`number` = `...`

##### skipColorTexture

`boolean` = `false`

#### Returns

`void`
