Rival Consoles Posted February 3, 2022 Share Posted February 3, 2022 Hi, I'm trying to solve an interesting task in Houdini while I learn more about VEX and just ran into a situation where I'm not finding an answer anywhere. So, I created a voronoi sphere and then added center points on each "piece" (face) of the voronoi cells. What i'm trying to do next is to create new primitives using each center point created on the previous step. I figured out how to do that by manually adding each vertex in the code using the addvertex function but it would be a time consuming task and it would kill the procedural process. Also, I noticed that as I start creating each face by entering the center point numbers on the code, some point numbers get shuffled resulting in a wrong face sequence and winding. Attached are some images showing what I got resolved so far. That said, how can I create new primitives using the voronoi center points? I tried sorting the point order and then creating a primid that could later be used in the add sop to create new prims but because there was no primitive connecting the new center points, the resulting primid was -1. Just for reference, I tried using this code and it resulted in the negative primid: int ptorder[] = primpoints(0, @ptnum); i@sort = find(ptorder, @ptnum); i@primid = @primnum I see that there are potential functions that could help in this case like nearpoints but i'm not sure how to sort the points correctly so each primitive could be created correctly or if it even helps. Any thoughts on this would be appreciated. Quote Link to comment Share on other sites More sharing options...
animatrix Posted February 3, 2022 Share Posted February 3, 2022 Hi, If I am correct, you are trying to split the existing polygons using the original edges and the center point? If you need to preserve attributes, it gets very involved but otherwise it's not as hard. Here is a topic that discusses it in detail: https://www.sidefx.com/forum/topic/42633/ Quote Link to comment Share on other sites More sharing options...
Rival Consoles Posted February 4, 2022 Author Share Posted February 4, 2022 (edited) Hi @animatrix, Thank you for sharing some thoughts on this. After checking the post that you sent and the content, the solution from Jeff Lait seems to be very interesting. In my case, I wouldn't need to transfer the attributes to the new faces and because of that it wasn't quite clear if the definition from Jeff was using the attributes to create the faces or just to transfer them. I guess he used attribute interpolate to transfer it between faces so I guess the attributes created in the attribute wrangle was necessary for the new faces to be created. I figured out another way to get the splitting faces (or connected edges at the center of each voronoi cell), similar to the one you shared, by creating the voronoi cells using points from a remeshed geo. By doing that, each voronoi edge was split at the center by the remeshed geo edges and the remesh edges intersect at the center of each voronoi cell. Then I can just dissolve the voronoi cells edges or the remeshed edges and that way I can isolate what edge network I want to work with. It worked pretty well and without much coding. However, I'm still curious to know if there is a way to create faces, perhaps using a loop, within a cloud of points by connecting neighbor points. I found a remesh implementation some time ago that brushes on this subject. It has to do with curvature measurement, distance from points and edge creation based on curvature direction + edge length. It is quite cool but involved. I'll keep trying. Cheers Edited February 4, 2022 by Rival Consoles Quote Link to comment Share on other sites More sharing options...
animatrix Posted February 4, 2022 Share Posted February 4, 2022 Splitting faces the way Jeff shows is easy. But once you have to split edges for all polygons, it gets quite involved. This is how my Subdivide SOP looks but it handles a lot more things like preserving attributes, groups, but also fusing the faces properly without using proximity, as well as implementing a modified Catmull-Clark algorithm, etc. That's also why I put it off for a long time as it takes so much effort to accomplish this in VEX: The last ~1/3 of my VEX course is based on this topic so it's not for the faint of heart Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.