midicon Posted February 1, 2018 Share Posted February 1, 2018 This is probably not as hard as I think but I'm trying to find a way to draw a line down the center of an animated object using vex. I have a tube that is a cache and it is deforming. The points and polys don't change. I want to create a curve that goes directly down the center of the tube. I was successful by manually deleting some poly loops, and using a divide node with remove shared edges and then packing the shared faces then using an add to connect the center points, this is a quick and DIRTY way that worked. But I would like a more robust procedural way of doing this, if I had a lot of objects this way would be a pain. I have attached a .hip for if someone would like to help me out with this it would be much appreciated thanks in advance. Rob FindthecenterTest.hip Quote Link to comment Share on other sites More sharing options...
Vexosaur Posted February 2, 2018 Share Posted February 2, 2018 Like this? FindthecenterTest.hipnc 1 Quote Link to comment Share on other sites More sharing options...
midicon Posted February 2, 2018 Author Share Posted February 2, 2018 Hey Thanks for taking a stab at this! That is a really interesting solution. and it works for this example. But if I changed the geo it wouldn't work. I was wondering if there is a way that I could do it with a vol. My idea is (I just don't know the proper vex function), scatter points in the vol of the object and find the center line of the vol and push the points to the center line. Is there a function for this?? or I was thinking maybe find the center of the edge rings and then addpoint to the center of the edge ring. But Then I don't know the vex function to get the center of each edge ring. Let me know if these Ideas can help find the solution! thanks for your help Aragatory. Rob Quote Link to comment Share on other sites More sharing options...
Vexosaur Posted February 2, 2018 Share Posted February 2, 2018 Is the idea that it will always be a tube with a set number of rows and columns? Or do you want a solution that will work with more complex geometry that might not be consistent down the whole length? Quote Link to comment Share on other sites More sharing options...
coltonmil Posted February 2, 2018 Share Posted February 2, 2018 (edited) I have an imperfect solution, but it's very close, and should at least be workable. This is using a tool from the Qlib toolset called group_edge_loop. First group an edge ring of the tube (Select first edge then hold A and middle mouse click to select the whole ring). This part could use proceduralizing, I'm not sure the best way to do this though. Then use group_edge_loop_ql SOP to create groups of every loop. Promote to point group and then use pack SOP to get a centroid point for each loop. The group_edge_loop_ql SOP doesn't seem to resolve the loops on the caps correctly, so I'm removing the end points from the line. FindthecenterTest_v02.hipnc Edit: In regards to Aragatory's question above, this will only work with a tube. Edited February 2, 2018 by coltonmil Quote Link to comment Share on other sites More sharing options...
Vexosaur Posted February 2, 2018 Share Posted February 2, 2018 If it’s only ever running over a tube you could easily make my solution fully procedural by linking the group by range and vex to the number of divisions. For some thing more complex a volume and attribute from volume might be the way to go. Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 2, 2018 Share Posted February 2, 2018 (edited) I deliberately mangled the tube up to make things harder...got so close... (refrained from calling it testtube centre) ok, DQ due to being non-VEX. vu_tubecentre.hipnc Edited February 2, 2018 by Noobini Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted February 2, 2018 Share Posted February 2, 2018 Not that it solves your problem, but here is a clarification of the problem you're trying to solve: https://doc.cgal.org/latest/Surface_mesh_skeletonization/index.html At least you have the name of the problem, and one implementation in C++ / CGAL. I'm working on something related, (CGAL + Houdini) maybe it's not that hard to offload some work to CGAL.. Quote Link to comment Share on other sites More sharing options...
ItsMeM Posted February 3, 2018 Share Posted February 3, 2018 (edited) if you need to stay with a tube, maybe this will work? FindthecenterTest_vex.hip Edited February 3, 2018 by ItsMeM Quote Link to comment Share on other sites More sharing options...
ItsMeM Posted February 3, 2018 Share Posted February 3, 2018 4 hours ago, Noobini said: I deliberately mangled the tube up to make things harder...got so close... (refrained from calling it testtube centre) ok, DQ due to being non-VEX. vu_tubecentre.hipnc clooose, just one step away.. Sort pts by gradient that you can get in resample (curveu) 1 Quote Link to comment Share on other sites More sharing options...
midicon Posted February 3, 2018 Author Share Posted February 3, 2018 12 hours ago, ItsMeM said: if you need to stay with a tube, maybe this will work? FindthecenterTest_vex.hip Hey thanks for these two great solutions!! Both ideas work. This is pretty much what I had in mind! The only thing that is a cheat per-say is that imagine this is a cache so there isn't a curve to resample so get the curveu attr as easily as you did... but it looks like the only reason you did that was to get the correct order of the points and I think you can come up with this after the wrangle. The whole idea is that there is a human body 4 limbs and a torso and I find the center points of each limb and torso(basicallt creating center curves through the model) without splitting the model. I wanted to get this to work on a tube as a human character is basically cylinders. with this solution I would still have some work to do in splitting the mesh and find the rows and colls. This is a great step in the right direction, thank you for this! Rob Quote Link to comment Share on other sites More sharing options...
lloydwood Posted October 1, 2018 Share Posted October 1, 2018 On 2/2/2018 at 10:32 PM, Noobini said: I deliberately mangled the tube up to make things harder...got so close... (refrained from calling it testtube centre) ok, DQ due to being non-VEX. vu_tubecentre.hipnc On 2/3/2018 at 3:04 AM, ItsMeM said: clooose, just one step away.. Sort pts by gradient that you can get in resample (curveu) If you don't have the original geometry and therefore no access to that initial resample. This should work. vu_tubecentre_end_bit.hipnc 3 Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 11, 2018 Share Posted October 11, 2018 (edited) On 10/1/2018 at 6:00 PM, lloydwood said: If you don't have the original geometry and therefore no access to that initial resample. This should work. vu_tubecentre_end_bit.hipnc ..well that was simple...why didn't I think of it ??? Edited October 11, 2018 by Noobini 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.