I've probably overthought this and missed the obvious--I have multiple different groups of points (a changing number, this has to be scalable), and I want to create polylines between the border points--essentially connect adjacent pieces, but only pieces that are not in the current group, instead of only pieces that are.
(The end result is creating prims to use as glue constraints in a grain setup connecting clusters of points. Because there are gaps between the chunks (and those gaps are where I want to form my polylines) using the connect adjacent pieces doesn't work because all adjacent points are found before the necessary distance has been covered. It's for a softbody tearing sim using grains for point deformation to compensate for vellum welds not accommodating solid objects--project file in this post: https://forums.odforce.net/topic/50110-vellum-welding-fractured-solid-or-extruded-objects/)
Connecting adjacent points but of a different group
3325 4 2- bentway23
- Member
- 111 posts
- Joined: April 2014
- Offline
- aweaklingchild
- Member
- 23 posts
- Joined: April 2012
- Offline
You can do this with two sets of vellum glue constraints. "Intra cluster" constraints to hold the grains within the clusters together and "inter cluster" constraints hold the different clusters together near their borders. The trick is to use the cluster attribute in the "Cluster Attrib" parameter on the intra node and in the "Piece Attrib" parameter on the inter node.
- bentway23
- Member
- 111 posts
- Joined: April 2014
- Offline
Beautiful, thanks! I was tipped off to the the "inters" on an Od/Force thread, but the intra is good to know, too, definitely.
I dove into the vellum constraints node to see where the prim creation happens to see if I could just steal that small part to do this same setup but not for dynamics, simply for connecting points of separate groups. It looks like the magic in the glue constraint creation hinges on a "createGlueConstraints" function which appears to be not accessible to layfolk and possesses no context help info. However, I suppose for a quick hack to connect points from different groups, it's easy enough to build them using the vellum glue constraint and then delete all the dynamics attributes. (I'm pretty convinced there's a less ugly way, though, probably just doing a point-by-point group membership or attribute match lookup and blasting prims where both points are of the same group. The search continues!)
I dove into the vellum constraints node to see where the prim creation happens to see if I could just steal that small part to do this same setup but not for dynamics, simply for connecting points of separate groups. It looks like the magic in the glue constraint creation hinges on a "createGlueConstraints" function which appears to be not accessible to layfolk and possesses no context help info. However, I suppose for a quick hack to connect points from different groups, it's easy enough to build them using the vellum glue constraint and then delete all the dynamics attributes. (I'm pretty convinced there's a less ugly way, though, probably just doing a point-by-point group membership or attribute match lookup and blasting prims where both points are of the same group. The search continues!)
- bentway23
- Member
- 111 posts
- Joined: April 2014
- Offline
Addendum--a not-difficult way to do it (and hopefully I'm not gumming up the forum with the obvious)--use the "name" sop to create a name attribute from each point's group. Use connect points to make the prims, then in a primwrangle you just have to compare every prim's two points to see if they belong in the same group, and remove them if they do.
int pts = primpoints(0, @primnum);
string name0 = point(0, "name", pts);
string name1 = point(0, "name", pts);
if(name0 == name1){
removeprim(0, @primnum, 1);
}
My fear with this is that it's probably pretty inefficient since it very heavyhandedly grinding through every primitive.
int pts = primpoints(0, @primnum);
string name0 = point(0, "name", pts);
string name1 = point(0, "name", pts);
if(name0 == name1){
removeprim(0, @primnum, 1);
}
My fear with this is that it's probably pretty inefficient since it very heavyhandedly grinding through every primitive.
- animatrix_
- Member
- 4703 posts
- Joined: Feb. 2012
- Online
Hi,
I normally do this with attributes but you can do the same with groups. You could either do a point cloud look up and then only use the point that has the group of the opposing group to the current point, or better way would be to supply the group name to the point cloud look up function.
I normally do this with attributes but you can do the same with groups. You could either do a point cloud look up and then only use the point that has the group of the opposing group to the current point, or better way would be to supply the group name to the point cloud look up function.
string group1 = chs("group1"); string group2 = chs("group2"); string targetGroup = group1; if ( inpointgroup ( 0, group1, @ptnum ) ) targetGroup = group2; int pts [ ] = pcfind ( 0, targetGroup, "P", @P, ch("radius"), 2 ); if ( len ( pts ) > 1 && @ptnum < pts [ -1 ] ) addprim ( 0, "polyline", @ptnum, pts [ -1 ] );
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
-
- Quick Links