ThreeJS - Reading pixel from renderTarget

Hi there,

I’m having trouble optimising readRenderTargetPixels() on mousemove to read pixel information.

When reading pixels from a renderTarget that is full width / height of screen the pixel it works, example below;

When i try to optimise the pixel detection by reducing the size of the renderTarget down to 1x1 and cropping/positioning the viewport using setScissor, i can’t get the correct red channel pixel reading any more. It appears that the pixel is just sampling the center of the screen.

When commenting out;

// renderer.setScissorTest(false);

you can see the scissored viewport following the mouse around, ideally readRenderTargetPixels() sample from position 0,0 from within the crop.

Note : These are simplified examples, in my project i’m drawing procedural shapes in the fragmentShader. So i don’t think GPU picking is an alternative option.