Cycles: Support generating Denoising passes without actually denoising
Needed for the animation denoiser since the denoising filter is done separately there. Reviewers: brecht, sergey Reviewed By: brecht Differential Revision: https://developer.blender.org/D3833
This commit is contained in:
@@ -265,7 +265,7 @@ def register_passes(engine, scene, srl):
|
|||||||
for i in range(0, srl.cycles.pass_crypto_depth, 2):
|
for i in range(0, srl.cycles.pass_crypto_depth, 2):
|
||||||
engine.register_pass(scene, srl, "CryptoAsset" + '{:02d}'.format(i), 4, "RGBA", 'COLOR')
|
engine.register_pass(scene, srl, "CryptoAsset" + '{:02d}'.format(i), 4, "RGBA", 'COLOR')
|
||||||
|
|
||||||
if crl.use_denoising:
|
if crl.use_denoising or crl.denoising_store_passes:
|
||||||
engine.register_pass(scene, srl, "Noisy Image", 3, "RGBA", 'COLOR')
|
engine.register_pass(scene, srl, "Noisy Image", 3, "RGBA", 'COLOR')
|
||||||
if crl.denoising_store_passes:
|
if crl.denoising_store_passes:
|
||||||
engine.register_pass(scene, srl, "Denoising Normal", 3, "XYZ", 'VECTOR')
|
engine.register_pass(scene, srl, "Denoising Normal", 3, "XYZ", 'VECTOR')
|
||||||
|
@@ -517,6 +517,8 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
|
|||||||
col.prop(rl, "use_pass_shadow")
|
col.prop(rl, "use_pass_shadow")
|
||||||
col.prop(rl, "use_pass_ambient_occlusion")
|
col.prop(rl, "use_pass_ambient_occlusion")
|
||||||
col.separator()
|
col.separator()
|
||||||
|
col.prop(crl, "denoising_store_passes", text="Denoising Data")
|
||||||
|
col.separator()
|
||||||
col.prop(rl, "pass_alpha_threshold")
|
col.prop(rl, "pass_alpha_threshold")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
@@ -549,12 +551,6 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
|
|||||||
col.prop(rl, "use_pass_emit", text="Emission")
|
col.prop(rl, "use_pass_emit", text="Emission")
|
||||||
col.prop(rl, "use_pass_environment")
|
col.prop(rl, "use_pass_environment")
|
||||||
|
|
||||||
if context.scene.cycles.feature_set == 'EXPERIMENTAL':
|
|
||||||
col.separator()
|
|
||||||
sub = col.column()
|
|
||||||
sub.active = crl.use_denoising
|
|
||||||
sub.prop(crl, "denoising_store_passes", text="Denoising")
|
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.prop(crl, "pass_debug_render_time")
|
col.prop(crl, "pass_debug_render_time")
|
||||||
if _cycles.with_cycles_debug:
|
if _cycles.with_cycles_debug:
|
||||||
@@ -641,9 +637,8 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
|
|||||||
rl = rd.layers.active
|
rl = rd.layers.active
|
||||||
crl = rl.cycles
|
crl = rl.cycles
|
||||||
|
|
||||||
layout.active = crl.use_denoising
|
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
split.active = crl.use_denoising
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
sub = col.column(align=True)
|
sub = col.column(align=True)
|
||||||
@@ -658,24 +653,28 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
row.active = crl.use_denoising or crl.denoising_store_passes
|
||||||
row.label(text="Diffuse:")
|
row.label(text="Diffuse:")
|
||||||
sub = row.row(align=True)
|
sub = row.row(align=True)
|
||||||
sub.prop(crl, "denoising_diffuse_direct", text="Direct", toggle=True)
|
sub.prop(crl, "denoising_diffuse_direct", text="Direct", toggle=True)
|
||||||
sub.prop(crl, "denoising_diffuse_indirect", text="Indirect", toggle=True)
|
sub.prop(crl, "denoising_diffuse_indirect", text="Indirect", toggle=True)
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
row.active = crl.use_denoising or crl.denoising_store_passes
|
||||||
row.label(text="Glossy:")
|
row.label(text="Glossy:")
|
||||||
sub = row.row(align=True)
|
sub = row.row(align=True)
|
||||||
sub.prop(crl, "denoising_glossy_direct", text="Direct", toggle=True)
|
sub.prop(crl, "denoising_glossy_direct", text="Direct", toggle=True)
|
||||||
sub.prop(crl, "denoising_glossy_indirect", text="Indirect", toggle=True)
|
sub.prop(crl, "denoising_glossy_indirect", text="Indirect", toggle=True)
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
row.active = crl.use_denoising or crl.denoising_store_passes
|
||||||
row.label(text="Transmission:")
|
row.label(text="Transmission:")
|
||||||
sub = row.row(align=True)
|
sub = row.row(align=True)
|
||||||
sub.prop(crl, "denoising_transmission_direct", text="Direct", toggle=True)
|
sub.prop(crl, "denoising_transmission_direct", text="Direct", toggle=True)
|
||||||
sub.prop(crl, "denoising_transmission_indirect", text="Indirect", toggle=True)
|
sub.prop(crl, "denoising_transmission_indirect", text="Indirect", toggle=True)
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
row.active = crl.use_denoising or crl.denoising_store_passes
|
||||||
row.label(text="Subsurface:")
|
row.label(text="Subsurface:")
|
||||||
sub = row.row(align=True)
|
sub = row.row(align=True)
|
||||||
sub.prop(crl, "denoising_subsurface_direct", text="Direct", toggle=True)
|
sub.prop(crl, "denoising_subsurface_direct", text="Direct", toggle=True)
|
||||||
|
@@ -410,12 +410,14 @@ void BlenderSession::render()
|
|||||||
|
|
||||||
PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
|
PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
|
||||||
bool use_denoising = get_boolean(crl, "use_denoising");
|
bool use_denoising = get_boolean(crl, "use_denoising");
|
||||||
|
bool denoising_passes = use_denoising || get_boolean(crl, "denoising_store_passes");
|
||||||
|
|
||||||
session->tile_manager.schedule_denoising = use_denoising;
|
session->tile_manager.schedule_denoising = use_denoising;
|
||||||
buffer_params.denoising_data_pass = use_denoising;
|
buffer_params.denoising_data_pass = denoising_passes;
|
||||||
buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
|
buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
|
||||||
|
|
||||||
session->params.use_denoising = use_denoising;
|
session->params.use_denoising = use_denoising;
|
||||||
|
session->params.denoising_passes = denoising_passes;
|
||||||
session->params.denoising_radius = get_int(crl, "denoising_radius");
|
session->params.denoising_radius = get_int(crl, "denoising_radius");
|
||||||
session->params.denoising_strength = get_float(crl, "denoising_strength");
|
session->params.denoising_strength = get_float(crl, "denoising_strength");
|
||||||
session->params.denoising_feature_strength = get_float(crl, "denoising_feature_strength");
|
session->params.denoising_feature_strength = get_float(crl, "denoising_feature_strength");
|
||||||
|
@@ -578,10 +578,11 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
|
|||||||
Pass::add(pass_type, passes);
|
Pass::add(pass_type, passes);
|
||||||
}
|
}
|
||||||
|
|
||||||
scene->film->denoising_flags = 0;
|
|
||||||
PointerRNA crp = RNA_pointer_get(&b_srlay.ptr, "cycles");
|
PointerRNA crp = RNA_pointer_get(&b_srlay.ptr, "cycles");
|
||||||
if(get_boolean(crp, "use_denoising"))
|
bool use_denoising = get_boolean(crp, "use_denoising");
|
||||||
{
|
bool store_denoising_passes = get_boolean(crp, "denoising_store_passes");
|
||||||
|
scene->film->denoising_flags = 0;
|
||||||
|
if(use_denoising || store_denoising_passes) {
|
||||||
#define MAP_OPTION(name, flag) if(!get_boolean(crp, name)) scene->film->denoising_flags |= flag;
|
#define MAP_OPTION(name, flag) if(!get_boolean(crp, name)) scene->film->denoising_flags |= flag;
|
||||||
MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
|
MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
|
||||||
MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
|
MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
|
||||||
@@ -592,9 +593,10 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
|
|||||||
MAP_OPTION("denoising_subsurface_direct", DENOISING_CLEAN_SUBSURFACE_DIR);
|
MAP_OPTION("denoising_subsurface_direct", DENOISING_CLEAN_SUBSURFACE_DIR);
|
||||||
MAP_OPTION("denoising_subsurface_indirect", DENOISING_CLEAN_SUBSURFACE_IND);
|
MAP_OPTION("denoising_subsurface_indirect", DENOISING_CLEAN_SUBSURFACE_IND);
|
||||||
#undef MAP_OPTION
|
#undef MAP_OPTION
|
||||||
|
|
||||||
b_engine.add_pass("Noisy Image", 4, "RGBA", b_srlay.name().c_str());
|
b_engine.add_pass("Noisy Image", 4, "RGBA", b_srlay.name().c_str());
|
||||||
if(get_boolean(crp, "denoising_store_passes")) {
|
}
|
||||||
|
|
||||||
|
if(store_denoising_passes) {
|
||||||
b_engine.add_pass("Denoising Normal", 3, "XYZ", b_srlay.name().c_str());
|
b_engine.add_pass("Denoising Normal", 3, "XYZ", b_srlay.name().c_str());
|
||||||
b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_srlay.name().c_str());
|
b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_srlay.name().c_str());
|
||||||
b_engine.add_pass("Denoising Albedo", 3, "RGB", b_srlay.name().c_str());
|
b_engine.add_pass("Denoising Albedo", 3, "RGB", b_srlay.name().c_str());
|
||||||
@@ -609,7 +611,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
|
|||||||
b_engine.add_pass("Denoising Clean", 3, "RGB", b_srlay.name().c_str());
|
b_engine.add_pass("Denoising Clean", 3, "RGB", b_srlay.name().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef __KERNEL_DEBUG__
|
#ifdef __KERNEL_DEBUG__
|
||||||
if(get_boolean(crp, "pass_debug_bvh_traversed_nodes")) {
|
if(get_boolean(crp, "pass_debug_bvh_traversed_nodes")) {
|
||||||
b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_srlay.name().c_str());
|
b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_srlay.name().c_str());
|
||||||
|
@@ -682,7 +682,7 @@ DeviceRequestedFeatures Session::get_requested_device_features()
|
|||||||
BakeManager *bake_manager = scene->bake_manager;
|
BakeManager *bake_manager = scene->bake_manager;
|
||||||
requested_features.use_baking = bake_manager->get_baking();
|
requested_features.use_baking = bake_manager->get_baking();
|
||||||
requested_features.use_integrator_branched = (scene->integrator->method == Integrator::BRANCHED_PATH);
|
requested_features.use_integrator_branched = (scene->integrator->method == Integrator::BRANCHED_PATH);
|
||||||
if(params.use_denoising) {
|
if(params.denoising_passes) {
|
||||||
requested_features.use_denoising = true;
|
requested_features.use_denoising = true;
|
||||||
requested_features.use_shadow_tricks = true;
|
requested_features.use_shadow_tricks = true;
|
||||||
}
|
}
|
||||||
|
@@ -58,6 +58,7 @@ public:
|
|||||||
bool display_buffer_linear;
|
bool display_buffer_linear;
|
||||||
|
|
||||||
bool use_denoising;
|
bool use_denoising;
|
||||||
|
bool denoising_passes;
|
||||||
int denoising_radius;
|
int denoising_radius;
|
||||||
float denoising_strength;
|
float denoising_strength;
|
||||||
float denoising_feature_strength;
|
float denoising_feature_strength;
|
||||||
@@ -89,6 +90,7 @@ public:
|
|||||||
threads = 0;
|
threads = 0;
|
||||||
|
|
||||||
use_denoising = false;
|
use_denoising = false;
|
||||||
|
denoising_passes = false;
|
||||||
denoising_radius = 8;
|
denoising_radius = 8;
|
||||||
denoising_strength = 0.0f;
|
denoising_strength = 0.0f;
|
||||||
denoising_feature_strength = 0.0f;
|
denoising_feature_strength = 0.0f;
|
||||||
|
Reference in New Issue
Block a user