Background: We are building an automated pipeline to extract motion (i.e. vector pass output) from animated blends by running scripts using blender's python API. We are able to programmatically set up nodes and run rendering. We need access to full precision x,y motion components, and the only way we found of accessing that was via bpy.data.images['Viewer Node'].pixels. This gives correct output when running with GUI.

Problem: We need to run blender in background mode on many examples, and in background mode bpy.data.images['Viewer Node'].pixels has a) wrong resolution (does not respect scene.render.resolution_x), b) wrong info (everything is zero).

Existing solutions: We know that it is possible to modify blender source code to fix this, but we want to open source our pipeline, and creating a custom blender build to run it might be too much of an impediment for people. We'd like to make this work with a standard blender version.


  1. Is it possible to access vector pass data in some other way, without using the Viewer Node, so that rendering can be done in the background?
  2. Or, is there a way to force Viewer Node to output correct data in background mode?
  • $\begingroup$ Can you give a bit more detail about what the viewer node is connected to? Is it just the standard vector pass or are you doing some processing in the compositor? $\endgroup$ Feb 22, 2018 at 18:02
  • $\begingroup$ @RayMairlot, we simply connect the Viewer Node to the vector output in render layers; no compositing. $\endgroup$ Feb 22, 2018 at 18:37
  • $\begingroup$ Did you take a look at this link before? It seems that there is a way to enable back-dropping using Python but I have not been able to figure out how as Blender's documentation is a bit unclear. It would be great if you can understand what the documentation is saying and enable backdropping using Python. If you did, could you please take a look at my question here and post an answer? $\endgroup$
    – Amir
    Mar 14, 2018 at 1:11
  • $\begingroup$ @Amir, we haven't worked with backdropping $\endgroup$ Mar 14, 2018 at 11:12

2 Answers 2


Another option to evaluate would be to store the result in MultilayerEXR When writing a MultiLayerEXR file as output. this vector pass is also stored inside the generated EXR file:

render = scene.render
render.layers[0].use_pass_vector = True
render.image_settings.file_format = "OPEN_EXR_MULTILAYER"
# after rendering the open exr file 

After rendering all layers in blender (before and after compositing are written inside the create OpenEXR file. No fiddling needed in the compositor.

There is currently no API available to read the Render Result directly from the renderer.

  • $\begingroup$ This is probably the best answer if you are only looking for vector pass output, which is what my question is about. In our case, we use nodes to process some of the other outputs in addition so my answer worked well for us. $\endgroup$ Mar 14, 2018 at 11:08

In the end the solution was to use multilayer EXR output by constructing a simple node graph automatically in python (Blender 2.78).

bpy.context.scene.use_nodes = True
bpy.context.scene.render.layers[0].use_pass_combined = True
bpy.context.scene.render.layers[0].use_pass_vector = True

tree = bpy.context.scene.node_tree
rl = tree.nodes.new('CompositorNodeRLayers')
rl.location = 0, 200

output = tree.nodes.new('CompositorNodeOutputFile')
output.location = 200, 200
output.format.file_format = 'OPEN_EXR_MULTILAYER'
output.base_path = output_folder

links = tree.links
links.new(rl.outputs['Speed'], output.inputs[0])
  • $\begingroup$ This works, but if vector pass output is the only thing needed, better to skip the nodes and use answer from J. Bakker. $\endgroup$ Mar 14, 2018 at 11:10

You must log in to answer this question.

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