Efficient and Precise way to group points Inside Geo?

   482   7   0
User Avatar
Member
1255 posts
Joined: April 2017
Offline
Hi!

I have 2 spheres coliding. I want to group all points from my scatter inside of those spheres. When I use the Group sop (set to Keep in Bounding Regions), it doesnt group points in the colision area.

I ended up using a boolean to combine the spheres and also split all edges to move each points appart by 0.0001 (helps a lot). But I still get some points not getting grouped inside the sphere.

Any other method to do this perfectly everytime?

Attachments:
Houdini_Group_Inside_01.jpg (797.1 KB)

-Olivier
User Avatar
Member
1255 posts
Joined: April 2017
Offline
Found a method. Same as before but with some extra steps before grouping the points.

I do an extra boolean on the side in the Shatter mode. On the shattered one, I only keep the inside polygons. I group it in a "inside" prim group before re-merging with the Unioned spheres. When I use the xyzdist, I check if I hit the "inside" primitive. If so, The points are grouped.

Attachments:
Houdini_Group_Inside_02.jpg (258.0 KB)
Houdini_Group_Inside_03.jpg (42.8 KB)

-Olivier
User Avatar
Member
42 posts
Joined: Jan. 2016
Offline
You can Merge SOP sphere geometry and convert to VDB with VDB from Polygons SOP. Then have plug it as a second input to your Group SOP and change Bounding Type to Bounding Volume.
User Avatar
Member
1255 posts
Joined: April 2017
Offline
I thought about it but it's not efficient enough for the tool I'm developing. It takes too long an requires to play with a voxel size.
-Olivier
User Avatar
Member
432 posts
Joined: Aug. 2018
Offline
If your collision objects are spheres, and there are just two of them, then perhaps another approach is to 'extract centroid' from each sphere and plug then centroid points into the second (1) a third (2) inputs of a wrangle to check the point distance from each sphere's centre, and put them in a group:

(Assuming a sphere radius of 0.5 in this example)

float dist1 = length(point(1, "P", 0) - @P);
float dist2 = length(point(2, "P", 0) - @P);

if (dist1 < 0.5 && dist2 < 0.5)
{
setpointgroup(0, "inside", @ptnum, 1, "set");
}
Edited by Mike_A - Oct. 14, 2026 17:33:17
User Avatar
Member
9738 posts
Joined: July 2007
Offline
it's not clear to me whether you want to group all the points within any of the spheres, or just within the intersection of all spheres etc

but regardless, for arbitrary geo you can use windingnumber() VEX function to check whether the point is within the geo and how deep in case the geo contains intersections


for just spheres I agree that it's better to either use points with pscale or sphere primitives and iterate over them in for loop in VEX
or depending on number of points and colliders you can also use pcfindradius() if things get heavy,

Attachments:
ts_group_inside_wn.hipnc (188.2 KB)
ts_group_inside_wn.gif (208.2 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
432 posts
Joined: Aug. 2018
Offline
Every tamte post is a learning post as far as I'm concerned : )
User Avatar
Member
745 posts
Joined: Sept. 2013
Online
A very precise way of grouping points inside sphere intersections might also be using implicit spheres.
The implicit surface operation-node comes with all sorts of boolean operations to choose from.

Edited by Konstantin Magnus - Oct. 15, 2026 12:12:37

Attachments:
spheres_intersect.png (382.9 KB)
imp_spheres_intersect.hiplc (131.5 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links