effect-motion
API ReferencethreeNamespacesRendererFunctions

readRenderTarget

function readRenderTarget(

Function: readRenderTarget()

function readRenderTarget(
   self,
   target,
   width,
height): Effect<Uint8Array<ArrayBufferLike>, ThreeException>;

Defined in: packages/three/src/Renderer.ts:184

Read rendered pixels back off the GPU as RGBA bytes.

Parameters

ParameterTypeDescription
selfRenderer-
targetRenderTargetThe target to read.
widthnumberRegion width in device pixels.
heightnumberRegion height in device pixels.

Returns

Effect<Uint8Array<ArrayBufferLike>, ThreeException>

width * height * 4 bytes of RGBA.

Remarks

The result is exactly width * height * 4 bytes, top-down and tightly packed — ready to hand to an image encoder. WebGPU itself pads each row to a 256-byte boundary; that padding is stripped here so callers never deal with stride.

Colors come back LINEAR. Render through a PostProcessing.RenderPipeline first if you want the sRGB output transform applied — reading a raw render target and encoding it directly produces a visibly dark image.

On this page