Hello guys, i’m kinda new to three.js and i’ve been stuck on a problem for a week . Basically i have a bunch of points that i need to select with a rectangle box. I found SelectionBox from three.js ( three.js webgl - box selection ) which seemed it was exactly what i needed, the only problem is that im integrating all the points into the geometry using the position attribute, and the SelectionBox regards all the points as one Three.Points. Is there any way of knowing which points were selected without having to render every point as a separate Points Object? I created this sandbox to show the problem ( check the console log after selecting multiple points ) Three js selection box points help - CodeSandbox
maybe its a little bit late to reply, but it might help others who have same problem.
the box selection example take the object3D position in to count, but points position were in vertex shader. you might want check every single point position in vertex.
here is example I created.
the main idea is change the fragement shader and project vertex position to camera. get the 2d position on screen and check if it is in a 2d box.
related: GPGPU
hi, is it possible to delete the selected points, I’ve been trying for days, nothing comes out…
sure, just track the selected point 's index, and create a new array
Hi, I am using potree to load pcl, how can I use selection box to select points in potree ?
the approach were basic same, but there maybe different api to change the shader uniforms.