1
$\begingroup$

I am trying to make a sunflower. The seeds in a flower grow in a spiral. Whenever I add an array spiral and make it follow the curve, it doesn't seem to look quite right. This is because it doesn't follow a Fibonacci sequence. How can I fix this to look more like the real thing? How can I make my array follow a Fibonacci spiral without running into spacing issues?

My current pattern with the array modifier following the spiral curve:

enter image description here

The pattern I am trying to create:

enter image description here

Pasting the following code will create vertices in the distinct pattern, however it will not place any specific objects instead of those vertices. How would I go about modifying the script so it will place down an object instead of a vertex?

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):
    theta = i * math.radians(137.5)
    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
object_utils.object_data_add(bpy.context, mesh)
$\endgroup$
  • 2
    $\begingroup$ This question is basically yours, and one of the answers provides a suitable script: blender.stackexchange.com/questions/1371/… $\endgroup$ – Rekov Mar 22 at 6:22
  • 2
    $\begingroup$ Does this answer your question? Organic yet accurate modeling with the golden spiral $\endgroup$ – batFINGER Mar 22 at 12:22
  • $\begingroup$ @Rekov Hi, Thank you for your response. While it does answer the question on how to create the spiral, it does not show how to create the spiral out of the objects which currently exist in the scene collection. To clarify, I have modeled a "seed" and I need the python script to take the data of that seed to create the spiral instead of simple vertices. Please let me know what you think. $\endgroup$ – Nikolai Yinger Mar 22 at 17:05
3
$\begingroup$

Use Dupliverts

enter image description here Result using icosphere as "seed"

Organic yet accurate modeling with the golden spiral

@Rekov Hi, Thank you for your response. While it does answer the question on how to create the spiral, it does not show how to create the spiral out of the objects which currently exist in the scene collection. To clarify, I have modeled a "seed" and I need the python script to take the data of that seed to create the spiral instead of simple vertices. Please let me know what you think.

Similar to the dupli part of answer here, https://blender.stackexchange.com/a/163958/15543 and using the fibonacci sphere from Closing "Fibonacci's Hole"

Since I already had it: Grabbed the code from https://gist.github.com/batFINGER/64db074e95b716f839a71882b7efcc50 appended code below to make a 2048 point Fibonacci sphere, added an ico sphere, (pick up your own seed object) make it a child and dupliverted it to the sphere.

Set the normals of the mesh to the radial direction from origin.

n = 2048

me = SFBMesh(n).mesh

for v in me.vertices:
    v.normal = v.co.normalized()

ob = bpy.data.objects.new("Fibo", me)

bpy.context.collection.objects.link(ob)

bpy.ops.mesh.primitive_ico_sphere_add()
ico = bpy.context.object
ico.parent = ob
ico.scale *= 0.1
ob.instance_type = 'VERTS'
ob.use_instance_vertices_rotation = True

Here is one made of Suzannes, removed all verts with negative z coord, and scaled the sphere to one tenth in z.

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.