3
$\begingroup$

I'm using Geometry Nodes to to instance two meshes onto another mesh, here an icosphere to start out, such that I can develop sets of modular 3d printable "Hubs" and "Struts" that I'll be using for costume elements.

Getting the "Hubs," (at the icosphere vertices with their z-axes pointing outward from the ico's vertex normals) in the mesh was fairly easy, but I'm having some trouble getting the "Struts" to behave the way I want. Apparently a solution is somewhere in this answer Geometry Nodes: Instance And Align Mesh Along Edge? but I can't quite figure it out (I'm relatively new to Geometry Nodes, and have a pretty basic understanding of vector math).

The two issues I'm having:

1 - some of the instances' z-axes are pointing "erratically." I suspect that this may have to do with a zero or one vector or value getting thrown somewhere, but even if that's the case I don't know how to deal with it.

2 - when I deform the icosphere mesh, the edges begin to point "erratically" in the affected area.

The images show what I have so far:

Nodes so Far

"Erratically" aligned instances

Deformation causes weird alignment i

$\endgroup$

1 Answer 1

4
$\begingroup$

Although @quellenform 's solution works great in the given conditions it is slightly limited to applying it to different Mesh objects.

Here is a slightly optimized and improved solution to the problem.

Let's set our Instance object ("Wrench") to be oriented along the Y axis and Z axis points Up. The object's origin should be at equal distance from the -Y and +Y boundary (optional).

Let's set our Target object to be a Mesh object (Icosphere, Monkey), which will have the Geometry Node Modifier.

Object aligned along Y axis with Z axis pointing up

With setting up an Instance on Points derived from the Edges of the Target object, the following problems need to be solved for the Target Object:

  1. Get the orientation of the Edges.
  2. Get the average Normal of the neighboring Faces (faces on both sides of the edge).
  3. Get the Edges lengths.

The following problems need to be solved for the Instance Object ("Wrench"):

  1. Align (Rotate) the instances to the Target's edge directions.
  2. Align (Rotate) the instances to the average Faces normals (although incorrect lets name it 'Edge' Normal).
  3. Scale the instances to match the Edges lengths.

The solutions relies heavily on Sample Index node, but consists of substantially simpler node set up.

Here is a screenshot of the setup with some additional explanation inside:

enter image description here

Here are some results:

enter image description here

enter image description here

Some deviation from the Edge alignment may occur when using N-gons (4 or more sided polygons) due to noncoplanarity. But it is very stable with triangular meshes even if deformed prior to the Geometry Node Modifier.

enter image description here

$\endgroup$
5
  • $\begingroup$ Always interesting to see what develops from some answers ...when applied correctly. Well done! $\endgroup$
    – quellenform
    Nov 2, 2023 at 1:36
  • $\begingroup$ @quellenform Thanks! $\endgroup$ Nov 2, 2023 at 8:26
  • $\begingroup$ Thank you @RumenBelev! This looks like it's going to work beautifully, and it seems an elegant solution building on what @quellenform started. Glad to see the co-creative spirit still very much alive on the internet :) I'll update if I have further issues (will probably have more time to wire up the solution on my own Blender install tomorrow). $\endgroup$ Nov 2, 2023 at 18:41
  • $\begingroup$ @RumenBelev well, just wired it up... Looking great! There's some further stuff I need to figure out about scaling the instances, but I think I can figure that on my own. Beautiful and elegant solution! Thank you again! $\endgroup$ Nov 2, 2023 at 19:08
  • $\begingroup$ You are very welcome @EmmaScottLavin ! Try and replicate the node setup carefully. Let me know if you have any issues. $\endgroup$ Nov 2, 2023 at 19:09

You must log in to answer this question.

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