5
$\begingroup$

The curve modifier allows you to specify a curve object for a given mesh with the modifier applied. However, when the curve object itself has multiple disconnected curves, the modifier seems to pick just one curve.

Is it possible to have a copy of the object for each disconnected curve? A solution with geometry nodes would also be nice; unfortunately, it doesn't look like there's any way to use geometry nodes to deform a mesh along a curve.

$\endgroup$

2 Answers 2

14
$\begingroup$

Here's a somewhat limited version of the Curve modifier that only works on the X axis (it is possible to make it work on other axes, I just got lazy). It trims the curve to fit the object's length, then deforms the object to mimic the curve's shape.

enter image description here

The Curve Index socket on the Sample Curve node allows us to pick which spline (each curve branch inside a larger Curve object) we want to use for the deformation:

enter image description here

You could simply use multiple copies of this modifier node with different curve indices and merge them with a Join Geometry node, but since the Curve Index socket accepts fields (multiple values), we can take advantage of that to automatically create as many copies as we have splines. We can get the Spline Count from a Domain Size node. Then we turn our main object into an instance using Geometry to Instance and duplicate it using a Duplicate Elements. We could use its other modes, like Face (or Edge), but that creates individual, disconnected faces (or edges) and you are limited to that particular geometry element—using Instance guarantees that the object stays intact as a whole so I prefer duplicating as instance and then realizing them later if needed. Finally, the Duplicate Index socket allows us to match each copy with a spline:

enter image description here

enter image description here

$\endgroup$
5
  • 2
    $\begingroup$ So simple and elegant... $\endgroup$
    – Fred I. R.
    Jan 4, 2023 at 13:03
  • $\begingroup$ @FredI.R. Thanks! $\endgroup$
    – Kuboå
    Jan 4, 2023 at 13:14
  • $\begingroup$ What are the use of the Map range and the Bounding Box a simple Position will do, doesn't it? $\endgroup$
    – Fred I. R.
    Jan 4, 2023 at 13:25
  • $\begingroup$ @FredI.R. If I only used Position, negative and >1 values get cut off: i.imgur.com/xvVrYAn.mp4 So I'm forcing them all into the 0-1 range. $\endgroup$
    – Kuboå
    Jan 4, 2023 at 13:37
  • 1
    $\begingroup$ Thank you Kuboa! This was extremely helpful and informative! $\endgroup$
    – waylonion
    Jan 5, 2023 at 4:39
3
$\begingroup$

First there is a solution for the deformation along a curve in GN, for the disconnected Curves you can iterate an offset of each of your mesh vertices on the X axe so all the mesh except the first one will go on the next curve and so on.

enter image description here

As the first is already placed you will have to repeat this process n-1 time (n is the number of your mesh).

Iteration for 25 mesh

But first you have to make sure all of your mesh share the same location.

enter image description here

And you have to know the number of point of one mesh, a Domain Size will do the trick.

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you Fred! This was helpful as well! $\endgroup$
    – waylonion
    Jan 5, 2023 at 4:39

You must log in to answer this question.

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