I face a really odd thing When rendering a scene the output AVI file is very different from the animation I see inside blender. The script is looping over a function which create the scene:
def main(self):
for i in range(self.n_scenes):
valid_scene = False
while not valid_scene:
self.clean_scene()
valid_scene = self.create_scene()
if len(os.listdir(self.output_path)):
self.render_scene(f'{len(os.listdir(self.output_path))}.avi')
else:
self.render_scene('0.avi')
For example the initial position of the objects is really different from what I see in blender, in addition from the 2nd frame the locations are different from the first frame.
Before rendering I bake all the objects using bpy.ops.ptcache.bake_all()
and for cleaning the scene after each render using the following funciton:
def clean_scene(self):
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
What am I doing wrong? Is there any why to reset the scene? why there is a difference between played animation over blender and the rendered one?