I'm struggling on how to save all denoising data information like albedo or normal information when rendering an image using python api.

It should be something like:

bpy.ops.render.render(use_viewport = False, write_still=True, layer="Denoising Normal")

Can anyone help me?


A little late but maybe someone needs the solution: To render images and export also their denoising information, create a group of compositor nodes, link them and just render the image as usual.

Example of what worked for me:

def use_compositor_extra_information(noisy=True, albedo=False, normal=False, dir="D:/Renderings/"):

    bpy.context.scene.view_layers['View Layer'].cycles.denoising_store_passes = True
    bpy.context.scene.use_nodes = True

    tree = bpy.context.scene.node_tree
    # clear all nodes which were there before
    for node in tree.nodes:

    # create input node with all rendering layers
    render_layer_node = tree.nodes.new(type='CompositorNodeRLayers')
    composite_node = tree.nodes.new(type='CompositorNodeComposite')
    links = tree.links

    if noisy is True:
        # output of the noisy image
        noisy_image_node = tree.nodes.new(type='CompositorNodeOutputFile')
        noisy_image_node.base_path = os.path.normpath(dir)

        link_noisy = links.new(render_layer_node.outputs['Image'], noisy_image_node.inputs[0])

    if normal is True:
        # output of the normal image
        normal_image_node = tree.nodes.new(type='CompositorNodeOutputFile')
        normal_image_node.base_path = os.path.join(dir ,"normal")
        link_normal = links.new(render_layer_node.outputs['Denoising Normal'], normal_image_node.inputs[0])

    if albedo is True:
        # output of the albedo image
        albedo_image_node = tree.nodes.new(type='CompositorNodeOutputFile')
        albedo_image_node.base_path = os.path.join(dir , "albedo")
        link_albedo = links.new(render_layer_node.outputs['Denoising Albedo'], albedo_image_node.inputs[0])

When now rendering an image with:

bpy.ops.render.render(animation=False, write_still=True)

The noisy and albedo images should be now in the given path.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.