THREE.Points use GPU Picking is not work

Hello, everybody.
I’m using https://threejs.org/examples/webgl_custom_attributes_points for 3 cases. It’s beautiful!!!
but when I use the method of picking points with GPU in my article, I get the color ID ID when I combine it with https://threejs.org/examples/webgl_interactive_cubes_gpu. Always scene background color, I do not know why, I do not know if anyone has encountered this situation, hope to help me, thank you!

Hi!
Would be great to provide an editable live code example (codepen, jsfiddle etc., at last a repo on github) that shows the problem.

It seems this (unofficial) demo with three.js does demonstrate GPU picking with points.

1 Like
//set the view offset to represent just a single pixel under the mouse,When THREE.Points is used in scenarios, it cannot be picked up correctly.
self.camera.setViewOffset(self.renderer.domElement.width, self.renderer.domElement.height, mouse.x * window.devicePixelRatio | 0, mouse.y * window.devicePixelRatio | 0, 1, 1);
self.renderer.setRenderTarget(self.pickingTexture);
self.renderer.render(self.pickingScene, self.camera);
self.camera.clearViewOffset();
self.renderer.readRenderTargetPixels(self.pickingTexture, 0, 0, 1, 1, pixelBuffer);

//Use the following code GPU to picking the normal work
self.renderer.setRenderTarget(self.pickingTexture);
self.renderer.render(self.pickingScene, self.camera);
self.renderer.readRenderTargetPixels(self.pickingTexture, mouse.x, self.pickingTexture.height - mouse.y, 1, 1, pixelBuffer);

THREE. Points picked up invalid when I used the latest improved camera. setViewOffset offset to get 1 pixel, and other models were normal. I don’t know what’s wrong with using the old full screen rendering to picking Texture.

Some context:

1 Like