console denoise save file

Use this forum for general user support and related questions.
Post Reply
zukazuka
Posts: 6
Joined: Sat Apr 14, 2018 2:46 pm

console denoise save file

Post by zukazuka » Fri Jun 01, 2018 1:15 am

When rendering from console ("batch render script") I select denoise on:

Code: Select all

bpy.context.scene.luxcore.denoiser.enabled=True
The render is denoised but the result is saved as a separate pass "DENOISED" pass - it seems when I save image via:

Code: Select all

bpy.data.images['Render Result'].save_render("out.png")
It only saves the "Combined" pass but not the Denoised image.

I haven't tried to figure out how to combine the passes via python - I thought I would ask first to see what your suggestion is to save the "DENOISED" pass when rendering from a command line batch render script?

User avatar
B.Y.O.B.
Developer
Posts: 1111
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: console denoise save file

Post by B.Y.O.B. » Fri Jun 01, 2018 7:37 am

You can save as multilayer EXR, this contains all the passes.
However it can only be opened by very few programs (one of them Blender).

Another option is to create a small compositing node setup where you pipe the outputs that should be saved into a file output node:
https://docs.blender.org/manual/en/dev/ ... /file.html
Attachments
scrn_2018-06-01_09-37-00.png
Support LuxCoreRender project with salts and bounties

zukazuka
Posts: 6
Joined: Sat Apr 14, 2018 2:46 pm

Re: console denoise save file

Post by zukazuka » Sun Jun 03, 2018 3:38 am

Here's what I wrote so far (seems to be working).

This script will save the denoised result automatically so if you are rendering on a server or batch processing - you can save the denoised version automatically:

Code: Select all

import bpy

scene = bpy.context.scene

# make sure we have node tree
if scene.node_tree==None:
    scene.use_nodes=True

#if denoiser not enabled = no denoiser node output, so make sure it's enabled    
scene.luxcore.denoiser.enabled=True

if scene.node_tree:
    nodes = scene.node_tree.nodes
    auto_denoise_output_label="auto_denoise_save"

    # remove previously auto created denoise nodes to prevent duplicates
    for node in nodes:
        if node.label==auto_denoise_output_label:
            nodes.remove(node)

    render_layers = nodes.new("CompositorNodeRLayers")
    render_layers.location=(0,0)
    render_layers.label=auto_denoise_output_label

    output_file = nodes.new("CompositorNodeOutputFile")
    output_file.location=(200,0)
    output_file.inputs[0].name="filename"
    output_file.base_path = "/home/me/blender_output_path/"
    output_file.file_slots[0].path="filename"
    output_file.label=auto_denoise_output_label

    scene.node_tree.links.new(render_layers.outputs['DENOISED'],output_file.inputs[0])

Post Reply