Page MenuHome

Geometry Nodes: Curve Primitive Phyllotaxis Spiral
AbandonedPublic

Authored by Hans Goudey (HooglyBoogly) on Jun 17 2021, 10:57 PM.

Details

Summary

This patch adds another spiral primitive to geometry nodes. Phyllotaxis
spirals have nice geometric properties that makes instancing in natural
looking patterns like flowers quite simple.

This was originally inspired by the some of the node groups used in the
2.93 splash screen by @Erindale (Erindale). While it could be argued that the use
case is a bit specific to be a default node, it doesn't hurt to have
one more primitive for a quick setup with default nodes. Only one more
curve primitive node is planned besides this.

Original patch from Johnny Matthews (@Johnny Matthews (guitargeek))

Diff Detail

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Jun 17 2021, 10:57 PM
Johnny Matthews (guitargeek) created this revision.
Johnny Matthews (guitargeek) retitled this revision from Geometry Nodes: Phyllotaxis Spiral Node (Curve Primitive) to Geometry Nodes: Curve Primitive Phyllotaxis Spiral.Jun 22 2021, 5:10 PM
Hans Goudey (HooglyBoogly) requested changes to this revision.Jun 23 2021, 12:15 AM
  • The output can be named Curve rather than Geometry
  • What do we think about defaults? I found the settings below helped show off the capabilities of the node a bit better while looking much less chaotic.
  • I'm getting some very strange results with "Expand" values over around pi. Maybe the input should be a slider with a soft range of 0 to pi? (PROP_FACTOR)-

source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral_phy.cc
22

Typo! Also, probably best to call this Resolution like the other similar inputs

41

Simpler IMO to just use expand * expand here

55

Instead of dividing by verts - 1 in multiple places, you can define const float delta = 1.0f / (verts - 1); and then multiply by it where you divided before.
The other benefit is that multiplying is much faster than dividing, sometimes noticeably so.

You can pass delta * i to fall_off instead of the index as well.

65–68

Here's how I'd write this given the above comment: const float z = std::pow(1.0f - delta, exponent) * depth;
Usually it's more clear to declare more than one const variable than to change the same one over multiple lines.

70

I think this (radius / max_radius) value is constant for the entire loop, so you could pull that out.

This revision now requires changes to proceed.Jun 23 2021, 12:15 AM
Johnny Matthews (guitargeek) edited the summary of this revision. (Show Details)

Updated revision. I stuck with the 137.5 degree default because that is a 'magic number' for Phyllotactic spirals. The example pic is an example of one application for which the spiral is named (from Ancient Greek phýllon "leaf" and táxis "arrangement")

Rename points and verify that small angle curves work fine as well as large angle 137.5 is the optimal angle for natural items.

Various cleanups:

  • Avoid division in loops
  • Don't use small "fall_off" function
  • Simplified some logic
  • Use spline.resize()

I have a version with an improved expand input that I'll upload now.

Improve the expand input-- use a slider and a 0 - 1 input

  • Merge branch 'master' into geometry-nodes-spiral-phy
  • Use new socket declaration API
Hans Goudey (HooglyBoogly) planned changes to this revision.Nov 9 2021, 6:19 PM

I think this should be a mode in the existing "Spiral" node rather than a new node. That should be a simple change.