Jump to content

Slide multiple points along curve, like Carve does.


spf987

Recommended Posts

Hi, would anyone please be able to help with the following? I've searched to no avail.

I have a curve, followed by resample. I would like to slide all of the extra points along the curve, in a similar way that you can do with one point using the Carve sop. I've been experimenting with the uv attributes and like the Shift sop, but it only moves the point number along, as opposed to the point itself.

Ideally at the end point, they 'reset' back to the start of the curve. It's been a while since I used Houdini and I imagine it's the sort of thing you can do easily with vex, but am experimenting with sop solutions.

Thanks

Link to comment
Share on other sites

Does it have to be happening on the source curve itself? I feel like having a separate set of points sliding along a fixed curve would be much easier to control.

MOPs Move Along Spline could handle this fairly easily... http://www.motionoperators.com

If you want to do it manually, what you probably want to do is create a duplicate set of disconnected points via the Add SOP or whatever, and then use xyzdist() to determine their relative positions along the parametric U of the curve. This would be done in a point wrangle, with your disconnected points in input 0 and the original curve in input 1:

int posprim;
vector primuv;
float dist = xyzdist(1, @P, posprim, primuv);
f@u = primuv.x;

Then after that's been established, you can use a second wrangle with a parameter to add to that starting @u value and lock each point to the position along the curve that matches the new parametric U value:
 

float add_u = ch("add_u");
float new_u = (f@u + add_u) % 1.0; // wrap points if they go past 1.0
vector new_P = primuv(1, "P", 0, new_u);
@P = new_P;


 

Edited by toadstorm
Link to comment
Share on other sites

Thanks toadstorm and Noobini, I also I found another example in the end which does it with one point wrangle. I'm trying to figure through all of the methods you've provided. Regarding toadstorm's method, I'm having trouble getting the second point wrangle working. Should the Run Over parameter be set to Primitives? If I leave it at Points then I'm getting an error, regarding undefined variables. Thanks again.

Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...

Hi Steven, you could use VEX to slide points along a line.

Connect a line orientated along the z axis, connect a resample to it with "Curve U Attribute: curveu" ticked then an bang on an attribute wrangle set to Run Over: Points & following VEX.

float posBias = getbbox_max(0)[0];
@posZ = fit(chramp("pos_bias", @curveu),1,0,1,posBias);
@P.z = lerp(@posZ,@P.z,posBias);
@P.z = @posZ;

Promote your chramp & adjust the points using the slider values. You can group the middle points using a group by range & have it only affect that group so it wont move the end points.

Enjoy!

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...