Description of Problem
I would like to create an animation of 100,000 atoms with 10,000 frames from my molecular dynamics simulations. Currently I am using dupliverts with a single uv sphere for each atom type. This has worked great in creating a single frame using the python api. However, I am unsure on the correct way to specify the change in vertices at each frame in Blender. I have data that will give me the position of each atom at each timestep/frame.
What I have Tried
What would be the ideal way to animate this simulation? From reading I have seen that using shape keys would allow me to specify the change in the vertices from initial positions (Basis). However, this would mean that I would have to create 10,000 shape keys and change the value from 0 to 1 for each step but would allow me to take advantage of interpolation. The best example I can find showing how this can be done using the blender python api simple example of shape key python api. However, when I used this I was only able to create one shape key not the 10,000 that I would need.
edit: So I got the functionality that I need using this code. But it still does not answer are shape keys the correct way to handle 10,000 steps?
obj = bpy.context.object
shape_keys = ['step ' + str(i) for i in range(10000)]
for shape_key in shape_keys:
obj.shape_key_add(name=shape_key, from_mix=False)
for shape_key in shape_keys:
bm = bmesh.new()
bm.from_mesh(obj.data)
shape = bm.verts..layers.shape[shape_key]
for vert in bm.verts:
vert[shape] = 'change vertex position here'
bm.to_mesh(obj.data)
Probably very inefficient would be interested if there are better ways.