THREE.JS / FOUNDATIONS 89

Read the depth back.

A scene writes a real depth attachment. A fullscreen node samples that depth into a readable color target, then an async readback turns the encoded pixels into a CPU DataTexture preview.

Initializing -

Creating the depth source and color readback target.

Backend
-
View
-
Target
-
Reads
0
GPU to CPU boundaryencoded color path

The split preview compares live depth sampling on the left with the last CPU readback on the right.

Depth source
-
MSAA
-
Export
RGBA8
Read bytes
-
Center pixel No readback yet
Depth validation controls
Explicit lifecycle
scene->DepthTexture->RGBA8 encode->async read->DataTexture

The first frame renders the GPU source and an empty CPU preview. Press readback to cross the boundary.

Left side is live GPU sampling. Right side is the last RGBA8 CPU copy. The export is intentionally quantized.

Next: capability and device limits ->
LAB 89 / DEPTH READBACK