Page 1 of 1
console denoise save file
Posted: Fri Jun 01, 2018 1:15 am
by zukazuka
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?
Re: console denoise save file
Posted: Fri Jun 01, 2018 7:37 am
by B.Y.O.B.
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
Re: console denoise save file
Posted: Sun Jun 03, 2018 3:38 am
by zukazuka
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])