I am using Cycles with OptiX to render a lot of different camera angles of the same scene.

Using code like:

for camera in cameras:
  # Set camera location to x,y,z etc

  # Render the scene

Works for me, but I have an issue that each render re-initializes the OptiX renderer and re uploads all the data. In my case this is a significant amount of data. I have found that setting a multi camera works for this:

bFirstCamera = True
for camera in cameras:
  cameraPosition = camera.position

  # Create the camera object
  camObj = bpy.data.objects.new("Camera_" + camera.name, camData)
  camObj.location = (cameraPosition[0], cameraPosition[1], cameraPosition[2])

  # Get the first render view and override it
  renderView = bpy.context.scene.render.views[0]
  if bFirstCamera == False:
      renderView = bpy.context.scene.render.views.new(camera.name)
      bpy.context.scene.camera = camObj    

  # Set the camera in the render view
  renderView.name          = camera.name
  renderView.camera_suffix = camera.name
  renderView.file_suffix   = camera.name
  renderView.use = True

  bFirstCamera = False

# Render the scene with all cameras at once

This also works and is much faster than doing them one by one. However, the compositing stage does not run until all the cameras are rendered, which uses a lot of memory (there are a lot of views) and another image process (outside of Blender) that is waiting on the results cannot start processing the images until all of them are done.

Is there a way I can:

  • Flag "do compositing after each render view"?
  • Or, Keep optiX scene in memory between renders if no change?
  • Or, Some other Blender render view setup?

1 Answer 1


I believe I have found the setting I need:

Render Properties -> Performance -> Final Render -> Persistent Data

or the python

bpy.context.scene.render.use_persistent_data = True

The Persistent Data feature is new in Blender 2.93 (see release notes).


You must log in to answer this question.

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