Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2017-05-04 00:30:58 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2017-05-04 15:19:50 +0300
commit954f201b3e1eab7bda71d318f895e81911c8189b (patch)
treea346f70489511a6043491094fd8a348c2cf075b2
parenta89a260634149aba9458043a98170be216f3657e (diff)
Cycles Denoising: Move denoising properties to the Cycles addon and improve the UI
-rw-r--r--intern/cycles/blender/addon/properties.py69
-rw-r--r--intern/cycles/blender/addon/ui.py52
-rw-r--r--intern/cycles/blender/blender_session.cpp32
-rw-r--r--source/blender/blenkernel/intern/scene.c3
-rw-r--r--source/blender/blenloader/intern/versioning_270.c16
-rw-r--r--source/blender/makesdna/DNA_scene_types.h18
-rw-r--r--source/blender/makesrna/intern/rna_scene.c70
7 files changed, 122 insertions, 138 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index a8a0f0bfc70..6f912fe3fb0 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1195,6 +1195,75 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
)
+ cls.use_denoising = BoolProperty(
+ name="Use Denoising",
+ description="Denoise the rendered image",
+ default=False,
+ )
+ cls.denoising_diffuse_direct = BoolProperty(
+ name="Diffuse Direct",
+ description="Denoise the direct diffuse lighting",
+ default=True,
+ )
+ cls.denoising_diffuse_indirect = BoolProperty(
+ name="Diffuse Indirect",
+ description="Denoise the indirect diffuse lighting",
+ default=True,
+ )
+ cls.denoising_glossy_direct = BoolProperty(
+ name="Glossy Direct",
+ description="Denoise the direct glossy lighting",
+ default=True,
+ )
+ cls.denoising_glossy_indirect = BoolProperty(
+ name="Glossy Indirect",
+ description="Denoise the indirect glossy lighting",
+ default=True,
+ )
+ cls.denoising_transmission_direct = BoolProperty(
+ name="Transmission Direct",
+ description="Denoise the direct transmission lighting",
+ default=True,
+ )
+ cls.denoising_transmission_indirect = BoolProperty(
+ name="Transmission Indirect",
+ description="Denoise the indirect transmission lighting",
+ default=True,
+ )
+ cls.denoising_subsurface_direct = BoolProperty(
+ name="Subsurface Direct",
+ description="Denoise the direct subsurface lighting",
+ default=True,
+ )
+ cls.denoising_subsurface_indirect = BoolProperty(
+ name="Subsurface Indirect",
+ description="Denoise the indirect subsurface lighting",
+ default=True,
+ )
+ cls.denoising_strength = FloatProperty(
+ name="Denoising Strength",
+ description="Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)",
+ min=0.0, max=1.0,
+ default=0.5,
+ )
+ cls.denoising_feature_strength = FloatProperty(
+ name="Denoising Feature Strength",
+ description="Controls removal of noisy image feature passes (lower values preserve more detail, but aren't as smooth)",
+ min=0.0, max=1.0,
+ default=0.5,
+ )
+ cls.denoising_radius = IntProperty(
+ name="Denoising Radius",
+ description="Size of the image area that's used to denoise a pixel (higher values are smoother, but might lose detail and are slower)",
+ min=1, max=50,
+ default=8,
+ )
+ cls.denoising_relative_pca = BoolProperty(
+ name="Relative filter",
+ description="When removing that don't carry information, use a relative threshold instead of an absolute one (can help to reduce artifacts, but might cause detail loss around edges)",
+ default=False,
+ )
+
@classmethod
def unregister(cls):
del bpy.types.SceneRenderLayer.cycles
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index c1c042bdef7..6e2a0b9c208 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -589,7 +589,8 @@ class CyclesRender_PT_denoising(CyclesButtonsPanel, Panel):
def draw_header(self, context):
rd = context.scene.render
rl = rd.layers.active
- self.layout.prop(rl, "use_denoising", text="")
+ crl = rl.cycles
+ self.layout.prop(crl, "use_denoising", text="")
def draw(self, context):
layout = self.layout
@@ -597,26 +598,45 @@ class CyclesRender_PT_denoising(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
rl = rd.layers.active
+ crl = rl.cycles
- col = layout.column()
+ split = layout.split()
+ col = split.column()
sub = col.column(align=True)
- sub.prop(rl, "denoising_radius")
- sub.prop(rl, "denoising_strength", slider=True)
- sub.prop(rl, "denoising_feature_strength", slider=True)
- sub.prop(rl, "denoising_relative_pca")
+ sub.prop(crl, "denoising_radius", text="Radius")
+ sub.prop(crl, "denoising_strength", slider=True, text="Strength")
+ col = split.column()
sub = col.column(align=True)
- row = sub.row(align=True)
- row.prop(rl, "denoising_diffuse_direct", toggle=True)
- row.prop(rl, "denoising_glossy_direct", toggle=True)
- row.prop(rl, "denoising_transmission_direct", toggle=True)
- row.prop(rl, "denoising_subsurface_direct", toggle=True)
- row = sub.row(align=True)
- row.prop(rl, "denoising_diffuse_indirect", toggle=True)
- row.prop(rl, "denoising_glossy_indirect", toggle=True)
- row.prop(rl, "denoising_transmission_indirect", toggle=True)
- row.prop(rl, "denoising_subsurface_indirect", toggle=True)
+ sub.prop(crl, "denoising_feature_strength", slider=True, text="Feature Strength")
+ sub.prop(crl, "denoising_relative_pca")
+
+ layout.separator()
+
+ row = layout.row()
+ row.label(text="Diffuse:")
+ sub = row.row(align=True)
+ sub.prop(crl, "denoising_diffuse_direct", text="Direct", toggle=True)
+ sub.prop(crl, "denoising_diffuse_indirect", text="Indirect", toggle=True)
+
+ row = layout.row()
+ row.label(text="Glossy:")
+ sub = row.row(align=True)
+ sub.prop(crl, "denoising_glossy_direct", text="Direct", toggle=True)
+ sub.prop(crl, "denoising_glossy_indirect", text="Indirect", toggle=True)
+
+ row = layout.row()
+ row.label(text="Transmission:")
+ sub = row.row(align=True)
+ sub.prop(crl, "denoising_transmission_direct", text="Direct", toggle=True)
+ sub.prop(crl, "denoising_transmission_indirect", text="Indirect", toggle=True)
+
+ row = layout.row()
+ row.label(text="Subsurface:")
+ sub = row.row(align=True)
+ sub.prop(crl, "denoising_subsurface_direct", text="Direct", toggle=True)
+ sub.prop(crl, "denoising_subsurface_indirect", text="Indirect", toggle=True)
class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index e3e248d4010..aebbc9e3fff 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -408,25 +408,27 @@ void BlenderSession::render()
}
buffer_params.passes = passes;
- buffer_params.denoising_data_pass = b_layer_iter->use_denoising();
- session->tile_manager.schedule_denoising = b_layer_iter->use_denoising();
- session->params.use_denoising = b_layer_iter->use_denoising();
+
+ PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
+ buffer_params.denoising_data_pass = get_boolean(crl, "use_denoising");
+ session->tile_manager.schedule_denoising = get_boolean(crl, "use_denoising");
+ session->params.use_denoising = get_boolean(crl, "use_denoising");
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
scene->film->denoising_flags = 0;
- if(!b_layer_iter->denoising_diffuse_direct()) scene->film->denoising_flags |= DENOISING_CLEAN_DIFFUSE_DIR;
- if(!b_layer_iter->denoising_diffuse_indirect()) scene->film->denoising_flags |= DENOISING_CLEAN_DIFFUSE_IND;
- if(!b_layer_iter->denoising_glossy_direct()) scene->film->denoising_flags |= DENOISING_CLEAN_GLOSSY_DIR;
- if(!b_layer_iter->denoising_glossy_indirect()) scene->film->denoising_flags |= DENOISING_CLEAN_GLOSSY_IND;
- if(!b_layer_iter->denoising_transmission_direct()) scene->film->denoising_flags |= DENOISING_CLEAN_TRANSMISSION_DIR;
- if(!b_layer_iter->denoising_transmission_indirect()) scene->film->denoising_flags |= DENOISING_CLEAN_TRANSMISSION_IND;
- if(!b_layer_iter->denoising_subsurface_direct()) scene->film->denoising_flags |= DENOISING_CLEAN_SUBSURFACE_DIR;
- if(!b_layer_iter->denoising_subsurface_indirect()) scene->film->denoising_flags |= DENOISING_CLEAN_SUBSURFACE_IND;
+ if(!get_boolean(crl, "denoising_diffuse_direct")) scene->film->denoising_flags |= DENOISING_CLEAN_DIFFUSE_DIR;
+ if(!get_boolean(crl, "denoising_diffuse_indirect")) scene->film->denoising_flags |= DENOISING_CLEAN_DIFFUSE_IND;
+ if(!get_boolean(crl, "denoising_glossy_direct")) scene->film->denoising_flags |= DENOISING_CLEAN_GLOSSY_DIR;
+ if(!get_boolean(crl, "denoising_glossy_indirect")) scene->film->denoising_flags |= DENOISING_CLEAN_GLOSSY_IND;
+ if(!get_boolean(crl, "denoising_transmission_direct")) scene->film->denoising_flags |= DENOISING_CLEAN_TRANSMISSION_DIR;
+ if(!get_boolean(crl, "denoising_transmission_indirect")) scene->film->denoising_flags |= DENOISING_CLEAN_TRANSMISSION_IND;
+ if(!get_boolean(crl, "denoising_subsurface_direct")) scene->film->denoising_flags |= DENOISING_CLEAN_SUBSURFACE_DIR;
+ if(!get_boolean(crl, "denoising_subsurface_indirect")) scene->film->denoising_flags |= DENOISING_CLEAN_SUBSURFACE_IND;
scene->film->denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
buffer_params.denoising_clean_pass = scene->film->denoising_clean_pass;
- session->params.denoising_radius = b_layer_iter->denoising_radius();
- session->params.denoising_strength = b_layer_iter->denoising_strength();
- session->params.denoising_feature_strength = b_layer_iter->denoising_feature_strength();
- session->params.denoising_relative_pca = b_layer_iter->denoising_relative_pca();
+ session->params.denoising_radius = get_boolean(crl, "denoising_radius");
+ session->params.denoising_strength = get_boolean(crl, "denoising_strength");
+ session->params.denoising_feature_strength = get_boolean(crl, "denoising_feature_strength");
+ session->params.denoising_relative_pca = get_boolean(crl, "denoising_relative_pca");
scene->film->pass_alpha_threshold = b_layer_iter->pass_alpha_threshold();
scene->film->tag_passes_update(scene, passes);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index a3f9911eb9d..559531a3d8a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2041,9 +2041,6 @@ SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name)
srl->layflag = 0x7FFF; /* solid ztra halo edge strand */
srl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z;
srl->pass_alpha_threshold = 0.5f;
- srl->denoising_flag = SCE_DENOISING_PASS_DIFFDIR|SCE_DENOISING_PASS_GLOSSDIR|SCE_DENOISING_PASS_TRANSDIR|SCE_DENOISING_PASS_SUBDIR|
- SCE_DENOISING_PASS_DIFFIND|SCE_DENOISING_PASS_GLOSSIND|SCE_DENOISING_PASS_TRANSIND|SCE_DENOISING_PASS_SUBIND;
- srl->denoising_radius = 8;
BKE_freestyle_config_init(&srl->freestyleConfig);
return srl;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 3f53f1878b7..c187766b586 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1406,22 +1406,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
/* ------- end of grease pencil initialization --------------- */
}
- {
- if (!DNA_struct_elem_find(fd->filesdna, "SceneRenderLayer", "int", "denoising_flag")) {
- Scene *sce;
-
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- SceneRenderLayer *rl;
- for (rl = sce->r.layers.first; rl; rl = rl->next) {
- rl->denoising_flag = SCE_DENOISING_PASS_DIFFDIR|SCE_DENOISING_PASS_GLOSSDIR|SCE_DENOISING_PASS_TRANSDIR|SCE_DENOISING_PASS_SUBDIR|
- SCE_DENOISING_PASS_DIFFIND|SCE_DENOISING_PASS_GLOSSIND|SCE_DENOISING_PASS_TRANSIND|SCE_DENOISING_PASS_SUBIND;
- rl->denoising_radius = 8;
- }
- }
- }
- }
-
-
if (!MAIN_VERSION_ATLEAST(main, 278, 0)) {
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
MovieClip *clip;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c1e8e8f520f..c2711c465e1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -227,11 +227,6 @@ typedef struct SceneRenderLayer {
int passflag; /* pass_xor has to be after passflag */
int pass_xor;
- int denoising_flag;
- int denoising_radius;
- float denoising_weighting;
- float denoising_feature_strength;
-
int samples;
float pass_alpha_threshold;
@@ -257,19 +252,6 @@ typedef struct SceneRenderLayer {
#define SCE_LAY_ZMASK 0x40000
#define SCE_LAY_NEG_ZMASK 0x80000
-typedef enum SceneDenoisingFlag {
- SCE_DENOISING_USE = (1 << 0),
- SCE_DENOISING_PASS_DIFFDIR = (1 << 2),
- SCE_DENOISING_PASS_DIFFIND = (1 << 3),
- SCE_DENOISING_PASS_GLOSSDIR = (1 << 4),
- SCE_DENOISING_PASS_GLOSSIND = (1 << 5),
- SCE_DENOISING_PASS_TRANSDIR = (1 << 6),
- SCE_DENOISING_PASS_TRANSIND = (1 << 7),
- SCE_DENOISING_PASS_SUBDIR = (1 << 8),
- SCE_DENOISING_PASS_SUBIND = (1 << 9),
- SCE_DENOISING_RELATIVE_PCA = (1 << 13),
-} SceneDenoisingFlag;
-
/* srl->passflag */
typedef enum ScenePassType {
SCE_PASS_COMBINED = (1 << 0),
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index aadadcf8986..dd30cb0d03f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -5114,76 +5114,6 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig");
RNA_def_property_struct_type(prop, "FreestyleSettings");
RNA_def_property_ui_text(prop, "Freestyle Settings", "");
-
- /* Cycles denoising */
- prop = RNA_def_property(srna, "use_denoising", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_USE);
- RNA_def_property_ui_text(prop, "Denoise Render Result", "Denoise the rendered image during rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_DIFFDIR);
- RNA_def_property_ui_text(prop, "Diffuse Direct", "Denoise the direct diffuse lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_DIFFIND);
- RNA_def_property_ui_text(prop, "Diffuse Indirect", "Denoise the indirect diffuse lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_glossy_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_GLOSSDIR);
- RNA_def_property_ui_text(prop, "Glossy Direct", "Denoise the direct glossy lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_GLOSSIND);
- RNA_def_property_ui_text(prop, "Glossy Indirect", "Denoise the indirect glossy lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_transmission_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_TRANSDIR);
- RNA_def_property_ui_text(prop, "Transmission Direct", "Denoise the direct transmission lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_TRANSIND);
- RNA_def_property_ui_text(prop, "Transmission Indirect", "Denoise the indirect transmission lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_SUBDIR);
- RNA_def_property_ui_text(prop, "Subsurface Direct", "Denoise the direct subsurface lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_PASS_SUBIND);
- RNA_def_property_ui_text(prop, "Subsurface Indirect", "Denoise the indirect subsurface lighting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "denoising_weighting");
- RNA_def_property_range(prop, -4.0f, 4.0f);
- RNA_def_property_ui_text(prop, "Denoising Strength Adjust", "Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_feature_strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "denoising_feature_strength");
- RNA_def_property_range(prop, -4.0f, 4.0f);
- RNA_def_property_ui_text(prop, "Denoising Feature Strength Adjust", "Controls removal of noisy image feature passes (lower values preserve more detail, but aren't as smooth)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_radius", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "denoising_radius");
- RNA_def_property_range(prop, 1, 50);
- RNA_def_property_ui_text(prop, "Denoising Radius", "Size of the image area that's used to denoise a pixel. Higher values get rid of more noise, but might lose detail and are slower");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "denoising_relative_pca", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "denoising_flag", SCE_DENOISING_RELATIVE_PCA);
- RNA_def_property_ui_text(prop, "Relative filter",
- "When removing features that don't carry information, use a relative threshold instead of an absolute one. Can help to reduce artifacts, but might cause detail loss around edges");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
/* Render Layers */