Jump to content

Uvs On Polygons, Xyzdist Bug?


emcjagger

Recommended Posts

Hey folks,

The following was posted on the sidefx forum a little while ago, and as of yet has received no replies, so I'm trying here. The sidefx link:

http://www.sidefx.com/index.php?option=com...p;p=46994#46994

Hello,

I have a poly tube that passes through a poly grid, and I'm trying to smoothly join the top of the tube to the outside of the grid and discard the rest. I've tried a number of approaches, including the cookie sop (funny help for that!), but currently the nicest solution seems to be: delete tube points under the grid, delete the grid points inside the tube, and then snap the edge points of the tube to the nearest prims of the grid. I tried to do this like so:

For each tube edge point:

Get the nearest grid prim number using pointdist().

Get the uv coords of the closest part of that prim using xyzdist().

Move the point to that part of that prim using primuv() and a Point SOP.

However, I encountered a couple problems. First of all, the u coordinate returned by xyzdist was often well above 1, and the v coordinate was always 0. This may be related to buggy behaviour of pointdist() with polygons reported here:

http://www.sidefx.com/index.php?option=com...light=pointdist

Secondly, I found when I manually adjusted the uv coords used with primuv, changing v had no effect, but changing u from 0 to 1 caused the point to move all the way around the perimeter of the polygon. Is this the way polygon UVs work, ie. u is mapped around the perimeter and v does nothing? That would be fine by me, as long as there was some equivalent to xyzdist() that returned a corresponding value.

I've included a hipnc to illustrate this. It also contains a branch that snaps the tube edge to the nearest grid points instead of nearest prims, which works properly, although it results in a lot of fanned triangles. Any input most welcome, either about these specific xyzdist() and poly uv questions or about the more general problem of smoothly intersecting and joining polys.

Thanks,

Jeremy.

primuvDemo.hipnc

Link to comment
Share on other sites

Hi again -- just updating to keep this thread in sync with the parallel thread on the sidefx forum...

I managed to get the effect I wanted with xyzdist()/primuv() stuff by using the ray sop. I extruded the grid hole upward so that that it encircles the tube, like a sleeve. I then used the ray sop to flare out the edge of the tube to make it touch this "sleeve", and another ray sop to pull the edge back down to join the original grid geo. So I've gotten the grid hole and the severed tube edge to be as close to each other as I can -- but of course, there are still cracks between these two surfaces, because their topology does not match.

So, my next challenge is:

-Subdivide the tube edge so that a new point is inserted for every point on the grid hole (see circled areas of attached pic).

-Make sure the tube edge points all lie precisely on the grid hole (they currently don't, see pic).

-"Fuse" the tube to the grid, so that all the points that join them belong to both geometries + there are no holes (even 0-area ones).

Any suggestions?

Thanks,

Jeremy.

ps. I'm still curious about how uvs work on polys, + whether there's anything amiss with xyzdist() and primuv()...

post-1730-1191964306_thumb.png

primuvDemo.02.ray.hipnc

Link to comment
Share on other sites

The way I do this is slightly different.

I have a node called "snapto" you can get it here Houdini Tools (its on the vex page)

I use a divide sop with the remove shared edges option on the grid, supply the output of this as the second input to my snapto, and supply a group of the points to snap (probably the same as your ray group) to the first input.

After that I fuse the result and then use another divide remove shared edges to find all the holes, you can then merge these polys back with the originals (for some reason everytime you do a remove shared edges the reulting polys are flipped so you need a reverse sop too so as to sort out the direction of the prim normals)

For this final step you could also use a polycap I believe, my way is old school.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...