I am quite new to Blender and thanks for your help.

I need to render multiple .stl files (say 1000) by timeline (one per frame) generated from a third party software, which are basically calculated tsunami meshes. They need to be shown only one for each frame with city/environment created in Blender to compose a decent coming tsunami scene.

I have read some threads talking about rendering objects individually using ID Mask, whereas they seem to be limited to non-overlapping objects. And only objects with the same Index of the frame would be rendered, but what about the background (houses/trees/roads...), which need to be rendered for all frames? It might also be annoying to set Pass Index for tons of objects correctly by hand.

How to render individual objects (one per frame)

How to output ID masks as seperate files for compositing?

The other thread talking about key-framing the visibility for objects might help, but I don't think it is a good idea to go through the 1000 objects and do this one by one with unbelievable time consuming and high mistake risk, except for using scripts though.

How to make an object invisible at a particular keyframe without moving it in Blender (2.59)?

Is there another way to do this automatically in a cleverer way, or some scripting idea?


P.S. I managed to render similar scene using CINEMA4D before and found a way out using Python to toggle with each object's visibility.

How to script the Render_Visibility for a sequence of objects?

Now I am asked to test in Blender, so...Any ideas?

  • 1
    $\begingroup$ Have you considered going a different way? If these STL files are animated mesh data you could try the mesh cache modifier instead, that's what it is for. You would have to either have access to the original data/application to be able to export .mdd or .pc2 files or be able to batch convert your 1000 files, though. blender.org/manual/modeling/modifiers/modify/… $\endgroup$ Commented Jun 23, 2016 at 3:03
  • $\begingroup$ Can I think this Mesh Cache Modifier as something like RealFlow's Mesh Importer plug-in in C4d that imports out-sided mesh sequence generated by RealFlow? Actually that came to my mind at first, which would be perfect solution without importing all the heavy meshes. I have tried to look into that part but with no luck of creating similar .bin files for importing...Here comes the .mdd/.pc2 files though. Do you have some examples or ideas where can I approach to create such formats? I have total access to original data. $\endgroup$
    – Juii
    Commented Jun 23, 2016 at 7:08
  • $\begingroup$ I don't know C4D but it sounds like a similar function. I never used the mesh cache myself but it came to mind when you described what you intented to do. I did a quick search but could not find any information about those file formats, not sure if it is something blender creates itself internally or something. I'll have to investigate further, I'll get back to you if I find any useful information about it. In the meantime if you like you could look into the blender's built-in fluids simulator which would do all this work for you internally,if you don't mind recreating your simulation that is $\endgroup$ Commented Jun 23, 2016 at 13:01
  • $\begingroup$ Well what I found is that PC2 is a point cache format for 3DsMax and MDD is another point cache file format. I couldn't find a lot of information on how to convert to/from them except a few plugins for certain applications. I only found this old thread about the same issues blenderartists.org/forum/archive/index.php/t-314625.html Maybe one the answers bellow can help $\endgroup$ Commented Jun 23, 2016 at 17:48
  • $\begingroup$ I am afraid that the fluid simulation is far from what they need in case of disaster analysis. Thank you for you helpful information. I think I need to dig more into the mesh cache part:P $\endgroup$
    – Juii
    Commented Jul 1, 2016 at 7:53

2 Answers 2


Based on a previous answer I would use a script that imports each stl file and keyframes the visibility as it goes.

import bpy
scn = bpy.context.scene
for f in range(scn.frame_start, scn.frame_end):
    fpath = bpy.path.abspath('//sim_data_{}.stl'.format(f))
    obj = bpy.context.active_object
    # key as visible on the current frame
    # hide it
    obj.hide = True
    obj.hide_render = True
    # key as hidden on the previous frame
    # key as hidden on the next frame
  • $\begingroup$ I tried your method, and it works! Thanks!! Some following question: After imported and key-framed, it seems impossible to group them at once, while I want to have them as a group and apply/twist material together. Any suggestions? $\endgroup$
    – Juii
    Commented Jul 1, 2016 at 7:50
  • $\begingroup$ You can select hidden objects from the outliner and you can still manually change the visibility, use Alt-H to unhide all hidden objects allowing you to select objects in the 3dview and group or change materials. $\endgroup$
    – sambler
    Commented Jul 1, 2016 at 12:51

The technique I use is demonstrated in http://web.purplefrog.com/~thoth/blender/python-cookbook/data-graph.html . Here's the relevant excerpt:

def setVisibility(obj, f1, f2):

    if not f2 is None:
        obj.keyframe_insert(data_path='hide', frame= bpy.context.scene.frame_end+10)
    obj.keyframe_insert(data_path='hide_render', frame=f1)
    obj.keyframe_insert(data_path='hide', frame=f1)
    obj.hide = True
    obj.hide_render = True
    obj.keyframe_insert(data_path='hide', frame=0)
    obj.keyframe_insert(data_path='hide_render', frame=0)
    if not f2 is None:
        obj.keyframe_insert(data_path='hide', frame=f2)
        obj.keyframe_insert(data_path='hide_render', frame=f2)

The hide_render property prevents an object from being rendered. The hide property prevents it from being seen in the editor. They are permitted to have different values, but in situations like this it is convenient to have them be the same.

You can use a similar technique to make each of your meshes visible for a single frame.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .