Generate points/path programmatically in a network?

   3088   9   2
User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Hi,
I'm new to Houdini and searching didn't yield an answer to my question.

After watching the Pipes & Hoses tutorial, I'm trying to generate simple tubular handrails for some geometric platforms. I know where the rail anchors go, and the path is a simple 3 segment “U” shape and I'd like to be able to generate these points/path in my network rather than drawing the curve or loading it from disk. Once I have the path, I can do a sweep to form the rail.

Is this possible?

Thanks!
Brett
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
You can use the Add SOP to add points and then connect them in order to build your curve.

Add SOP can also be used to create curves from input points.

Many times you can isolate unshared edges to generate profiles as well. That you can do with either a Group SOP>select unshared edges in to an edge group followed by Blast or the Delete SOP.
There's at least one school like the old school!
User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Thanks Jeff! That got me moving and I got it working the way I want.

I created my points, and then fed this into a curve and tried to sweep a circle with it but it looks like I'm doing something wrong on my curve. I have attached a screenshot and I can see the 4 points okay but the sweep didn't work and I assume it's because they're points and not forming a curve?

Attachments:
Curve-Sweep Problem.jpg (213.7 KB)

User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Looking at this more I see that the input is not a set of points but rather snapping points.

So instead I tried to put an expression into where the points should go and that doesn't seem to work either. I'm guessing I can't use a channel directly like this where the points are normally specified?

ch(“../left_rail/points”)

Is there some way to get the points out of the Add SOP and into the points field of the Curve SOP?

Attachments:
Points into Curve.jpg (45.8 KB)

User Avatar
Member
184 posts
Joined: June 2010
Offline
Hey Brett,

pointlist function, pulling points from a group is what you'd probably want normally, encapsulated in backticks i.e.

`pointlist(“../group1”,“group1”)`

However, Curve SOP wants points presented as p0 p1 p2 …etc., and pointlist returns 0 1 2… you could probably solve this with an Attribute Wrangle, but then you may be adding more work than you want.

That said, you might get better results listing hard poly edges in the Add SOP, chamfering/filleting your corners with i.e. Carve SOP or something more elegant (i.e. http://forums.odforce.net/index.php?/topic/14293-chamfering-curve-points-in-houdini/ [forums.odforce.net] ), and Resample/Refine SOPs.

Quicky attached.

Edit: If you need NURBs or Bezier CVs then you can just chuck in a Convert SOP after the Add SOP.

Attachments:
railing.hipnc (51.0 KB)

User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Hi Adam,
Thanks very much for your reply and sample.

Your example file is exactly what I'm trying to do and works. I looked at it and modified mine so it's similar, but I can't seem to figure out why yours works and mine doesn't.

Mine creates a strange sweep around the scene…

Attachments:
Platform Test.hipnc (56.2 KB)

User Avatar
Member
184 posts
Joined: June 2010
Offline
Yeah the sweep doesn't like the source Cross Section not being centred.

The attached fixes it here…

I just moved the T references from rail_shape to a Transform SOP after the sweep - it has the same effect.

I added a couple of other minor fixes, explained in the sticky note in the attached hip.

I thnk setting the position in the Transform is probably a nicer way to handle this sort of thing anyway. It makes it easier to create completely different railings & geo upstream - path based, mesh bashed, whatever - and position/orient them with a single xform.

Attachments:
platform_test.JPG (19.2 KB)
platform_test_944b.hipnc (60.9 KB)

User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Wow, Adam you're awesome! Thanks for taking time to help on this.
User Avatar
Member
12 posts
Joined: Aug. 2013
Offline
Thanks again for this. I understand how it works and learned a lot from this.

In the Add points SOP if I uncheck “Closed” then the bottom of the rail is larger than the corners. This is because the corners use the rail shape but rotate it 45 degrees which effectively changes the size/shape of the sweep and makes it look smaller (taper) as it approaches the corner, whereas the bottom anchors reflect the full circle shape since they aren't rotated.

Is there any way to fix this? E.g. how can I get the rail and corners to keep the rail shape?

I saw in the Pipes & Hoses tutorial they separated the straight pieces and corners into different networks, but this seems more complicated than I need to make it?

Thanks again!
User Avatar
Member
184 posts
Joined: June 2010
Offline
Yeah, this is why it's best to implement some kind of corner filleting so you have a consistent profile match along the V of the sweep - there's a few ways you can approach this.

Simplest would be using someone else's existing HDA (search roundedcorners in the forum - handy otl from edward from some time ago)…this gives the extra advantage of being able to modify the corner radius procedurally (and that of course is the main reason we're all here to begin with ;-)).
  • Quick Links