Animating multiple objects with modifiers

Hi, I was looking for a way to animate a bunch of objects, wrote this simple script that can help in some cases. It creates a tri for each selected object and parents the object to this 3 new vertices, so you get a cloud of faces that can be animated or deformed with modifiers, also animating or deforming the objects parented to it… like a dupliface thing the inverse way, the mesh is created frome the objects.

Here’s a video showing some test I did and the script and a file.
Just an experiment but it was fun.

video http://vimeo.com/18588203
script https://www.dropbox.com/s/u4v1g0t6zkjzb6k/parent_mesh_addon.py?dl=1
file http://db.tt/BGi9mSa

Attachments


Another video test with this script, there are 1800 objects that can be animated with a single wave modifier. The voronoi crack pattern was done in Inkscape with a click, importing into Blender resulted a bit trickier…

video: http://www.vimeo.com/18661627
blend: http://db.tt/zg5XWrS

Attachments


whoa! i’m gona test it up ASAP!
thanks for sharing, man!

u really are a genius. I tried to do something like this before using the fracture addon, following the same idea as you. I tried to parent different objects to the vertices of a place, and have a modifier effect the plane, therefore animating all the parented objects. However, results were not satisfactory, since i couldn’t pull it off, so i gave up on the idea.

You really have achieved something spectacular, especially the voronoi example. This would be useful for ground impacts, or earthquakes. Something similar to the effects in the film, “2012”, which took the animators quite some time to achieve something like this

Fantastic effect. Thanks.

ok so uh, how on earth did u get the voronoi texture to “crack” the object into all those different pieces? Could you please provide short step-by-step instructions? It would be reaally helpful, thanks.

Hey people thanks for the kind comments. This can easilly be done by hand on a few objects, just parent each to 3 vertices of a mesh and you’re done. The script creates a face and the parenting for a lot of objects.

@blazr_raidr the voronoi pattern was created in inkscape as a bunch of vectors, then when I finally managed to import them to Blender they where just edges so joined them, did some cleanup, marked sharp, filled faces, and break appart the pieces whith edge split modifier.

this is 100% genius fantastic. thankyou for sharing!

you can create some “padre” object but connected, so we can put a cloth modifier on that? just ideas. :smiley:
I was playing yestersay a little.

Nice effects, The duplitext is interesting.
Very useful script, thanks for sharing

@meschoyez: yes I thought about that but it exceeds by far my skills :wink: I tried Meshlab but messed up the point indexes… will insist on this. All you can play with are shapekeys and the deform modifiers.
@kala_ndo: thanks, I like the text one too

update: just tried a slightly different version that creates only edges according to a vertex proximity threshold, so to be able to do simple softbodies simulations… ‘distancia’ is the value under which an edge will be created… don’t know if this is useful but that was never the point :smiley: have fun

This is a really smart idea. I’m playing around with it now. Thanks a lot for sharing.

how did u import the voronoi texture into blender as edges? When i try, i just get a plane as a curve in blender, no cracks.

You need to ‘vectorize’ the pattern in inkscape, then I think I used illustrator to create a dxf, can’t remember now. Anyway here is a small ‘tutorial’ on how it can be done with free tools:

  1. draw some shape in inkscape
  2. generate voronoi pattern from extensions menu
  3. convert pattern to vectors from object menu
  4. save the file as svg
  5. use uniconvertor to get a new blender friendly svg
  6. import svg to blender 2.49 -clamp height to get a flat mesh- and save blend
  7. open or append file in blender 2.5x
  8. each spline is a closed one -that’s bad- so run the little script to convert to edges
  9. in edit mode remove doubles -lot of points-
  10. mark everything as sharp edges so we can split later
  11. fill the mesh -alt + F-
  12. do some cleanup -the fill thing works from up to down and there will be artifacts-
  13. add an edge split modifier in sharp edges mode
  14. apply the modifier
  15. go edit mode again and select all faces
  16. press P to separate by loose parts
  17. go object mode and select all parts
  18. set origin to geometry
  19. you are done!

the script to open splines and convert to mesh:


import bpy
obj = bpy.context.object
if obj.type == 'CURVE':
    for z in obj.data.splines:
        z.use_cyclic_u = False
    bpy.ops.object.convert(target='MESH', keep_original=False)

thanks mate!

@liero: that’s really useful !!! thank you very much :slight_smile:

ehm, I just . . . don’t know if its my or script’s problem.
If I select more than one object, script creates triangles under all selected objects, but “padre” object is not parented to anything.
(Script works if I select only one object. Tested with blender r34764.)

Thanks for more info*

OK, it works well with script you post as separate file.
(As first I tried your file with letters, script in this file is not working proper for me.)

Unless I’m misunderstanding what you’re saying… what you’re describing is exactly how the script is supposed to work. Now you apply modifiers to the padre object (such as the Wave modifier) and you’ll see all the objects responding to the single modifier (as they have been parented to “padre” via tri-vertex parenting).

EDIT: One thing to watch out for with this script is giving each object its own origin. So you could make a plane, then use a couple arrays to make a field of planes, say 50 x 50 planes. You apply the modifier, then go into edit mode separate by loose parts, which would give you 2,500 planes but each plane would share the same origin. The “padre triangles” are matched with each object’s origin, so before running the script you’ll want to select all your objects and press ctrl_alt_shift+c and choose “Origin to Geometry.” I’m betting your confusion was caused by something along these lines…

benu the script gave me some trouble when run twice on the same file, I even remember appending my objects into a new doc. Didn’t find the reason at the time, but that could easily be vklidu problem…
If you want to play with text there is a little script to separate the letters and set their origins. You can find both as a part of the collaborative multitools addon in blenderheads scripting forum.

  • As an example add a text object, or just paste some text in a text editor and press Alt+M.
  • Convert to mesh with Alt+C and add a solidify modifier to the mesh.
  • Then run this script to get each letter as a single object, with the corrected origins.
import bpy
lista = dict(bpy.data.objects)
for objeto in bpy.context.selected_objects:
    if objeto.type == 'MESH':
        bpy.context.scene.objects.active = objeto                    
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.separate(type='LOOSE')
        bpy.ops.object.editmode_toggle()
    else: objeto.select = False
for objeto in bpy.context.scene.objects:
    if objeto.name not in lista.keys():
        bpy.context.scene.objects.active = objeto
        objeto.select = True
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
bpy.ops.object.select_all(action='DESELECT')

Now you can run the parenting script… of course this will work with any mesh other than a converted text, separating pieces and setting the origin.
Just another thing to note, in the planes example you gave I would simply use duplifaces, this script only makes sense if animating differents objects.

thanks for the feedback!

@benu: I have to apologize to you I wrote it wrong - objects are not parented to the “padre”
(origins are on a right place), but as I wrote in a new file it works briliant :slight_smile:

@liero: first of all it works for me in a new file
Sounds like you wrote, but not sure. Just some feedback:

  • today I opened your letter file - deleted padre and run the script agian - works
  • deleted all objects created few new, runed script - it doesnt
  • unlink script, save, close, open file, open script, place objects - it doesnt
  • open new file, insert objects, open script, run - it works
  • I can run succesfuly script severeal times - it works

So the only one problem I had was your leter file to run it again.

About the script (separate letters and set origins) I will test it, but for me looks easier to select all vertices of letters in edit mode and separate by loos parts, than select all letters and set origins to geometry, instead of collecting scripts. I will test it if I miss some feature. Thanks for answer (Also thanks for Alt+M :slight_smile: I didn’t know that)