W3cubDocs

/Three.js

WebGLRenderTarget

A render target is a buffer where the video card draws pixels for a scene that is being rendered in the background. It is used in different effects, such as applying postprocessing to a rendered image before displaying it on the screen.

Constructor

WebGLRenderTarget(Number width, Number height, Object options)

width - The width of the renderTarget. Default is 1.
height - The height of the renderTarget. Default is 1.
options - optional object that holds texture parameters for an auto-generated target texture and depthBuffer/stencilBuffer booleans. For an explanation of the texture parameters see Texture. The following are valid options:

wrapS - default is ClampToEdgeWrapping.
wrapT - default is ClampToEdgeWrapping.
magFilter - default is LinearFilter.
minFilter - default is LinearFilter.
generateMipmaps - default is false.
format - default is RGBAFormat.
type - default is UnsignedByteType.
anisotropy - default is 1. See Texture.anisotropy
colorSpace - default is NoColorSpace.
internalFormat - default is null.
depthBuffer - default is true.
stencilBuffer - default is false.
resolveDepthBuffer - default is true.
resolveStencilBuffer - default is true.
samples - default is 0.
count - default is 1.

Creates a new [name]

Properties

isWebGLRenderTarget: Boolean

Read-only flag to check if a given object is of type [name].

width: number

The width of the render target.

height: number

The height of the render target.

scissor: Vector4

A rectangular area inside the render target's viewport. Fragments that are outside the area will be discarded.

scissorTest: Boolean

Indicates whether the scissor test is active or not.

viewport: Vector4

The viewport of this render target.

texture: Texture

This texture instance holds the rendered pixels. Use it as input for further processing.

textures: Texture

An array holding the texture references of multiple render targets configured with the count option.

depthBuffer: Boolean

Renders to the depth buffer. Default is true.

stencilBuffer: Boolean

Renders to the stencil buffer. Default is false.

resolveDepthBuffer: Boolean

Defines whether the depth buffer should be resolved when rendering into a multisampled render target. Default is true.

resolveStencilBuffer: Boolean

Defines whether the stencil buffer should be resolved when rendering into a multisampled render target. This property has no effect when .resolveDepthBuffer is set to false. Default is true.

depthTexture: DepthTexture

If set, the scene depth will be rendered to this texture. Default is null.

samples: Number

Defines the count of MSAA samples. Default is 0.

Methods

setSize(Number width, Number height): undefined

Sets the size of the render target.

clone(): WebGLRenderTarget

Creates a copy of this render target.

this.copy(WebGLRenderTarget source)

Adopts the settings of the given render target.

dispose(): undefined

Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.

EventDispatcher methods are available on this class.

© 2010–2025 Three.js Authors
Licensed under the MIT License.
https://threejs.org/docs/api/en/renderers/WebGLRenderTarget.html