For Blender 2.81 and Cycles render.

I want to access all of the following data passes from a Python script:

  • Z
  • Normal
  • Vector
  • Object Index

enter image description here

Therefore, I created three Viewer Nodes with different names. See the following image:

enter image description here

The viewer node on the top is getting both the Z and the Normal passes. The one in the middle is getting the Vector, and the one in the bottom the IndexOB.

Now my issue is that when I use the following code pixels = bpy.data.images['Viewer Node'].pixels, I can only access the data from the top Viewer Node (we only get the pixel data of the node that was selected from the user interface).

Is there a way that I can specify through the NameId of the Viewer Node which pixels data do I want to access?

I tried selecting and activating the different nodes through a script but apparently the data does not get automatically updated. The viewer node has to be manually clicked to make it visually active which then updates the images['Viewer Node'] data that we want to access. I found more info about this "known limitation" here.

  • $\begingroup$ similar question: blender.stackexchange.com/questions/32640/… $\endgroup$ – João Cartucho Jan 20 at 21:55
  • $\begingroup$ Can you try to use one Viewer with Switch nodes or connect sockets via python for every case? $\endgroup$ – Serge L Jan 24 at 15:41
  • $\begingroup$ Tried switch nodes and the issue is the same. To connect via python for every case I would need to render multiple times. I want to render only once. $\endgroup$ – João Cartucho Jan 24 at 15:55
  • $\begingroup$ How exactly would you want to post the data? $\endgroup$ – Nate_Sycro27 Jan 24 at 18:58
  • 1
    $\begingroup$ Is there any reason why you can't use the File Output nodes? $\endgroup$ – WhatAMesh Jan 29 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.