Py/VEX: Add point on prim edge

   3018   3   0
User Avatar
Member
196 posts
Joined: 8月 2011
Offline
Hi all,

Given a point with position (x, y, z) that technically lies on a prim edge (or very very close), what is currently the best way to add this point on the prim (subdividing the edge / adding a vertex)? Using Python/VEX?

I'd like to maintain attrs/UVs on the prim and just add a point. (Let's assume I know which edge I'd like to add the point to.)
I have checked https://www.sidefx.com/docs/houdini/vex/functions/addpoint.html, [www.sidefx.com] but I'm not sure if this is the right starting point.


Any input welcome!

Thanks,
m.
User Avatar
Member
30 posts
Joined:
Offline
your easiest bet may be to feed something into the polysplit SOP - figure out which edge you want to insert a point, and decode polysplit's magical syntax (eg “245e2:0.75”, which is i think “edge number: split ratio”). there are examples in the docs.

i've done some stuff with slicing polys and interpolating attributes all in vex (per face slicing), but it gets complicated real fast. best if you can piggyback on one of the factory nodes if you can.

cheers,
chrisg
User Avatar
Member
4541 posts
Joined: 2月 2012
Online
You have to delete the prim and recreate it with your new point. For attribute preservation you can use Attribute Interpolate but you still need to create UV/weight attributes (point, prim, vertices) using the parent elements of each of your new points.

I made a similar thing that slices any type of polygons (open or closed) in VEX:



Edited by animatrix_ - 2019年12月17日 23:04:56
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
User Avatar
Member
196 posts
Joined: 8月 2011
Offline
Hi guys,

Thanks for the inputs, I'll think about them.

Very cool work on that carve sop by the way!
  • Quick Links