Smooth Interpolate Curves connecting to Geometry Houdini using curveu attribute
- Deepak KG
- Sep 19, 2020
- 2 min read
Connecting points using "add" SOP is easy. And connecting multiple points using an attribute such "id" is even easier and FUN.
Now to say.... We have a Geometry and that Geometry have curves coming to it directly for SOME PURPOSE. Eg;

So, using the "add" SOP and id attrib we can get this. Right?
But still not SMOOTH though.
We add "smooth" SOP now.

With "smooth" SOP we get this.
Doesn't look at all PROMISING.
Something's missing.....
How about this image below???? Looks good eh???

Let's see the whole bunch of CURVES...

Here's how we can Achieve this entire EFFECT....
Things we need for this OPERATION
"curveu" attribute using the "resample" SOP.
assemble the curves for "name" attribute. (Skip this step if you have only one Curve)
Make sure that the Curve have normals exactly like as in the Geometry. Eg;

Make sure to resample the curve to get a smooth result with a "smooth" SOP.

Now if you see above that the other ends of the curve also have Normals. That's because I've added the end Points with normals set to @N = set(1, 0, 0);
Reverse the "normal" attrib from the mid point of each curve or curves. (Reason : We have to push the curves towards the "Normal" direction that is coming out of the surface A and Surface B. Only Surface A if you have the curve connecting only ONE surface. Just like in the Example above.)

The image above after Reversing the Normals from Mid point.
Now the Final Wrangle.
float curveFirstPoint = chramp("First_Point", @curveu);
float curveLastPoint = chramp("Last_Point", @curveu);
float curveUBias = curveFirstPoint + curveLastPoint;
int lastPoint = @numpt - 1;
vector firstPointPos, firstPointNormal, lastPointNormal, lastPointPos, interpolatedPos;
firstPointNormal = point(0, "N", 0) + chv("Change_First_Dir");
lastPointNormal = point(0, "N", lastPoint) + chv("Change_Last_Dir");
firstPointPos = firstPointNormal * curveFirstPoint * chf("Stretch_First_Vector");
@P += firstPointPos;
lastPointPos = lastPointNormal * curveLastPoint * chf("Stretch_Second_Vector");
@P += lastPointPos;
interpolatedPos = lerp(firstPointPos, lastPointPos, curveUBias);
@P += interpolatedPos;
And the UI.

The code is using the Normals to Push the points along the Vector and Curveu is used to Control the Ramp Slope to how much and how far the influence goes. The Stretch Vectors is the Length of how much far you want the Gradient to be.
GO NUTS...
Comments