https://vimeo.com/81868094
Another biochemical project, this time by Marcin Klapczynski (check out Ricardo Raimundo's work as well, in case you missed it). Marcin animated over 5,000 objects using a simple Python script, which he shares below.
Marcin writes:
I made a short animation of molecular signaling pathway of Interleukin 1, which is important part of our immune system response:
There are over 5 thousands objects in the scene, and majority of them, like phospholipids in the cell membrane or tiny molecules like ATP and aminoacids, are animated using Python scripting. It wouldn't be possible to animate them manually giving them random, more realistic pattern.
Here's the Python script, some of you may find it useful. The script works on selected objects only, so the workflow is:
- select objects to animate
- insert keyframe (location rotation)
- move timeline to desired frame
- run script
- insert keyframe (location rotation)
- repeat
The below script will select random value from -5 to 5 Blender units for location and from -15 to 15 euler for rotation. These values can be changed to achieve desired effect. Some lines can be commented out or removed if changes are desired only in particular axes.
Here's the script:
selected_objects = bpy.context.selected_objects
for object in selected_objects:
x_value = random.uniform(-5.00,5.00)
y_value = random.uniform(-5.00,5.00)
z_value = random.uniform(-5.00,5.00)
x_value_rot = random.uniform(-15,15)
y_value_rot = random.uniform(-15,15)
z_value_rot = random.uniform(-15,15)
object.location.x += x_value
object.location.y += y_value
object.location.z += z_value
object.rotation_euler.x += x_value_rot
object.rotation_euler.y += y_value_rot
object.rotation_euler.z += z_value_rotEnjoy!
11 Comments
I rather enjoyed that, thank you!
I don't normally follow the scientific posts, but I'm glad I did.
There was a definite sense of drama as the process picked up pace. I particularly liked the purposeful snap of movement in the later stages of the cascade!
Thanks. Yes, molecular world is dramatic and beautiful indeed!
This can be interesting for my sister :) She has a degree in chemistry. Is it looks like that in a powerful microscope?
No, it's pure imagination. Scanning electron microscope can pick up large molecules, but not to this level. Also, the actual cascade timing is matter of microseconds. The inside of a living cell is much more complex and crowded - this is only one out of thousands of molecular cascades.
Thanks, I got it now! :)
I saw this yesterday and I was amazed!
Very beautiful. Very polished looking.
Congratulations Marcin for the amazing job!
Thanks Ricardo!
Much as I am a Python fan, and still consider it as my language of first choice whenever I think of a new programming project, this is yet another example of why its reliance on whitespace for block structuring was such an unfortunate design decision.
Where exactly is that for-loop supposed to end? Your guess is as good as mine.
Agreed. Why not curly braces like elsewhere? It got changes after I pasted the code in the post.
All lines below the line where the loop starts are in the loop. All the spatial operations are executed for each active object.
Try this:
from __future__ import braces
to see GvR’s answer to requests for adding braces to Python.
x_value = random.uniform(-5.00,5.00)
y_value = random.uniform(-5.00,5.00)
z_value = random.uniform(-5.00,5.00)
@drift boss