How readRenderTargetPixels work?

Refer to this thread’s answer.

I can extract the pixel data using readRenderTargetPixels with the default renderer I’ve set up.

Now I tried to create a new WebGLRenderer with the same configuration as the previous one, Then readRenderTargetPixels like so.

const renderer = new WebGLRenderer(options);
const read = new Uint8Array(4);
renderer.readRenderTargetPixels(
    renderTarget, x, y, 1, 1, read
);

And it doesn’t work, No error but I’ve got no results.
The render target has already been rendered using the original renderer.

What criteria make the readRenderTargetPixels work in my original renderer?

You can’t access a render target with a different renderer since the internal resource of the render target are not shared. They are internally managed in the first renderer.

1 Like

Super helpful answer as always.
Thanks a ton.

1 Like