Automatically rotate model and render

Hi,

I want to rotate the model by various rotation intervals. For example rotate the model in 10 degree increments around the X-axis to create 36 renders of the model rotating. I want to use this for a computer vision algorithm but I guess this is also used to make 2D sprite-sheets from 3d models for games. I’m wondering whether someone here would have a script that does something similar to what I want.

Thanks

First, add an empty and parent your object to the empty.


mport bpy
import math


o = bpy.data.objects['Empty']
for a in range(0, 360, 10):
    o.rotation_euler.x = math.radians(a)
    # render
    bpy.data.scenes["Scene"].render.filepath = 'C:/tmp/rotation_%d.jpg' % a
    bpy.ops.render.render( write_still=True )

The object is rotate each 10 degress