# Foreword

First off, let me say that I am profoundly amazed at the orderliness in nature. If you haven't heard about the Fibonacci sequence (0, 1, 1, 2, 3, 5, 8, 13, ...), you should check it out.

This mathematical concept of the Fibonacci numbers can be shaped into a set of squares, where the lengths of the sides of the squares follow the Fibonacci sequence:

This is sometimes called a golden ratio. It can be formed into a (golden) spiral. (a.k.a. logarithmic spiral):

# Application

I am looking for ways on how to utilize this concept in Blender. Primarily in organic modeling. The golden spiral is found all throughout nature. From flower seed heads, sea shells, and ram horns to hurricanes and spiral galaxies. See for yourself. My question is: how can I model based off of one or multiple golden spirals? Specifically, I'm interested in modeling a sunflower head like the one in the following image. I'm mostly interested in the point of origin of the individual seeds (not worried about the shape). Does Blender have any features related to this?

• It would be good if you could link to a an image of a model that you aim to match - is duplicating smaller objects to make up a larger form acceptable? or are you wanting a continuous surface? – ideasman42 Jun 25 '13 at 23:09
• 2d images can convey only limited information about these complex structures and shape-modulations, I recommend to study the physical objects up close too. – zeffii Jun 27 '13 at 11:16
• Amazing list of interesting answers! – Bithur Mar 8 '15 at 12:04

There is a simple mathematical model for florets in a sunflower, using the golden angle 137.5°. Here is an script that creates a mesh with vertices distributed in this pattern:

import bpy
import bmesh
import math

n = 1000 # number of points
c = 0.1 # scale factor

mesh = bpy.data.meshes.new(name="Spiral")
bm = bmesh.new()

for i in range(0, n):
r = c * math.sqrt(i)
bm.verts.new((math.cos(theta) * r, math.sin(theta) * r, 0.0))

bm.to_mesh(mesh)
mesh.update()

from bpy_extras import object_utils


Note that this pattern does not consist of concentric circles like other answers. It would be interesting if you could generate something like this with existing modifiers or other tools, but I wouldn't know how.

• A few modifications to the technique outline in my answer, results in the same pattern. ;) – Aldrik Jun 27 '13 at 22:36
• Aha, very nice. – brecht Jun 27 '13 at 22:51
• Stuff like this can be used to create displacement maps too: slightly modified from your code, this attempts to show how the spiral grows over time – zeffii Jun 28 '13 at 8:13

How about a fully math based approach, here's an interesting paper on scipress.org called Growth in Plants: A Study in Numbers by Jay Kappraff.

from the paper:

Keywords: Phyllotaxis, Fibonacci Numbers, Golden Mean, Continued Fractions, Farey Series, Wythoff’s Game, Zeckendorf Notation

There is an addon called Add 3d Function Surface which can be coerced into producing many interesting shapes. It is included in the Extra Objects addon as "Math Functions"

If the purely function based approach fails you then you still have a variety of options. Some of which are a bit more interactive.

### Modifiers and Scripting

You could model one part of the object and use a script to rotate it around and scale it up/down according to whatever algorithm you can imagine. For example a 2d version of a plant on geometry daily, it's simplicity is deceptive. I tend to use live coding tools like tributary.io to figure out the math using .js with immediate feedback. Usually if I can figure something out in 2D, the move to Blender and adding a third dimension isn't that much extra work.

An Array Modifier and an empty can give very similar results to the broccoli.

This is a cone, tilted slightly and shifted away from its origin, then added an Array modifier and used a tilted (rotated) and slightly scaled empty as an array object.

The fractal nature of the brocolli calls for daisy-chained array modifiers, each building on the complexity of the previous.

Elaboration
perhaps a short walk-through script might better convey what otherwise would become a wordy explanation. This script is merely intended to show what daisy-chained Array Modifiers can do, and shouldn't be perceived as nice python or nice code. The script should result in something like the sunflower. Run the code in an empty blend file with the 3D cursor at the centre of the scene.

import bpy
import math
import mathutils
from mathutils import Euler
# make sure 3d cursor is at the center of the scene

num_items_in_spiral = 13
num_spiral_arms = 29
z_rotation = 2.0 * math.pi / num_spiral_arms

# add cone, modify the mesh,
obj = bpy.context.active_object
obj.data.transform(mathutils.Matrix.Translation((-0.5, 0, 0)))

# add empty for spiral arm
obj = bpy.context.active_object
obj.name = "Empty_spiral"
obj.location = (-0.8, 0, 0)
obj.rotation_euler = Euler((0, 0, 0.179609), 'XYZ')

obj = bpy.context.active_object
obj.rotation_euler = Euler((0, 0, z_rotation), 'XYZ')

# add modifiers to the cone
obj = bpy.data.objects["Cone"]

mod = obj.modifiers.new(name="Array_1", type='ARRAY')
mod.use_relative_offset = False
mod.use_object_offset = True
mod.offset_object = bpy.data.objects["Empty_spiral"]
mod.count = num_items_in_spiral

mod = obj.modifiers.new(name="Array_2", type='ARRAY')
mod.use_relative_offset = False
mod.use_object_offset = True
mod.count = num_spiral_arms


The red cone is the primary object, the curve/spiral coming off it is the result of one array modifier on a translated and rotated Empty. The rest of the spirals are an extra array modifier on a different Empty (rotated around the scene origin by 2*math.pi / num_spiral_arms)

Whatever object/picture you choose to replicate, you can figure a lot out by drawing on top of the pictures and counting, but mostly experimenting. I think it's more accurate to consider these nice geometric objects as 3D fractals rather than the 3D embodiment of a golden ratio.

• I'm inclined to consider the question off-topic as, while it is very interesting and the math can be satisfying, the techniques and information you seem to be looking for are rather generic math / graphics problems. – zeffii Jun 25 '13 at 17:41
• @zeffi I receive the impression that more questions get closed than upvoted I would strongly disagree to close this one. – stacker Jun 25 '13 at 19:00
• I don't intend to vote for closing it, but it will never be up to one person to close a question unless it is blatantly left field. – zeffii Jun 25 '13 at 19:15
• @zeffii Could you give more detailed instructions about how you made the tilted cone model? – ajwood Jun 26 '13 at 0:24
• @ajwood Yes, i'll update this later with a script or two and modify my answer. – zeffii Jun 26 '13 at 4:01

So many nice answers already. :) I'd like to share my tricky way. too. Steps are shown below:

Demo file is here.

Fun stuff, anyway had to have a play:

• Setting up a particle system to spawn the suzanne-flower seeds.
• Disabled gravity and particle velocity so they'd stay in place.

Here is a comparison of 2 similar functions:

The functions are made to be run in a loop, with N providing the total number of dots, and k is the current iteration of the loop. The first FCT is a phyllotaxis spiral formula, dont know how it works, perhaps it isnt meant for sunflowers with 10 000 seeds as it seems abit simple, the outer seeds might make straight lines, and the scond functiion uses phi, it is actually was originally from a code to make spheres with equally distributed dots, like disco balls, its on this website @ evenly-distributing-n-points-on-a-sphere. i just found these codes online in groups.

function sflo1 ( N:float,k:int):Vector3{//phi based pylospiral
//N=numpts  k=currentpt
k=k;
var inc =  Mathf.PI  * ( 3 - Mathf.Sqrt ( 5 ) );
var off = 2 / N;
var y = k * off - 1 + (off / 2);
var r = Mathf.Sqrt (Mathf.Abs(y))  ;
var phi = k * inc;
return Vector3(-Mathf.Cos(phi)*r, 0, -Mathf.Sin(phi)*r);

};

function sflo ( N:float,k:int):Vector3{//easy formula based on 137.5 pylospiral
var n = k;
var r=Mathf.Sqrt (n)*1/(Mathf.Sqrt (N));;
var t=137.5*pi/180*n;
return Vector3(r*Mathf.Cos(t),0, r*Mathf.Sin(t));
}

function sflosq ( N:float,k:int):Vector3{//my own version it's stupid!
//N=numpts  k=currentpt

var inc =  Mathf.PI  * ( 3 - Mathf.Sqrt ( 5 ) );
var off = 2 / N;
var y = k * off - 1 + (off / 2);
var r = Mathf.Sqrt (Mathf.Abs(y)) * Mathf.Sign(y) ;
var phi = k * inc;
return Vector3(Mathf.Asin(Mathf.Cos(phi))*r, 0, (-Mathf.Acos(Mathf.Sin(phi))+pi/2)*r);

};

• This is certainly useful, but it's not exactly an answer. Can you post the functions with a short explanation as well? – CharlesL Dec 31 '13 at 14:52
• Hi, The functions are made to be run in a loop, with N providing the total number of dots, and k is the current iteration of the loop. – com.prehensible Jan 1 '14 at 0:24

I modified some of the above script to duplicate mesh objects around the golden radius in a sphere.

Trippy Faces:

Make sure one object is selected, then run the script. Also make sure the objects rotation,scale and location have been applied.

GR_Generator_Script:

import bpy
import bmesh
import math
from mathutils import Vector

n = 400 # number of points
ob = bpy.context.object
obs = []
sce = bpy.context.scene

for i in range(1, n):
x = r*math.sin(phi)*math.cos(theta)
y = r*math.sin(phi)*math.sin(theta)
z = r*math.cos(phi)

if x<0:
a = x*(-1)
else:
a = x

if y < 0:
b = y*(-1)
else:
b = y

c = math.sqrt((a*a)+(b*b))
size = 0.06+(c*0.09) #This can be messed about with to get the right size

copy = ob.copy()
copy.location = (x,y,z)
copy.scale = (size,size,size)

copy.data = copy.data.copy()
obs.append(copy)

for ob in obs:

sce.update() # don't place this in either of the above loops!


Once mesh objects have been generated, select them all and make one object (Ctrl-J). Then, making sure 3D Cursor is at 0,0,0 (Shift-C) click Object->Transform->Origin to 3D Cursor

Then you can run the

Key_Frame_Generator:

import bpy
import bmesh
import math
from mathutils import Vector

# prepare a scene
scn = bpy.context.scene
ob = bpy.context.object

#number of frames
n = 143
#degrees to rotate
d = 0 #Change to apply spin

for i in range(0, n):

bpy.context.scene.frame_set(i)

# do something with the object. A rotation, in this case

d = (d + 137.5) #Change to subtract to change direction of appeared flow

# create keyframe