# PostEffect

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/graphics/post-effect.js#L20

Base class for all post effects. Post effects take a render target as input, apply effects to
it, and then render the result to an output render target or the screen if no output is
specified.

## Constructors

### constructor

```ts
new PostEffect(graphicsDevice: GraphicsDevice)
```

Create a new PostEffect instance.

**Parameters**

- `graphicsDevice` ([`GraphicsDevice`](https://api.playcanvas.com/engine/classes/GraphicsDevice.md)): The graphics device of the application.

## Properties

### device

```ts
device: GraphicsDevice
```

The graphics device of the application.

### needsDepthBuffer

```ts
needsDepthBuffer: boolean
```

The property that should to be set to `true` (by the custom post effect) if a depth map
is necessary (default is false).

### quadVertexShader

```ts
static quadVertexShader: string
```

A simple vertex shader used to render a quad, which requires 'vec2 aPosition' in the vertex
buffer, and generates uv coordinates vUv0 for use in the fragment shader.

## Methods

### drawQuad

```ts
drawQuad(target: RenderTarget | null, shader: Shader, rect?: Vec4): void
```

Draw a screen-space rectangle in a render target, using a specified shader.

**Parameters**

- `target` ([`RenderTarget`](https://api.playcanvas.com/engine/classes/RenderTarget.md) `| null`): The output render target.
- `shader` ([`Shader`](https://api.playcanvas.com/engine/classes/Shader.md)): The shader to be used for drawing the rectangle.
- `rect` ([`Vec4`](https://api.playcanvas.com/engine/classes/Vec4.md), optional): The normalized screen-space position (rect.x, rect.y) and size (rect.z,
  rect.w) of the rectangle. Default is `[0, 0, 1, 1]`.

### render

```ts
render(inputTarget: RenderTarget, outputTarget: RenderTarget, rect?: Vec4): void
```

Render the post effect using the specified inputTarget to the specified outputTarget.

**Parameters**

- `inputTarget` ([`RenderTarget`](https://api.playcanvas.com/engine/classes/RenderTarget.md)): The input render target.
- `outputTarget` ([`RenderTarget`](https://api.playcanvas.com/engine/classes/RenderTarget.md)): The output render target. If null then this will be the
  screen.
- `rect` ([`Vec4`](https://api.playcanvas.com/engine/classes/Vec4.md), optional): The rect of the current camera. If not specified, it will default to
  `[0, 0, 1, 1]`.
