3
$\begingroup$

enter image description here

I want to achieve this effect using geometry nodes in Blender so that I can see how the spiral changes by changing the size of the starting isosceles triangle or the proportion between the triangles in the array. I tried to achieve it using instance of point and linking id to power and then to scale and rotation and then multiplying the rotation by the angle of the triangle but I couldn't

$\endgroup$
1
  • 6
    $\begingroup$ Hello and welcome. Please use a title that matches the content of the post. It should read like a question, be descriptive but succinct, unique and identifying, summarizing the problem so that anyone searching for similar issues is likely to find this. Remove anything superfluous, avoid using words like "this", "help with", "issue" or "question about", instead describe what "it" is. Remember, your title is the first thing visitors see, answers you get depend heavily on it. See What is the problem of asking “How do I do this?" $\endgroup$ Commented Aug 22 at 13:26

3 Answers 3

9
$\begingroup$

Basically you need an isosceles triangle object pointing down with the origin at the center of the base edge. Then you need to know the length of the base, the legs to base ratio and the base angle.

The shape is created by iterating the following steps: moving the next triangle over half the length of the base so its origin is at the corner, then rotate counter-clockwise by the angle in that corner and scaling the new triangle the ratio of two times the leg length:

basic construction principle

These values can be calculated for any given isosceles triangle if we first get the height and width from the Bounding Box by subtracting the Min from the Max vector.

isosceles triangle with bounding box

From these dimensions all necessary values can be calculated. If we only take half of the isosceles triangle by splitting it on the height of the base edge, we get a right triangle.

For the leg length c we have the Pythagorean theorem, all we need is a which is half of the X width and b is the Z height. The angle for the rotation then is the arccosine of a divided by c or the arcsine of the height b divided by c, whichever you prefer (later multiplied by -1 for counter-clockwise rotation).

isosceles to right triangle

And these steps have to be done for each iteration, this is where the Repeat Zone in Geometry Nodes comes into play.

In the following setup I use a triangle pointing down, the origin at the center of the base (the edge opposite the right angle). Apart from making the calculations I have explained above, the Repeat Zone is built so that the original triangle is put in 2 Geometry inputs: the first to get the original triangle, the second to get a triangle for transformation. Then the original geometry will be joined by the transformed geometry to built the complete construction and becomes the output of the Repeat Zone. Then the transformed geometry alone will be fed into the second geometry output for the next iteration of transformations. Sounds complicated, I know.

gn nodetree

And the result of it will look like that:

finished spiral geometry

Now I know this is not exactly like the original and spreading out a bit more, because as I later realized the reference triangles have their pivot point on which they rotate not in the center of the width. Which means, they are moved a little less to the right and therefore have to be scaled less. This is a bit more complicated and I will see if I find the time to implement something like this later.

//EDIT: I've now made a second version where you can manually set an absolute value as offset how much you want the new triangle to be wider than the original triangle (in the first step, afterwards this value of course will be scaled as well).

Moving the triangle over is a bit different now as well since the ratios have changed and the translation is no longer half the width etc.

It was a bit complicated since the rotation did not work as I wanted it, however with a Set Position node where I can move the individual vertices, using a Vector Rotate node where I can set the corner as Pivot Point to rotate around it worked.

All in all this is a bit messy, this can surely be made nicer maybe even with custom nodegroups for the basic operations which are used in both nodetrees, also maybe with connections to the Group Input to be able to enter values comfortable from the modifier.

But since this was not supposed to be a tutorial, just one possible way of doing it I hope you get an idea how to go on from here.

new nodetree with offset

And this is what it looks like:

new version off-center pivot

I have updated the file as well, there are now two GN nodetrees available:

Here you can change the angle the triangles rotation by changing the height of the triangle:

rotate by height

Or you can change how wide or narrow the spiral is while keeping the rotation angle by changing the offset (how much wider the second iteration should be):

changing offset

$\endgroup$
6
$\begingroup$

Sorry for this short answer, unfortunately I don't have much time, but I still wanted to share it here:

Here is an index-based solution that, in principle, simply scales each additional triangle added by a certain value and places it at the position of the acute angle of the previous triangle.

Angle and scaling factor can be individually adjusted here and the extruded objects are aligned flush, as can be seen in the example image.


(Blender 4.2.0+)

$\endgroup$
6
$\begingroup$

(Using Blender 4.2.0)

Analysis

The structure is made of isosceles wedges rotated by the angle between a leg and the base. The right side of the structure shows that 5 wedges are making half a turn, i.e. 180°. Consequently, the angle between a leg and the base is 36°.
Classical laws to control the size are arithmetic progression and geometric progression. The following figure illustrates both, with the same factor (1/20) between first and last wedges. The arithmetic progression seems better suited.

Results with different progressions (legend: arithmetic progression (left) ; geometric progression (right))

Approach

An Instance on Points node provides the duplication loop to spawn scaled and rotated objects. The following figure shows the "Spawner" Group Node.

GN to spawn scaled and rotated objects

Dark pink nodes: Let $\alpha$ be the Angle between a leg and the base. For the first object $(i=0)$, the rotation angle is 0 ; for the second object $(i=1)$, the rotation angle is $\alpha$ ; for the third object $(i=2)$, the rotation angle is $2\alpha$. This arithmetic progression is generalized as $i \times \alpha$, and it is computed by a Multiply Math node.
Dark red nodes (geometric progression): Let $r$ be the Ratio applied to reduce the size, and $i$ the index of an instanced object. For the first object $(i=0)$, the scaling factor is 1 ; for the second object $(i=1)$, the scaling factor is $r$ ; for the third object $(i=2)$, the scaling factor is $r \times r$. This progression is generalized as $r^i$, and it is computed by a Power Math node.
Dark green nodes (arithmetic progression): Let $R$ be the Ratio between the first and last object sizes. The Linear variation of the scaling factor between 1 and $R$ as a function of the instance Index is computed by a Map Range node. The last index is recovered by subtracting 1 to the Point Count of the input geometry.
Dark blue nodes: To control the Shading of each object, its instance Index is saved using a Store Named Attribute node.

Results

Results

Resources


GeometryNodes modifier

Overview

GN Overview

Input parameters:

  • Count: how many wedges to spawn.
  • Height: height of the first isosceles triangle (wedge width also by default).
  • Angle: angle $\alpha$ between a leg and the base of the isosceles triangle.
  • Ratio: scaling factor $r$ for geometric progression or overall size ratio for arithmetic progression $R$ ; values lower than 1 yield decreasing size.
  • Progression: law controlling the size variation.

The overall process is a sequence of 3 steps:

  • Dark red nodes: scaling and rotation of one leg of the isosceles triangles, considered as independent objects.
  • Dark pink and blue nodes: computation of the position of the center of the wedges.
  • Dark green nodes: positioning, scaling and rotation of the wedges.

Wedge builder

GN Wedge builder (3D Viewport legend: leg (blue), $\alpha$ angle (red), height (green))

Dark pink nodes: The generic wedge is made from a Cylinder with only 3 vertices. End faces are equilateral triangles ; consequently, the Height is 1.5 times the Radius, i.e. the Radius is $\frac{2}{3}$ times the Height. The cylinder vertices are translated with a Transform Geometry node such that its origin is set at the apex.
Dark green nodes: The base is chosen as the edge aligned with Y axis. It has to be scaled to deform the equilateral triangle into an isosceles triangle. The scaling factor, preserving the Height, is the ratio between the Tangent of the equilateral angle (i.e. 60°), and the Tangent of the isosceles angle (i.e. $\alpha$).
Dark red nodes: Then the cylinder is rotated by 90° around X axis such that the isosceles triangle is in the (X,Z) plane. Eventually it is rotated by 90°$+\alpha$ around Y axis to align one leg with X axis. Scaling and rotation are computed by a single Transform Geometry node, because Scale is applied before Rotation X, applied before Rotation Y.
Dark blue nodes: A different Material is set for the faces whose normal is aligned with Y direction, i.e. the isosceles triangles.

Building sequence

GN Edges scaling and rotation 1. The generic wedge leg is modeled with a Mesh Line aligned with X axis. Its length is computed from the Height and $\sin(\alpha)$.
2. A second Mesh Line is initialized with as many vertices as required wedges. The position of these points is irrelevant, as long as they are not colocated. It is conveniently aligned with X axis, with a spacing 10% larger than the length of the generic wedge leg.
3. Both Mesh Lines are input into a first Spawner group node whose output is turned into edges with a Realize Instances node.
4. The result illustrated in the 3D Viewport is a collection of edges, one per wedge, with the right length and orientation.

GN Vectors to move the centers 5. For each edge, the vector connecting its start point to its end point is computed using a Mesh to Points node set in Edge domain. It is to notice that this vector is also connecting the origin of one wedge to the origin of the next.
6. The position of those points is recovered through an Edge Vertices node.
7. The result illustrated in the 3D Viewport is a collection of points. The vector connecting the object origin to such a point is the displacement to apply to move from one wedge origin to the next one.

GN Spawning centers 8. The displacements computed at step 7 are added together using an Accumulated Field node recovering the points Position.
9. Then each point is moved to the position defined by the summation of all previous displacements (excluding itself) output by the Trailing socket of the Accumulated Field node.
10. The result illustrated in the 3D Viewport is a collection of points located where the wedges origin is.
11. Eventually, wedges are instanced calling a second time the Spawner group node, with the right position.

$\endgroup$

You must log in to answer this question.

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