# Select points using SelectionBox

**URL:** <https://discourse.threejs.org/t/select-points-using-selectionbox/31969>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [November 22, 2021, 11:43am UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969 "2021-11-22T11:43:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![StreXiX](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/strexix/32/41285_2.png) [@StreXiX](https://discourse.threejs.org/u/StreXiX)\
**Post date:** [November 22, 2021, 11:43am UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/1 "2021-11-22T11:43:59Z")

</div>

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](https://threejs.org/examples/misc_boxselection.html) ) 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](https://codesandbox.io/s/three-js-selection-box-points-help-l7bnu?file=/src/index.js)

---

<div class="post-metadata">

**Author:** ![towrabbit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/towrabbit/32/6955_2.png) [@towrabbit](https://discourse.threejs.org/u/towrabbit)\
**Post date:** [October 24, 2022, 12:44pm UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/2 "2022-10-24T12:44:20Z")

</div>

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.

> **[three.js points rectangle box selection GPGPU - CodeSandbox](https://codesandbox.io/s/three-js-points-rectangle-box-selection-gpgpu-rkt5o7)**
>
> three.js points rectangle box selection GPGPU by towhare using @types/three, three

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

---

<div class="post-metadata">

**Author:** ![Knyazgori](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/knyazgori/32/40431_2.png) [@Knyazgori](https://discourse.threejs.org/u/Knyazgori)\
**Post date:** [September 29, 2023, 12:12pm UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/3 "2023-09-29T12:12:24Z")

</div>

hi, is it possible to delete the selected points, I’ve been trying for days, nothing comes out…

---

<div class="post-metadata">

**Author:** ![towrabbit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/towrabbit/32/6955_2.png) [@towrabbit](https://discourse.threejs.org/u/towrabbit)\
**Post date:** [January 11, 2024, 3:24am UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/4 "2024-01-11T03:24:01Z")

</div>

sure, just track the selected point 's index, and create a new array

---

<div class="post-metadata">

**Author:** ![Saurabh\_Jha](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/saurabh_jha/32/38708_2.png) [@Saurabh\_Jha](https://discourse.threejs.org/u/Saurabh_Jha)\
**Post date:** [April 23, 2024, 12:07pm UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/5 "2024-04-23T12:07:56Z")

</div>

Hi, I am using potree to load pcl, how can I use selection box to select points in potree ?

---

<div class="post-metadata">

**Author:** ![towrabbit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/towrabbit/32/6955_2.png) [@towrabbit](https://discourse.threejs.org/u/towrabbit)\
**Post date:** [April 25, 2024, 2:41am UTC](https://discourse.threejs.org/t/select-points-using-selectionbox/31969/6 "2024-04-25T02:41:57Z")

</div>

the approach were basic same, but there maybe different api to change the shader uniforms.
