Hello. I'm wondering if there is a way to change the point (or vertex) order of some geo, in my case curves, strictly through vex code? Or, is the only way to do this to use the sort sop node?
If there is a way to do this, then how? Because simply trying to change it by, for example, @ptnum = i@id, or a setpointattrib() function does not work.
Thanks,
Dag
a way to change point order through vex code?
2402 5 0-
- Dougie0047
- Member
- 106 posts
- Joined:
- Offline
-
- animatrix_
- Member
- 5100 posts
- Joined: Feb. 2012
- Offline
Hi,
You can't do that in VEX, unless you recreate the geometry using VEX. In some specific cases, it can make sense to do that using VEX. Otherwise Sort SOP is the best way.
You can't do that in VEX, unless you recreate the geometry using VEX. In some specific cases, it can make sense to do that using VEX. Otherwise Sort SOP is the best way.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
-
- Dougie0047
- Member
- 106 posts
- Joined:
- Offline
Thanks for your reply animatrix.
Actually, I am planning on doing that - recreating the geometry in VEX. Specifically, parts of the geometry. The idea is to create new geo via vex, instead of deleting parts of the original geo.
The specific issue I have is that I would like to create geo for intersecting curves. Fine if they are just normal curves, but if I overlap a closed curve, say a square with a straight line segment I can see a couple of issues:
1 - how to recreate only the curves outside the closed curve? So not the intersecting segment inside the above mentioned square.
2 - where, on the closed curve, you have point 0 overlap with point npoint I get two new primitive segments instead of just one which is what I need. And my guess is that this has to do with point/vertex sorting, because at here the point number increases in opposite directions. Hence the original question.
So, I am very curious if there is an elegant solution to these problems? Especially inside the vex code.
Cheers and thanks again,
Dag
Actually, I am planning on doing that - recreating the geometry in VEX. Specifically, parts of the geometry. The idea is to create new geo via vex, instead of deleting parts of the original geo.
The specific issue I have is that I would like to create geo for intersecting curves. Fine if they are just normal curves, but if I overlap a closed curve, say a square with a straight line segment I can see a couple of issues:
1 - how to recreate only the curves outside the closed curve? So not the intersecting segment inside the above mentioned square.
2 - where, on the closed curve, you have point 0 overlap with point npoint I get two new primitive segments instead of just one which is what I need. And my guess is that this has to do with point/vertex sorting, because at here the point number increases in opposite directions. Hence the original question.
So, I am very curious if there is an elegant solution to these problems? Especially inside the vex code.
Cheers and thanks again,
Dag
-
- animatrix_
- Member
- 5100 posts
- Joined: Feb. 2012
- Offline
Once you get the intersection position on the open curve, you can convert the UV coordinate from the intersect function using the primuvconvert function and try to figure out which points are on each side of this hit point.
Then you can use the primpoints function to get a list of sorted points of the intersected prim, and use the above data to create 2 new prims to replace the current one.
Alternatively you can also use store a normalized scalar value per point and then use the primuv function to compare the value of this attribute at the intersected UV position to the value of each point to figure out which segment is intersecting with the closed polygon. Then follow the next section to create 2 new primitives.
Then you can use the primpoints function to get a list of sorted points of the intersected prim, and use the above data to create 2 new prims to replace the current one.
Alternatively you can also use store a normalized scalar value per point and then use the primuv function to compare the value of this attribute at the intersected UV position to the value of each point to figure out which segment is intersecting with the closed polygon. Then follow the next section to create 2 new primitives.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
-
- olivierth
- Member
- 1177 posts
- Joined: April 2017
- Offline
-
- Dougie0047
- Member
- 106 posts
- Joined:
- Offline
@animatrix
Thanks again for your reply,
I will have a look at your suggestion and see if I can make it work. Cheers
@olivierth
Thanks for your reply as well.
Using the sort node is not really what I need in this particular case, since I am planning to generate geometry with vex and will probably need to access point information and maybe sort things inside a loop etc.. Normally I do use the sort sop a lot though
Thanks,
Dag
Thanks again for your reply,
I will have a look at your suggestion and see if I can make it work. Cheers

@olivierth
Thanks for your reply as well.
Using the sort node is not really what I need in this particular case, since I am planning to generate geometry with vex and will probably need to access point information and maybe sort things inside a loop etc.. Normally I do use the sort sop a lot though

Thanks,
Dag
-
- Quick Links

