How to resolve the Z pass when rendering with subframes? Currently I'm trying to render my scenes by making use of subframes to save on rendertimes through rendering on multiple nodes.

But when I do this I'm having problems combining the chuncks from the Z pass.
As you can see in the combined image below the Z pass does not show correctly.
It seems to reset the nearest and farest point of each individual subframe.

How should I go about fixing this? I'm all out of ideas.
 Any help would be greatly appreciated!

Combined Z pass chuncks:



Example of the python script I'm using:

cat &gt;subframe.py &lt;&lt;EOF
import bpy
bpy.context.scene.render.border_min_x = $SF_MIN_X
bpy.context.scene.render.border_max_x = $SF_MAX_X
bpy.context.scene.render.border_min_y = $SF_MIN_Y
bpy.context.scene.render.border_max_y = $SF_MAX_Y
bpy.context.scene.render.use_border = True

def add_subframe_to_fo_path(scene):
    scene.node_tree.nodes['File Output'].base_path = '$OUTDIR'
    for file_slot in scene.node_tree.nodes['File Output'].file_slots:
        file_slot.path=file_slot.path + '_X-' + str($SF_MIN_X) + '-' + str($SF_MAX_X) + '-Y-' + str($SF_MIN_Y) + '-' + str($SF_MAX_Y)

bpy.app.handlers.render_pre.append(add_subframe_to_fo_path)
EOF
blender -b *.blend -P subframe.py -F PNG -o $OUTDIR/frame_######_X-$SF_MIN_X-$SF_MAX_X-Y-$SF_MIN_Y-$SF_MAX_Y -s $START -e $END -j $STEP -t 0 -a


Node setup:



Hardware/software specifications:

Blender version nr:  2.78a
Render engine: Cycles
OS: Linux Ubuntu
Your Normalize Node is scaling the values so they range from minimum to maximum for each part individually. Leave it out and you should be fine. You could use a custom normalization scaling that is predefined and does not depend on the maximum and minimum of one subframe, or scale the Zpass of the whole image after merging.