sweeping geometry along curve depending on angle to ground

   10528   9   1
User Avatar
Member
3 posts
Joined: April 2013
Offline
Hello, I've got a problem with my houdini project that I've been stuck with for quite a few days now (a kind of outdoor-mountain-path/staircase), and Google just didn't give me the information I needed.

As the title says, I want to sweep/copy different geometry along a curve depending on the curvature (even though I'm not sure if that would be the right value). The curve itself had been resampled, so I actually need the angle to the xz-plane per point, which I tried to get with a measure node plugged into the output of the resample. The geometry pieces are ready, all that's missing is the right expression in the switch node I attached them to, which leads to the sweep.
Something else I tried was copying 2-point-lines along my curve to get tiny tangents per point. I remember having learned calculating the angle between those and the ground plane in high school, but that seems to go a bit far; there must be an easier way to do this.

However, as I am a beginner who started learning Houdini only a month ago, I have no idea how to continue. I constantly want to create some if-statements as in “if angle to ground >70 degrees, use input 2, else if…”, but for this course we are not supposed to start scripting as everything seems to be doable with nodes. Moreover, how will Houdini know which geometry to choose before sweeping? Wouldn't I have to create some sort of for-each-loop and first check for the angle, then place the geometry, and then increase the point index by 1 to go to the next one?
User Avatar
Member
8582 posts
Joined: July 2007
Offline
you can use VOP SOP co compute angle per point (EITHER by recreating vector from previous and/or next point OR by getting the N from the terrain (directly in Ray SOP you probably used to project the curve) and use that N to compute your angle)
then Blast SOP or Delete SOP to delete points with lower angle than you want

resulting points can be used to Copy or Sweep whatever you want on them
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
As tamte said.

Using the Ray SOP, it is easy to transfer all the hit attributes to the points and then do whatever you want. You can use a Measure SOP and measure curvature.

You can also add an orientation attribute that is the dot product between the surface hit normal and an up vector set to 0,1,0.

You can put any attribute you want on the surface and pick it up: colour, terrain type, etc.

Attachments:
ray_pick_up_curvature.hip (100.4 KB)

There's at least one school like the old school!
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Hi Jeff,
Good to see an example of the point wrangle sop in action. Is using point wrangle and vex snippets faster to process that than using a point sop to set vectors ? My last question is

@P = @P.y < -0.5 ? set(@P.x, -0.5, @P.z) : @P;

whats going on with the code I can see your setting P but that's about all I understand.

Rob
Gone fishing
User Avatar
Member
3 posts
Joined: April 2013
Offline
Thank you for your help, jeff and tamte - I hadn't even thought of eliminating the points per sweep that I don't want to be used.
Apparently, what I wanted to do is not as easy as I thought, which is probably because I only know a handful of nodes. I don't really understand how to use a VOP SOP, and the file attached by jeff gives me errors on opening. Both vopsops in the point wrangles show an “error in ‘vfilter1’”, and inside the node “not enough sources specified”. Could that be because I'm using v12.1?

What I understand from the file is that you seem to be placing either a box or a torus along the rayed curve, while the expression in the switch node says sth about curvature… would that be in degrees?

Just had another look at the help files - is it correct that I can change the normals of the projected pointsinto those of the surface they are hitting by checking the “Point Intersection Normal” in the ray node? Then I could create an attribute to calculate the dot product between (0,1,0) and the new point normals and get my angles, which I have to add to each point as an atribute. Finally, I'd write angle>= whatever in the switch expression and that would be it?
Sounds overly simple to me now, and it might even be partially what you said. Just need to sum it up for myself.
What kind of expression do I need to access the normals of every point and then store the angle as an attribute for every point?

Sorry if this becomes confusing, I am definitely lacking experience in the software…
User Avatar
Member
8582 posts
Joined: July 2007
Offline
circusmonkey
Hi Jeff,
Good to see an example of the point wrangle sop in action. Is using point wrangle and vex snippets faster to process that than using a point sop to set vectors ? My last question is

@P = @P.y < -0.5 ? set(@P.x, -0.5, @P.z) : @P;

whats going on with the code I can see your setting P but that's about all I understand.

Rob

it is faster than Point SOP because it gets translated into VEX, so the speed should be the same as VEX or VOP operator (well it actually is a VOP SOP inside)

that expression seems to clamp P.y at -0.5 (in other words if P.y < -0.5 set P.y to -0.5 otherwise keep P.y) so you can as well just use
@P.y = max(@P.y,-0.5);
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8582 posts
Joined: July 2007
Offline
Kady06
….

What I understand from the file is that you seem to be placing either a box or a torus along the rayed curve, while the expression in the switch node says sth about curvature… would that be in degrees?

Just had another look at the help files - is it correct that I can change the normals of the projected pointsinto those of the surface they are hitting by checking the “Point Intersection Normal” in the ray node? Then I could create an attribute to calculate the dot product between (0,1,0) and the new point normals and get my angles, which I have to add to each point as an atribute. Finally, I'd write angle>= whatever in the switch expression and that would be it?
……

curvature is not in degrees but that doesn't really matter as it describes the same thing

and yes that's what I was talking about checking the Point Intersection Normal and computing angle from dot product
then for example using it to group only points within threshold and use only that group to copy something
here is the example for that
it should work with 12.1 as there are no pointwranglers or other 12.5 specific nodes

Attachments:
copy_by_angle.hip (134.1 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
circusmonkey
Hi Jeff,
Good to see an example of the point wrangle sop in action. Is using point wrangle and vex snippets faster to process that than using a point sop to set vectors ? My last question is

@P = @P.y < -0.5 ? set(@P.x, -0.5, @P.z) : @P;

whats going on with the code I can see your setting P but that's about all I understand.

Rob

c style if statement. It's a simple one-liner way of putting in an if statement. Since I like to use trivial single line if conditionals, it makes a lot of sense to memorize this form. The alternative is a multi-line traditional if statement workflow.

This conditional statement is used in a lot of the vex functions including max() I believe.

The initial condition is if P.y is less than -0.5 followed by ? which you then put the expression to evaluate if true, then : then the expression to evaluate if false.

If true, the set(@P.x, -0.5, @P.z) vex expression is used to set vectors very efficiently.

If false just return P.


Btw I always like to throw these things in there so thank-you for picking it up and asking! I'm lovin' these Wrangle based SOPs as you can throw around vectors, matrices and arrays very efficiently as it is vex. Faster than the Point SOP.
There's at least one school like the old school!
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Hi Jeff, thanks for the reply , I think its time for another Jeff Master class video on the wrangle SOP to cover vectors, matrices and arrays !

Rob
Gone fishing
User Avatar
Member
3 posts
Joined: April 2013
Offline
Thank you for the demonstration via the file, tamte.
I ended up coloring the curve in red depending on the NY of each point. Then I deleted all non-red points and used the remaining ones for copying (or vice versa).
For this task I am not supposed to use VOP SOPs.
  • Quick Links