9
$\begingroup$

Keep in mind that I am almost completely new to blender.

I was wondering how to create a spherical array. I have Googled and Googled, but I can only find ways to make circular arrays (two dimensional arrays). Basically I want a way to make an array that simulates the proton and neutron structure of an atom. Atoms have both protons and neutrons in the nucleus, and I want a way to reproduce this using blender.

enter image description here

As you can see in this picture, the Uranium-235 atom has a heck-of-a-lot of protons and neutrons (ignore the one neutron shooting off due to nuclear fission). I do not need the disorganization of the actual protons and neutrons, I just want an array to simulate the structural look.

Thanks.

(Note: I am using the latest version of blender (2.74)

$\endgroup$
2

3 Answers 3

13
$\begingroup$

Add a sphere, copy it, scale it down in edit mode Step1

Select the big sphere, go to the Object panel, under Duplication select Verts Step2 ( Blender 3.3 has different menu's and verbage, its "Instancing" not "Duplication" menu. But this method works! with that change ) Select the small sphere, hold shift, then select the big sphere. Hit CTRL+P and set the paren to Vertex Step3

Result should look like that Step4

You can now go select the big sphere again and go to edit mode, select all vertices. Use the "Randomize" option, I used a setting of 0.06. Step5

You can use the Object info -> Random input together with a Math node to give them different colors. Step5

This isn't an accurate representation of an atom I guess, but you said it's about simplicity and the visualisation aspect.

result

P.S.: If you are worried about the top / bottom of the result, as there are more spheres, you can try another type of sphere for the big sphere, e.g. the icosphere, that has an even distribution of vertices.

$\endgroup$
12
$\begingroup$

You are looking for a spherical array, but maybe you would settle for a set of points which are spread out evenly over the surface of a sphere?

If you are comfortable with the Math, you can easily script a vertex based object which can act as a 'donor of vectors/3d points' to place instances of smaller spheres (Neutrons, Protons).

import bpy
import random
import math

def fibonacci_sphere(samples, rseed):
    # http://stackoverflow.com/a/26127012/1243487
    rnd = 1.
    random.seed(rseed)
    rnd = random.random() * samples

    points = []
    offset = 2./samples
    increment = math.pi * (3. - math.sqrt(5.));

    for i in range(samples):
        y = ((i * offset) - 1) + (offset / 2);
        r = math.sqrt(1 - pow(y,2))

        phi = ((i + rnd) % samples) * increment

        x = math.cos(phi) * r
        z = math.sin(phi) * r

        points.append([x,y,z])

    return points

verts = fibonacci_sphere(120, rseed=20)

mesh = bpy.data.meshes.new("mesh_name")
mesh.from_pydata(vertices=verts, edges=[], faces=[])
mesh.update()

obj = bpy.data.objects.new("obj_name", mesh)

scene = bpy.context.scene
scene.objects.link(obj)

This bit of code when Run from the Text Editor, will produce a sphere of points based on fibonacci. This might give you the approximation.

enter image description here

Mapping the spheres onto the points.

  1. The script creates a points mesh named "obj_name" and adds it to the scene, in the object properties set duplication type to Verts,
  2. Create the Neutron/Proton representative sphere on the same origin as the points mesh, (I like to use a Object->Surface->NURBS Sphere)
  3. Set the Parent of the sphere to the points mesh.

This way you get a kind of Donor / Recipient relationship between the points mesh and the Neutron/Proton spheres.

When you render, the original NURBS sphere at the origin won't be visible, in contrast to when you are viewing in the 3d viewport, you'll see it all the time.


Sverchok

The Sverchok addon can be be used for this kind of visualization: https://blender.stackexchange.com/a/28792/47 . It's a Free and open source modular, node based geometry system built on Blender's custom Python Nodes API.

The same script as above exists inside Sverchok as a scripted node, meaning you can adjust a slider to increase or decrease the number of points (samples), and set a different Seed value (random starting point) without having to delete the object and run the script again. Then you connect other nodes to operate on the scale of the vectors it produces, then you can pick vectors by some logic gate and separate them into 2 different meshes, then assign the different spheres to represent Neutrons and Protons.

Within the space of 2 minutes I made this: (full disclosure I'm a contributor to Sverchok.. but with practice anyone can blaze through it)

enter image description here

The sphere of points is indexed, and i'm splitting them up by by the boolean result of index % 2. if that's 1 it goes into one mesh, else it goes into the other. The image above is just drawing openGL, there's no scene mesh yet.

We have nodes that do output meshes to the scene, called Bmesh Nodes

enter image description here

rather than every second vector, you can generate a random number for each vector and if it's larger than some value (between 0.0, 1.0), it goes into one mesh, else the other.

enter image description here

Here's the blend for that.

With a small modification you can even push the vectors away from the origin in a pulsating way.. drag the seed value or animate it

enter image description here

Though I imagine it behaves very differently, twisting and contorting..

$\endgroup$
2
$\begingroup$

A very simple approach (admittedly less powerful than zeffii's). You can apply three array modifiers to an object, e.g. a sphere, and then play around with offset until you have a nice 3D grid of spheres. Then you can apply the modifiers and start removing spheres until you have a somewhat nucleus-like object. Its fairly straight forward, my steps were:

  1. Create 3D grid with array modifiers. I found that these settings with a default sphere gave a nice grid. When you are happy with how the spheres tessellate you apply the modifiers (the order of application is important, start from the top).

enter image description here

enter image description here

  1. Center the object origin. Go into edit mode (tab), and select all vertices (A). Center the curser in the geometry (S -> U), go back into object mode (tab), and set the geometry center at the 3D curser (shift + ctrl + alt -> T).

  2. Create the nucleus border. Create a new sphere (shift + A -> M -> U) at the center of the 3D grid. Scale the sphere up until its sides become visible just outside of the 3D grid.

  3. Remove spheres in the grid, outside of the nucleus border. Select the grid and go into edit mode. Start deleting spheres that are not contained by your new sphere object. A nice hotkey to use here is ctrl + L, which selects all connected vertices of any selected vertices, such that you can easily select a connected component. Your end result should look something like this, on the left without the nucleus border removed, and on the right, your final result.

enter image description here

You might want to play around with which protons/neutrons you wan't to keep in your nucleus, in order to make it appear realistic (if we are allowed to use this term). For very large nuclei this can look great, but depending on your computer's processing power, you might end up having trouble manipulating the geometry in edit mode because of the enormous number of vertices.

SO If you're looking for something simple go for this method, otherwise I suggest you spend a moment longer and try to implement zeffii's.

$\endgroup$
2
  • $\begingroup$ I think I prefer your method, or maybe a containment forcefield. $\endgroup$
    – zeffii
    May 2, 2015 at 8:16
  • $\begingroup$ @zeffii thanks! not much to it, but with a containment forcefield, it's definitely a bit more interesting, didn't think of that one. $\endgroup$
    – Ulf Aslak
    May 2, 2015 at 9:03

You must log in to answer this question.

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