0
$\begingroup$

I am looking for a solution to my problem: i want tubes to follow a curve/path but without deformation. Just like a fence but not exactly, i want the Z-position varied. So along the X-axis a straight line. Like this: enter image description here

But on a curve/path. With an array. If possible.

Obviously it doesn't work with a curve modifier but i cannot figure out how to do this apart from manually. Preferably with an array on the tube, that would save me quite some time. It would be nice if it's possible to add tubes randomly so there could be open spaces between the tubes but it's not nessecary.

$\endgroup$
1
  • 1
    $\begingroup$ The placing of the cylinders along the curve one after another works very well with an Array and a Curve modifier... set the Array to Fit Curve, select a curve and set a Relative Offset of Factor X = 1. Then select a curve in the Curve modifier. No deformation there. Only the varying Z positions will be a problem... this might work better in Geometry Nodes I guess - also randomly placed tubes (I mean with spaces inbetween) will be something to do with Geometry Nodes. $\endgroup$ Mar 6, 2023 at 9:46

1 Answer 1

2
$\begingroup$

I would do this with Geometry Nodes, using a Resample Curve node set to a certain Length depending on the Radius of the cylinders. After the Instance on Points node (where I use a Random Value node set to Boolean to leave some gaps in the curve) I place a Set Position with a Random Value node plugged into the Offset input to vary the Z position of the cylinders. This would be the simple setup for this:

cylinders along curve

To get a little more fancy I would take into account that the resampling with a certain Length of a curve which might have some arbitrary length usually results in points not exactly placed at the desired distance apart, but a little shorter.

Since a curve can only have an integer number of points, but dividing a curve's length by a certain distance can result in a float value, Blender rounds up the result of the division, divides the curve length by this integer number minus 1 (because there's one point more than there are segments of the resulting length) and uses this as the exact distance between points.

So I made a little modification to my setup, now there is a Value node as input to choose the distance between points which is then used to specify the radius of a cylinder, so that all cylinders are placed directly next to each other - of course also depending on the resolution of the cylinders, the higher the resolution i.e. the smoother and rounder they are, the better/tighter they next fit to each other.

calculated distance and radius

$\endgroup$
6
  • $\begingroup$ Yes Gordon, this is exactly what i am looking for! Thank you so much for taking the time to create this! I have never worked with Geometry nodes so i have no idea what i am doing, i managed to create your node group and it works excellent. On the second one, i can't manage to create holes in the row but that's ok, this is something i can work with. Thanks again!!! $\endgroup$
    – Jaco
    Mar 6, 2023 at 11:20
  • $\begingroup$ @Jaco Hmmm... the "holes in the row" are created by the Random Value node set to Boolean which is plugged into the Selection input of the Instance on Points node. It should work the same in both setups. But I can add my file to the answer as well. $\endgroup$ Mar 6, 2023 at 11:53
  • $\begingroup$ Thank you for adding the file, i will look into it. For now i am happy with what you provided and it seems to work pretty good! For some reason though, i can't seem to add a texture to the tube, is that something that also needs to be done through the Geometry nodes? $\endgroup$
    – Jaco
    Mar 6, 2023 at 12:29
  • $\begingroup$ Since they are created in Geometry Nodes, yes. There is a Set Material node with which you can assign a material to the tubes. If you would create a tube object outside of Geometry Nodes and just reference it like I did with the curve, then you could assign the material directly to the tube and it would simply be instanced with the material. However, since I made the radius adjustable with the sample length I preferred to add a cylinder in the nodetree instead of an external object. I would really recommend watching tutorials on Geometry Nodes, you can do a lot with it. $\endgroup$ Mar 6, 2023 at 12:36
  • $\begingroup$ Found it, it's a relatively simple procedure: just add a Set Material node just before the Group Output node. Thanks again for your help! This shows that i really need to delve into the world of Geometry nodes. $\endgroup$
    – Jaco
    Mar 6, 2023 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .