# Convert particle system to animated meshes

I've started trying to make a 3D model that I will end up exporting to an augmented reality app but I've hit a problem in terms of the particle system. The app wants the 3D file in .dae(collada) format which blender allows, but it doesn't seem to export particle systems. I've read that blender doesn't support exporting particle systems at all so I'm now focused on converting the particle system to lots of meshes which will (hopefully)animate using key frames. Then I can export all the meshes and the particles will 'work'.

Currently I'm just using a standard particle system emitting small icospheres. I've tried a few different techniques, such as 'make duplicates real' and using a particle instance instead but they don't seem to animate. Instead it just freezes the current frame into an object(which exports fine but is not what I want). I've also tried recording the animation in the blender game engine but particle systems don't work with it so that didn't work either.

Any help would be appreciated! Thanks

• If the particle system isn't doing anything particularly (no pun intended) interesting. Why not try rigid bodies? These can be keyframed easily. – iKlsR Nov 18 '13 at 12:32
• @iKlsR Good idea, though AFAIK there is no way to make rigid bodies appear like particles (e.g. get emitted from a plane over time) – gandalf3 Nov 18 '13 at 20:21
• I found this script which converts a particle system to rigid bodies: blenderartists.org/forum/… The only issue is that when I export this as a collada file the animations run instantly, almost like bullets. – roarster Nov 18 '13 at 20:35

I think the only way to do it is with some Python scripting. First select the object you want to show in place of the particles (dupli object) and then select the object with the particle system. Then run the following script. But be aware, it can get quite slow if you have lots of particles (for 5000 particles and Suzanne as dupli object, it took almost 4 minutes on my computer).

import bpy

# Set these to False if you don't want to key that property.
KEYFRAME_LOCATION = True
KEYFRAME_ROTATION = True
KEYFRAME_SCALE = True
KEYFRAME_VISIBILITY = True  # Viewport and render visibility.

def create_objects_for_particles(ps, obj):
# Duplicate the given object for every particle and return the duplicates.
# Use instances instead of full copies.
obj_list = []
mesh = obj.data
for i, _ in enumerate(ps.particles):
dupli = bpy.data.objects.new(
name="particle.{:03d}".format(i),
object_data=mesh)
obj_list.append(dupli)
return obj_list

def match_and_keyframe_objects(ps, obj_list, start_frame, end_frame):
# Match and keyframe the objects to the particles for every frame in the
# given range.
for frame in range(start_frame, end_frame + 1):
bpy.context.scene.frame_set(frame)
for p, obj in zip(ps.particles, obj_list):
match_object_to_particle(p, obj)
keyframe_obj(obj)

def match_object_to_particle(p, obj):
# Match the location, rotation, scale and visibility of the object to
# the particle.
loc = p.location
rot = p.rotation
size = p.size
if p.alive_state == 'ALIVE':
vis = True
else:
vis = False
obj.location = loc
# Set rotation mode to quaternion to match particle rotation.
obj.rotation_mode = 'QUATERNION'
obj.rotation_quaternion = rot
obj.scale = (size, size, size)
obj.hide = not(vis)
obj.hide_render = not(vis)

def keyframe_obj(obj):
# Keyframe location, rotation, scale and visibility if specified.
if KEYFRAME_LOCATION:
obj.keyframe_insert("location")
if KEYFRAME_ROTATION:
obj.keyframe_insert("rotation_quaternion")
if KEYFRAME_SCALE:
obj.keyframe_insert("scale")
if KEYFRAME_VISIBILITY:
obj.keyframe_insert("hide")
obj.keyframe_insert("hide_render")

def main():
# Assume only 2 objects are selected.
# The active object should be the one with the particle system.
ps_obj = bpy.context.object
obj = [obj for obj in bpy.context.selected_objects if obj != ps_obj][0]
ps = ps_obj.particle_systems[0]  # Assume only 1 particle system is present.
start_frame = bpy.context.scene.frame_start
end_frame = bpy.context.scene.frame_end
obj_list = create_objects_for_particles(ps, obj)
match_and_keyframe_objects(ps, obj_list, start_frame, end_frame)

if __name__ == '__main__':
main()

• This is amazing. Do you think it can be modified to work with hair particles ? – ChameleonScales Mar 5 '17 at 0:34

To convert just a single frame of the animation:

With the emitting object selected, press Ctrl+Shift+A to make all the emitted objects real (convert them from particles into actual objects)

• That will convert a single frame to a static mesh but roarster is after exporting the animation of the particles. – sambler Nov 20 '13 at 11:14
• True, I assumed this would work for animated particles too :/ – Greg Zaal Nov 20 '13 at 11:32

I think it would be simpler and easier to attach a particle system to the blender generated geometry directly in the AR application.

You only import the object without any particle system from blender. Then in your AR app, you add a particle system to this object.

For iOS for example in ARKit, you can add a particle system to a SCNNode.

I'm trying to do exactly the same thing right now, I'll let you know. I was able to add a smoke + fire particle system in blender to a rocket, then was frustated that it would be exported in collada .dae as dumb boxes (the particle system smoke domain). So I'll try to generate the same particle system directly in iOS.