I save my rendering results as 16-bit png
files using Python asd as follow:
scene = bpy.context.scene
scene.render.image_settings.color_depth = '16'
scene.display_settings.display_device = 'sRGB'
scene.view_settings.view_transform = 'Raw'
scene.sequencer_colorspace_settings.name = 'Raw'
scene.use_nodes = True
for node in scene.node_tree.nodes:
scene.node_tree.nodes.remove(node)
renderNode = scene.node_tree.nodes.new('CompositorNodeRLayers')
depthOutputNode = scene.node_tree.nodes.new('CompositorNodeOutputFile')
depthOutputNode.format.file_format = 'PNG'
depthOutputNode.format.color_depth = '16'
depthOutputNode.format.color_mode = 'RGB'
depthOutputNode.base_path = 'somePath/'
depthOutputNode.file_slots[0].path = 'fileNameDepth#'
scene.node_tree.links.new(renderNode.outputs[2], depthOutputNode.inputs[0])
bpy.ops.render.render(write_still=True)
However, it seems that Blender stores/exports the rendering in a different format than I expected. I loaded the images in Python after rendering and I found out that the maximum value for all pixels is not more than 255 (8-bits). Does anyone know why this is the case? I wonder, would storing the depth maps in OpenEXR format resolve the issue?