10
$\begingroup$

I'm trying to create a row of street lights, both the lamp pole and a spot light. Since i can't simply join these two and use an array + curve modifier to set this up (using an array modifier + a curve modifier always deforms the mesh) so i came to the conclusion that working with collections and instances would be my best bet.

To get to my current result i parented the spot to the lamp mesh. Then i parented those two objects to a plane. after that i parented the plane (and so also the lamp mesh and the spot) to a curve that i converted to a mesh. I then activated Instancing for the curve with verts which resulted in something like this:

enter image description here

As you can see the lamps all face the same direction, while i want them to be rotated inwards. There's an option for 'aligning the objects to vertex normal'

enter image description here

but enabling this exposes a multitude of problems:

  • Problem 1: it turns out there's two instances of every object. (i have no idea why)
  • Problem 2: the street light meshes get deformed.

enter image description here

  • Problem 3: the actual lights all face toward the same place

(I drew over the lamp directions with blue arrows for visibility)

If anyone knows how i can get this to work i'd really appreciate it, but other techniques are welcome too.

$\endgroup$

1 Answer 1

12
+300
$\begingroup$

V3.1+

With Geometry Nodes and 3.1 version you can use the Curve to Points and Instance on Points nodes to instance lampposts along any 3D curve.

You'll have to do a bit of trigonometry to rotate the lampposts correctly but you don't have to understand any of it. Just plug the Tangent output from the Curve to Points node, multiply it by $(1, 1, 0)$ to ensure the posts are vertical, and plug it into the Vector input of a Align Euler to Vector node, and plug into the Rotation input of the Instance on Points node.

First place all your lamp post objects in a collection :

enter image description here

Here's the node tree :

enter image description here

Here's a quad view of the result :

enter image description here

V3.1-

You can do it by using an array + curve modifier, you just need to use the plane as an instancer.

Select the plane, add an array modifier and set the length to "fit curve", and set your curve. Add a curve modifier, set it to your curve again. Make sure to parent the lamp post to your plane, then go to the plane's object properties and select "Faces instancing". Here you go : enter image description here

Note that this will not work well if you use a 3D curve.

How to tweak the workflow for a 3D curve :

Instead of using a simple plane for the array + curve combo, use an elongated plane in the Y axis.

enter image description here

Then after the Array and Curve modifiers, add a Weld modifier and tweak the distance until the vertices in the local X axis merge. You should now have a series of segments, with both vertices of each segment on the same XY plane. These segments follow the 2D curvature of the curve object.

enter image description here

Add a Screw modifier on the X axis, set the angle to 0°, the steps to 1 and the screw property to a small value.

enter image description here

Now enable instancing on faces.

enter image description here

$\endgroup$
15
  • $\begingroup$ Hello Gorgious; so do you have any idea how it would be possible to do it with a 3D curve in the latest versions? I was wondering if geometry nodes could solve the problem $\endgroup$
    – moonboots
    Commented Jan 20, 2021 at 7:24
  • 1
    $\begingroup$ Haha Thanks Robin !! I sure hope there is an obvious solution we just keep missing >< $\endgroup$
    – Gorgious
    Commented Jan 29, 2021 at 21:38
  • 1
    $\begingroup$ Looks like no takers... If there's a better way, I can't find it :) Recently, I had to go back to this answer of yours to do it at all . It seems ridiculous to have to twist yourself into a pretzel to do something so commonplace. Nonetheless, I'm very grateful for your ingenuity! And I'm sure others will be, too, until Everything Nodes or somesuch fixes it. I guess there must be an AN answer, but it should be native, really. $\endgroup$
    – Robin Betts
    Commented Feb 4, 2021 at 17:11
  • 1
    $\begingroup$ great I had a big doubt ;) I wanted to make a tutorial about the different methods of duplicating along a curve, I will cite you of course $\endgroup$
    – moonboots
    Commented Jul 12, 2021 at 16:49
  • 1
    $\begingroup$ well I think your method is pretty easy so I will stick with it ;) but yes one day I will need to learn GN $\endgroup$
    – moonboots
    Commented Jul 12, 2021 at 18:36

You must log in to answer this question.

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