6

I would like to duplicate an object along a path, and also have the ability to manipulate the orientation of each instance individually.

Expected result:

enter image description here

Like in the picture above, where each object's orientation is determined by some unit vector defined somewhere, and possibly each object is just an instance of a duplication.

What have I tried #1: mesh & dupliverts

Parenting the object to a mesh, and selecting "Duplication > Verts" on that mesh, results in all the objects having the same orientation:

enter image description here

I'm not sure what happens exactly when I enable "Rotation" under "Duplication":

enter image description here

I know it should be possible to make the "vertex normals" count, but I don't know how to do that, and how to control these normals.

What have I tried #2: curve & dupliframes

Parenting the object to a curve, enabling "Duplication > Frames" on the object ("Speed" un-checked), then changing the "Frame number" in the Curve setting to match the number of Bezier handles.

This would be a worse solution, as the duplication would happen at each 1/n-th of the curve length, not at each Bezier handle. However, it doesn't work as the duplicated object don't seem to orientate according to the Bezier handles:

enter image description here

What I'm looking for

A solution that uses duplication, modifiers, standard mesh editing tools, or even python¹ would be appreciated. Consistent results are crucial!

Using particle systems wouldn't be great, as it's complicated to have fine control over each single particle/hair.

Please no animation nodes, as I can't seem to fully comprehend the pipeline. It'd be fine only as long as the solution is guaranteed to be the same, and already evaluated, every time I open the file, and static at every frame.

If I can't obtain this, I'll have to just manually (or via script) duplicate and adjust the objects, which is nonoptimal as the file size and memory usage would increase.

¹ I'm thinking of something like my attempt #1, where the orientation is linked (how?) to the vertex normals and python assigns these normals, if there's no GUI way to accomplish this.


Edit: @Lemon's suggestion (particle system)

One way to introduce some control on the orientations is to create a mesh with N vertices, assign a particle system to this mesh with

  • "Render>Object"

  • Emission: Number = N, Emit from: Verts, "Random" un-checked, Velocity = 0, Physics = No, Rotation enabled.

enter image description here

One can then play with the "Rotation" settings.

However, having control over "Rotation", in a way not limited to "Phase" and "Random", is what I need. I can start from one of these settings, but then I need to be able to control and adjust some of the particles.


The file

Attached:

Updated with @Lemon's suggestion:

Nicola Sap
  • 12,900
  • 3
  • 56
  • 83
  • 1
    Particles system works. Draw a line (mesh) with n vertices. Set your shape as dupli object (render panel of the PS). Set the PS emit from verts with no random and set the particle amount to n. Now you can play with the rotation panel of the PS (either velocity or phase or random + the initial orientation that can be chosen). – lemon Mar 12 '18 at 12:21
  • @lemon this might actually solve part of my problem, i.e. giving different orientations (thanks for the tip!) but it doesn't allow me to have control over each single instance, or does it? I can't seem to be able to "comb" these particles – Nicola Sap Mar 12 '18 at 13:05
  • So another suggestion: a curve plus a plane with array modifier and curve modifier. Then make your mesh dupliface of the plane and adjust the rotation using the twist of the curve (edit mode for the curve, select a vertex and ctrl+T to twist). There is no random here but you can control "all" by adding as curve vertices as you want. – lemon Mar 12 '18 at 14:22
  • @lemon nice! Unfortunatly I'd be bound to having constant distance between each instance. (I know I'm too demanding!) – Nicola Sap Mar 12 '18 at 14:28
  • Another technique here using vertex groups: https://blenderartists.org/forum/showthread.php?318143-How-can-I-randomly-rotate-objects – lemon Mar 12 '18 at 15:19
  • 1
    Related https://blender.stackexchange.com/a/163958/15543 see bottom example. Can set vert normals. (Hassle IIRC the normals are lost if vert mesh is edited. Haven't looked at new point cloud object in 2.9) – batFINGER Dec 22 '20 at 15:25
  • even though it is evolving quickly, geo nodes look to be a viable solution to this problem if it was never solved... – Timaroberts Jan 12 '21 at 03:24

1 Answers1

3

You can do it with Geometry Nodes in Version 3.0+ :

We can use this rather simple setup to instance objects at each control point of the curve :

enter image description here

Note you can get the value of $2 * π$ (or $6.283...$) by writing tau in a float field.

Result :

enter image description here

If you want to input specific values for each element, at the moment it's not possible to use vertex groups on curves so we'll have to hack our way somehow. There are multiple ways but since we're not using the control points handles I figured we could use the $X, Y, Z$ fields of the left control point to store our $X, Y, Z$ rotations.

Here's a script you can tweak to setup specific values on control points :

import bpy

from random import randint

curve = bpy.data.objects.get("Curve").data for spline in curve.splines: for point in spline.bezier_points: point.handle_left_type = 'FREE' # Enable custom position point.handle_left = (randint(0, 360), randint(0, 360), randint(0, 360)) # You can import external data (eg from a csv file) here

We'll just use a Vector Math node to transform our degrees to radians. You can delete it if your input values are in radians.

enter image description here

Result :

enter image description here

Gorgious
  • 30,723
  • 2
  • 44
  • 101
  • Yep, geometry nodes was the answer to this question (it just didn't exist at the time of asking :D) – Nicola Sap Dec 07 '21 at 13:32
  • Yeah I bookmarked this specifically so I could get closure on this Question once 3.0 is officially released ^^ – Gorgious Dec 07 '21 at 14:01