I am trying to render depth maps and surface Normals using Cycles and store the results in OpenEXR format using nodes. I make a Blender class and set up the nodes as follow using Blender's Python API:

import importlib

class Blender(object):
    def __init__(self):
        self.bpy = importlib.import_module("bpy")
        self.scene = self.bpy.context.scene
        self.scene.render.use_sequencer = False
        self.scene.display_settings.display_device = 'sRGB'
        self.scene.view_settings.view_transform = 'Raw'
        self.scene.sequencer_colorspace_settings.name = 'Raw'
        self.scene.render.engine = 'CYCLES'
        self.scene.use_nodes = True

    def setupRenderNodes(self):

        for node in self.scene.node_tree.nodes:
        renderNode = self.scene.node_tree.nodes.new('CompositorNodeRLayers')

        # Depth map
        self.depthOutputNode = self.scene.node_tree.nodes.new('CompositorNodeOutputFile')
        self.depthOutputNode.format.file_format = 'OPEN_EXR'
        self.depthOutputNode.format.color_depth = '32'
        self.depthOutputNode.format.color_mode = 'RGB'
        self.depthOutputNode.format.exr_codec = 'ZIP'
        self.depthOutputNode.base_path = 'somePath/'
        self.depthOutputNode.file_slots[0].path = 'fileNameDepth#'

        # Link
        self.scene.node_tree.links.new(renderNode.outputs[2], self.depthOutputNode.inputs[0])

    def render(self, objPath):

Then I call the rendering function as follow:

from multiprocessing import Process
import blenderClass import Blender
blender = Blender()

objPaths = ['obj1.obj', 'obj2.obj', 'obj3.obj', 'obj4.obj']

procList = []
for path in objPaths:
    proc = Process(target=blender.render, kwargs={'objPath': path})

for job in procList:

The problem is when I'm trying to store the renderings in EXR format and use multiprocessing package to call bpy.ops.render.render(write_still=True) Blender freezes and the results are not saved on disk. However, if I change OPEN_EXR to PNG and change the color_depth to '16' everything works and I get the rendering results on disk. Also, if I call blender.render() without using multiprocessing everything works as expected. Note that I do not change any of my rendering engine settings like tile size, resolution etc. Does anyone know why Blender freezes and the renderings are not on disk when trying to store them as EXR and use the multiprocessing package?

I'm not sure if this has something to do with the problem that I'm facing but I have compiled Blender manually and import it as a module in the Python installed on my machine. Here are the CMake settings I used to compile Blender with versions 2.78, 2.79 and 2.79b from source. They all have the same issue:

cmake blender \
    -DCMAKE_INSTALL_PREFIX=/usr/lib/python3/dist-packages \
    -DPYTHON_SITE_PACKAGES=/usr/lib/python3/dist-packages \
  • 3
    $\begingroup$ Best report this as a bug. as blender 2.79b cannot save multi layer openexr files using the file output node even when just do it manually. To my knowledge it should be able to do this. A normal save of the multilayer open exr file during render does work. $\endgroup$ – J. Bakker Mar 29 '18 at 6:21
  • $\begingroup$ @J.Bakker Thank you. Here's the link to the bug report. $\endgroup$ – Amir Mar 29 '18 at 13:59
  • $\begingroup$ @J.Bakker I forgot to mention that the same thing happens when I want to only save depth maps in OPEN_EXR format as well. Did you also experience the same issue? Another question: Is it common for Blender developers not to respond to the reported bugs? How long usually does it take for them to take care of the bug? $\endgroup$ – Amir Mar 30 '18 at 22:08
  • 1
    $\begingroup$ Have you tested this manually on your local gui? renderNode.outputs[3] is the render layers normal output, this socket is not visible by default, the output node will not get input from it if it is not visible, therefore no file save. That would mean ensuring the render layers normal option gets enabled. $\endgroup$ – sambler Mar 31 '18 at 5:10
  • 2
    $\begingroup$ No worries and be patient. Currently there are the banking holidays. Also devs need some R&R. Next week BI is moving to another location and the code quest will start. So there are events that might influence respond times. $\endgroup$ – J. Bakker Mar 31 '18 at 8:03