UVs on polygons, xyzdist bug?

   5866   5   2
User Avatar
Member
36 posts
Joined: Aug. 2006
Offline
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_forum&Itemid=172&page=viewtopic&t=9140&highlight=pointdist [sidefx.com]

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.

Attachments:
primuvDemo.hipnc (80.1 KB)

User Avatar
Member
36 posts
Joined: Aug. 2006
Offline
Anyone….???
User Avatar
Member
454 posts
Joined: July 2005
Offline
This is potentially a tricky problem because topologically speaking you are kind of adding a “handle” to your grids. The way I approached this involved using nurbs surfaces, however you could procedurally do it using polys if needed. In either case you kind of need to dramatically reconstruct or completely re-model the surfaces involved. I'm guessing that is unavoidable. See this for some reasons why: http://en.wikipedia.org/wiki/Topology [en.wikipedia.org]

In any case take a look at tyhe attached hipfile. Theblue nodes produce the best solution I found so far, the green and red may be interesting as well.

Cheers

Attachments:
primuvdemo_772_tstex.hipnc (111.1 KB)

User Avatar
Member
36 posts
Joined: Aug. 2006
Offline
Thanks for looking at this. Hmm… yes, a colleague of mine suggested using nurbs for this. I'm pretty committed to using polys for the initial 2 geometries (which will eventually not be just a sphere and plane), and I'm afraid that converting them to nurbs (and maybe back) will get messy, but maybe I can manage to just do the joining portion in nurbs, convert it back to polys, and merge it with the original geo.

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()…

Attachments:
primuvDemo.02.ray.hipnc (123.2 KB)
crackSnapshot.png (90.0 KB)

User Avatar
Member
454 posts
Joined: July 2005
Offline
The main suggestion I'd make is to start modeling with the connection edges so that you can guarantee the 1:1 match up of points to get a seamless join. I had a quick look at this new hipfile, and even if you could snap points to each other using an attribtransfer of P or whatever, you'll get all sorts of nasty pinching if your join edges don't match point for point. Getting an evenly divided circular sub-division from a grid is looking tricky at face value. Because you'd probably want to have grid prims hook up to the new circular connection points, it's touch and go whether you could do it without getting into the HDK. Someone may prove me wrong though.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
You don't have a 1-to-1 topology match. Use the PolyLoft SOP to knit the two edges together.

See the modified example file. I lifted the ray a bit to see the loft.

The idea is to model with a gap THEN fill the seam with the Poly Loft procedurally. You can even pass in a locked down version at rest to in to the right input to stabilize the generated infill surface.


Use the help and the example files next time. The Poly Loft has a nice example showing something very similar to this.
Tip: When you have idle time, always cruise the example files in the help.

Attachments:
primuvdemo.02.ray_724_jw.hipnc (110.2 KB)

There's at least one school like the old school!
  • Quick Links