I have a lot of 3D Characters and I wish to use them in a 2.5D game as Sprites; in doing this I have to render them from a fixed camera angle and since each should have its own atlas file containing animation frames, it's going to be a very time consuming job! I was thinking to write a python script (models are in Blender format) and let it render the Sprites. Since I don't know Python do you think that it is efficient of me to learn the python first and write the script to do the job for me? Does anyone have a better idea?

In brief: I am looking for an efficient method to export pre-rendered sprites from 3D models considering that they all have the same armature with the same animations.

  • \$\begingroup\$ Can't Blender just batch render all the frames of an animation? Admittedly I haven't done this in Blender, but I can't imagine an animation tool lacking that ability. \$\endgroup\$
    – jhocking
    Commented Jun 2, 2015 at 21:55
  • \$\begingroup\$ As I mentioned, Using Python, Blender has the ability no doubt,but the problem is that I don’t know python very well! I was wondering if it is a good idea to learn python and do the job with Blender, but there must be other methods/technologies to do so, good news is I already found a script which render from 8 view port that I need in my process of rendering while building 2D pre-rendered sprites. \$\endgroup\$
    – Iman Nia
    Commented Jun 2, 2015 at 22:25
  • \$\begingroup\$ no I mean like a Batch Render button. Rendering out the frames of an animation isn't some obscure thing that you should need to script; that's a core function of animation software. \$\endgroup\$
    – jhocking
    Commented Jun 3, 2015 at 0:27
  • \$\begingroup\$ blender can do a batch render, but each frame would be in it's own file. You would need a script that creates a texture atlas out of it. But this merge of images into an atlas would be a lot easier to write and more flexible \$\endgroup\$
    – Tobias B
    Commented Jun 3, 2015 at 22:18

1 Answer 1


Learning Python is very easy I found a code in the internet and customized it to render from 8 different view port while fixing the lamp and camera location, the code also scales the objects to fit in 1 meter cube so the camera and lamp can be fixed correctly.

I succeed to write the following code in one night! Thanks to Python! and Blender API Documentation. Hope this help some body. I am working on copying armatures from a .blend file into other characters meshes and rendering different POS from the 8 corresponded viewport to use them in my game as sprite sources.

 import bpy
 cam = bpy.data.objects["Camera"]
 cam.rotation_mode = 'XYZ'
 cam.location = (1.5,0,3)
 cam.rotation_euler = (0.5236,0,1.5707)
 alamp = bpy.data.objects["Lamp"]
 alamp.location = (1,0,1)
 alamp.rotation = (0,0,0)
 meshObj = bpy.data.objects["boss"]
 meshObj.rotation_mode = 'XYZ'
 meshObj.rotation_euler = (0,0,0)
 d = meshObj.dimensions

 # Finding maximum dim of the object
 objectScale = 1
 if d[1] >= d[2] and d[1] >= d[0]:
     objectScale = 1 / d[1]
 elif d[2] >= d[1] and d[2] >= d[0]:
     objectScale = 1 / d[2]
 elif d[0] >= d[1] and d[0] >= d[2]:
     objectScale = 1 / d[0]

 # Normalize object since some of them are bigger
 print("Scaling ",objectScale)
 meshObj.scale = (objectScale,objectScale,objectScale)

 # Rotating X axis if object is X -Z Y Convert to X Y Z
 rot = meshObj.rotation_euler
 if d[1] > d[2]:    
     print("Rotating X by 90 Degree")
     rot[0] = radians(90)
     meshObj.rotation_euler = rot;    
 # Initiating the Rotation/Render Loop
 rot[2] = 0  # Start from Z Rotation = 0
 meshObj.rotation_euler = rot;
 for x in range(1,8):
     angle = (x-1)*0.7854
     rot[2] =  angle
     meshObj.rotation_euler = rot;
     bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/Boss00%d.png" % (x)
     bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera")

You must log in to answer this question.

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