Plotting particles with pre-existing space-time coordinates

I’m using Blender to make pretty pictures for astrophysicists. I’ve gone through the Modeling tutorial, and searched the FAQs, but can’t find the answers to some questions I’m stuck on.

What I need to create is a cosmic ray detector (already created; see http://astro.uchicago.edu/cosmus/projects/auger ) and a shower of particles falling on it. I can’t use the particle stuff referred to in the FAQs; here I have the x-y-z-time-etc positions of thousands of particles already (produced by one of the astrophysicists’ simulations) and need to visualize them. How do I do that?

Thanks,
Dinoj S.

You will probably have to do it through some python scripting. If you already have the plotted points and stuff… its less particles than just thousands of objects when refering to 3d animation terminology.

Thanks. Ok, I’ll start on the Python-Blender tutorial. I suppose I’ll have to just have to write a script to create thousands of objects, each with parameters defined by some external file, and specify when they should be turned on and off. I hope that’s not hard - switching from Perl to Python should be the least of my problems.

Has anyone done this already, for anything physics-related?

create an empty mesh (add a plane or something then X->All), and call the object (in editbuttons, F9, the OB: field) something useful (“PythonParticles” I used), give it a halo material, then in a script window (Shift+F11):

import Blender
obj = Blender.Object.Get("PythonParticles")
mesh = obj.getData()
frame = Blender.Get("curframe")
mesh.verts = []
# replace the next line with something more interesting...
# this just makes one particle, moving off in a straight line...
mesh.verts.append(Blender.NMesh.Vert(frame,frame,frame))
mesh.update()
Blender.Redraw()

Switch frames and press Alt+P in the script a few times, to check that it’s working properly, then in scriptbuttons (no shortcut, between logic and material buttons) add a link, linking the script to the “framechanged” event.

Test with Alt+A

Useful links:
http://www.python.org/doc/2.3.4/ - python doco
http://www.blender.org/modules/documentation/233PythonDoc/ - bpython doco (for 2.33 but not much has changed in 2.34 - check the release notes)

Awesome, thanks very much! These are very detailed instructions. Now I should be able to get a shower out within the next week, allowing for debugging. I’ll post a note when done… or if I run into serious trouble.

with 2.34 doesnt blender recalc each frame for particles? or maybe i missed what you were trying to do with the particles exactly :expressionless:

the script doesn’t use blender’s particles - it builds it’s own fake particle system by building a mesh with verts where the particles should be. Then it moves the verts around where the particles should go (well technically it removes them and adds new ones, but same thing really)

For all intents and purposes it’s exactly the same as blender particles except you have to code the motion yourself, and you can’t have “Vect” halos.