flow along curve like in Rhino 3D in Houdini?

   6195   17   1
User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
Hi,

I thought this would be an easy one, but I didn't find a way how to let an object flow along a curve.
In Rhino 3D this command is called "flow along curve [docs.mcneel.com.s3.amazonaws.com]".
From the docs:
The Flow command re-aligns an object or group of objects from a base curve to a target curve.

Use the Flow command to map a flat, straight shape to a curved shape, since it can be easier to draw things when they are lined up than to draw a complex shape around a curve.

Anything like that possible without heavy coding in Houdini?

Cheers
User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
41 views and no ideas? Ok, then this seems to be somewhat difficult to do in Houdini
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
It's probably for two reasons.

You already stipulated ‘without heavy coding’.

And your also asking for a ‘tool’ similar to Rhino.

Remember this Rhino tool, has heavy coding under the hood to do what it does.

It was also created in the context of the Rhino environment.

Your best bet is to start off with what do you want to do specifically, providing a hip file as example in your attempt.

Start simple and you will likely get some suggestions.

And from there you can build upon your approach to develop your own similar tool that will work in different contexts/situations.

And if that becomes too much ('heavy coding') you might just be good enough to know how to do what you want as far as results are concerned for a specific scene context.

As for starters you could look at this hip file and ask for help in how to refine the process to suit your needs.

It would be good to look at Houdini as a ‘tool building’ environment that can require ‘heavy coding’, but you might just get away with some simple setup.

Again as before, start of with an example hip file with your attempt to accomplish what you want.
Edited by BabaJ - May 14, 2019 10:37:51

Attachments:
Rhino Starting Point.hiplc (99.0 KB)

User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
Hi BabaJ,

thanks for your explanation and your help.

Houdini has so many nodes (even without the great GameDev Tools) that I thought that maybe I just missed the the appropriate node.
I searched the internet for any example, but couldn't find any. I know from other 3D programs(besides Rhino) that can deform or warp an object to a sphere or a curve, so I guessed that it may be simply buried somewhere inside Houdini and I just couldn't find it.

Your example is very nice and helpful, but not what I meant. I need to deform! an object along a curve. I know there are other ways of doing things in Houdini, but this would have been a nice and easy way.

In my case it was for creating a ring. having the ring just flat out like a steel bar, making all kinds of nice stuff on it and then finally swapping it around a circle curve. This is such a standard (but most helpful) command in Rhino that I wanted to try it out in Houdini, because I like the node stuff

Avoiding the heavy coding is only, because I am not such a great coder and I don't believe that I would be able to produce anything useful in a normal time (before Houdini 20 that is ) AND I am trying to use Houdini the normal3duserway, not especially the proHoudiniway (even if this may sound like total newbish blasphemy ) Maybe some day when I am more proficient with Houdini I may get more into coding, but hey, why are the GameDev-Tools being developed? Because of these normal3dusers

But enough of that, not everything must be done inside Houdini when it's much easier done with an other Tool. Was just my curiosity IF it could be done using plain Houdini nodes and I had missed the correct node.
User Avatar
Member
472 posts
Joined: July 2005
Offline
Hi,

what you want is a path deformer, but unfortunately there is no inbuild version of it. But I think there is a path deformer in GameDev tools. And you will find many examples in this forum aswell.

Rhino has two options: rigid = Yes/No.
“No” is equivalent to a usual path deformer since it just deforms the geometry along the path.
“Yes” will preserve the shape and it is like if you just copying an object along a deformed curve (which is deformed by the path deformer itself).
Edited by Aizatulin - May 14, 2019 16:26:32

Attachments:
path_frame.hipnc (284.3 KB)

User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Here's an example you might want to look at to see if it's ‘too much coding’.

If you go in the object node “Object Creation” there is the ‘Control’ node colored red.

You can use the parameter there to select one of the 3 different curves.

This particular set up was made to only work with nurbs curves.

So long as it's a nurbs curve and generated on the x/y plane…it should work for any curve you make; You might want to try some of your own.

Some things that would still need to be worked on this is making choices available of whether or not to scale/deform the objects along the the curve they are being applied too.(curves much longer than the original span of objects created would get stretched/distorted along the curve. Option could be made to simply keep dimension ratios intact but just shift the objects along the curve rather than across the entire curve length.

Actually not too much coding to do this. The meat of it is only 16 lines of code in the orange colored wrangle in the object “Object_Deformation”.

There are some loose ends that need to be taken care of…but hope this satisfies your curiosity of what it might take.
Edited by BabaJ - May 14, 2019 23:03:05

Attachments:
Rhino Starting Point v1.hiplc (348.0 KB)

User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
Oh wow :O!

Path Deformer was the term I searched for. Why do these things always have to have other names…?

@Aizatulin, thanks for the file, it's a perfect flow along a curve, but no deform or am I wrong? But in any case, it is helpful.

@BabaJ, wow, this is not only a perfect path deform (although I don't really understand the coding part , in parts yes, you take the length of a curve and then do some magic with the points distributing the scaled object along the curve..) but it's also a perfect file for the the organization inside of Houdini. So thanks for both.

Furthermore -now with the correct term - I have found several nice other links regarding this subject…

Houdini Vex Path Deform - Version 3(https://vimeo.com/247900360)
http://www.entagma.com/rebuilding-the-c4d-spline-wrap-deformer-in-houdini/ [www.entagma.com]

And another pour soul like me https://www.sidefx.com/forum/topic/53867/ [www.sidefx.com]

And like mentioned, the Gamedev Tools Path_Deform SOP.

Okayyy, I think I now have enough possibilities and also a nice coding example ( I have yet to understand )

So thanks to all for the help!
User Avatar
Member
236 posts
Joined: March 2015
Offline
Hi, I know this probably isn't what you're looking for but if you just need to deform a bar or whatever into a circle, you could use the bend sop.

I've done quite a few projects based on this concept like braided straps and stents etc. ie. Create a segment of the pattern flat, copy & transform into a line and bend it into a circle.

Attachments:
Bar_Ring.jpg (61.3 KB)
Bar_Ring.hiplc (159.8 KB)

User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
On the node named “Warp”…I've added a couple lines of code as conditionals.

Although in the original example it didn't happen,

points past a very small threshold distance along the x-axis towards the end of the line,

will have their orientation flipped.
Edited by BabaJ - May 15, 2019 10:12:19

Attachments:
Rhino Starting Point v2.hiplc (348.2 KB)

User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
robsdesign
Hi, I know this probably isn't what you're looking for but if you just need to deform a bar or whatever into a circle, you could use the bend sop.

I've done quite a few projects based on this concept like braided straps and stents etc. ie. Create a segment of the pattern flat, copy & transform into a line and bend it into a circle.

Oh wow (again) I tried Bend once, but probably didn't use it correctly. It really can perfectly deform into a circle. So thanks too, for that enlightenment
User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
BabaJ
On the node named “Warp”…I've added a couple lines of code as conditionals.

Although in the original example it didn't happen,

points past a very small threshold distance along the x-axis towards the end of the line,

will have their orientation flipped.

See, that's the difference, you understand what you are doing, me it's more binary, does what I want it to do then cool, else not cool

Thanks for the update!
User Avatar
Member
472 posts
Joined: July 2005
Offline
If interested,

here is a simplified version of the path deformer (very basic but with some comments).
The rough idea behind:
You have two inputs: A geometry and a curve.
For the first step you resample the curve to make a polycurve with equal distances between each points.
After this you create tangent and normal vectors for each point as an attribute (using a polyframe is an option).
Now you have enough to deform the geometry along the path.
You can use the relbbox function to get relative x-value of the geometry. This value should 0 for smallest and 1 for the biggest x-component.
Now you can use external parameters to fit this value to another interval (to influence the length along the path).
After you have projected each point onto the y-z-plane (setting x=0), you can use the curve attributes and the relative x-value to create a rotation matrix and the curve position vector to transform the point from y-z-plane into the curve space.
It is like cutting the geometry into thin slices and moving them into the zero point. From the center you can apply your transformations.
Edited by Aizatulin - May 15, 2019 15:43:36

Attachments:
pathdeform_basic.hipnc (238.8 KB)

User Avatar
Member
21 posts
Joined: Jan. 2016
Offline
Ok, I guess now we have all possibilities through I noticed that with your solution the resolution must be quite high to deform well. I tried with a simple box as nurbs and had to set the division to 80/810/10 to have a nice deform.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
What Aizatulin did is basically the same as what I did.

I was originally going to provide an example like that, but took the opportunity for my own personal curiosity to see if it could be done without having to do a ‘polyline’ curve highly re-sampled.

The smaller the distance between the points the more ‘accurate’ the tangent.

On my node named ‘Wrap’ there's the parameter labelled ‘U_Offset’. This is basically the distance away from the position on the curve being considered to get a tangent. I locked that parameter with a value of 1e-05.( the ‘equivalent’ of the distance set from re-sampling between two points of a polyline).

So essentially my example too is using a ‘high re-sampling of points’, just without the points.

In either case though, Aizatulin or mine, there is no true tangent and technically not an ‘accurate’ deform from the original to the curve.

Unlock that U_Offset parameter and give it a higher value of say 0.1, and you will see it starts to give a ‘bad’ result, or even a much smaller value, where floating point errors start to creep in because the values are too close to zero and the coding is not dealing with that.

In order to get a true tangent, it would take implementing some derivative(calculus) function.

For me, that's where the coding starts to get heavy - I don't have a clue how to implement that. Maybe 30 years ago when I did do calculus and knew it well enough at the time to write a function.

Looking over the vex functions available it seems there are some that might help, but those functions appear to be only available in the shader context of Houdini.

Might be worthwhile (myself) to put in an RFE.

One thing I loved about working in Solid Works…being able to get a true tangent(derivative created) of any type of curve.

Not important for visual representation (can't tell the difference visually) but it is important for industrial design where measurement tolerances/relationships can be critical…but hey why use FX software for such…but I digress from too much morning coffee.
Edited by BabaJ - May 16, 2019 09:34:02
User Avatar
Member
472 posts
Joined: July 2005
Offline
Usually the tangent is quite stable, even you calculate it numerically. But the normal, which needs the second derivative can be very inaccurate and you will have flipping issues aswell.
Polyframe can handle this problem quite well, but sometimes you will have artifacts.
There is a better method called parallel transport, which uses an initial normal and rotates it with same amount from point to point as the tangent changes, using the vector as axis from the cross product of the old and the new tangent.
But probably it would be the best way, if you can calculate the tangent (and normal) from the curve parameterisation itself.

Another thing, which I've just figured out, is that in the Rhino example they used an input curve, which looks like that they captured the geometry. In this case they probably inverted the path deformer to make a curved geometry “straight” to be transformed in the usual way to the target path. I haven't tried Rhino yet so I'm not sure.
Edited by Aizatulin - May 16, 2019 18:24:38

Attachments:
pathdeform_basic_B.hipnc (254.2 KB)

User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
I have a copy of Rhino.

You create or use existing curves in your ‘scene’(neither have to be straight).

The flow command takes the objects selected and

places them offset the same relative distance from the first selected curve to be the same offset distance on the second selected curve.

Either curve can be used as initial reference.

With options of allowing stretching, keeping rigid(orientation - objects are only ‘translated’) and a couple others I haven't explored;

Of the objects to be ‘transformed’.

And the process is parametric.
Edited by BabaJ - May 16, 2019 22:34:51
User Avatar
Member
472 posts
Joined: July 2005
Offline
Ok.

If the first curve has the shape of the geometry will it straighten the geometry?
For example if you have 3/4 torus and a 3/4 circle and as target a straight line, I am expecting, that the result will straight aswell.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Yes…it will do that as ‘expected’.
  • Quick Links