I have done a 3D parking modeling, I tried some python code to output the image of the rendering parking, parking image.

output the image

  filepath = self.output_dir + '/images/' + str(i + 1) + '.png'                            
  bpy.context.scene.render.filepath = filepath

change the viewpoint

bpy.data.objects['Camera'].location = [20,1,0]
bpy.data.objects['Camera'].rotation_euler = [20,30,40) ]

My objective is to let python program collect the images in all camera perspective, what I can do at the current time is to use the render function during the for loop

  for i in range(0,  car_num): 
    bpy.ops.render.render(write_still = True) 

however each new rendering take 2 minutes to load everything from the beginning.

so my question is how to program to make the scene change the camera perspective or modify the object at the runtime (without loading and rendering 2 minutes every time when a small change occurs) , like what we do in the game or 3d modeling?

  • 1
    $\begingroup$ If you call bpy.ops.render.opengl(write_still=True) it will output the viewport image instead of doing a full render. This is a lot faster. $\endgroup$ Jun 11, 2017 at 6:42
  • $\begingroup$ @LukasValine I reviewed the code, found i was using the bpy.ops.render.opengl(write_still=True) $\endgroup$
    – user824624
    Jun 11, 2017 at 13:16
  • $\begingroup$ @LukasValine my model contains 11 car models, if I reduced the models to 2 or 3, does this will make the rendering faster? $\endgroup$
    – user824624
    Jun 11, 2017 at 13:22
  • $\begingroup$ Make sure you're not calling bpy.ops.render.opengl(write_still=True, animation=True). The animation argument is the only thing I can think of that would make the opengl render take two minutes like you say. $\endgroup$ Jun 11, 2017 at 13:26
  • $\begingroup$ As a side note recommend using scene.camera, ie the one that renders that scene, rather than bpy.data.objects["Camera"]. And if you are going to change the camera scene.objects.get("SomeCameraName"). You cannot render a scene if the camera is not linked to it. $\endgroup$
    – batFINGER
    Sep 18, 2017 at 6:55

1 Answer 1


Well there are 2 options you have here. 1. Optimize all your materials and bake all static shadows. That way the rendering will take as little time as possible. 2. Once you load the scene, move the camera to all locations you want to render but don't render, just add keyframes. When you add keyframes to all locations then start to render the number of frames you need. That way you will only prepare for rendering and load into memory once and then render everything you need in one pass.


You must log in to answer this question.

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