Commit: 212906daa59286d43353689b5a9f8fabf079c999
Author: Stefan Werner
Date:   Mon May 29 15:29:55 2017 +0200
Branches: temp_cryptomatte
https://developer.blender.org/rB212906daa59286d43353689b5a9f8fabf079c999

Merge branch 'master' of git.blender.org:blender into temp-cryptomatte

# Conflicts:
#       intern/cycles/blender/addon/properties.py
#       intern/cycles/blender/blender_session.cpp
#       intern/cycles/blender/blender_sync.cpp
#       intern/cycles/kernel/kernel_passes.h
#       intern/cycles/kernel/kernel_path.h
#       intern/cycles/kernel/kernel_path_branched.h
#       intern/cycles/kernel/kernel_types.h
#       intern/cycles/render/buffers.cpp
#       intern/cycles/render/buffers.h
#       intern/cycles/render/film.cpp
#       intern/cycles/render/film.h
#       source/blender/editors/space_node/drawnode.c

===================================================================



===================================================================

diff --cc intern/cycles/blender/addon/properties.py
index a637fac6ff8,8bb25aba13c..afd773d18f9
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@@ -1171,12 -1166,12 +1171,18 @@@ class CyclesCurveRenderSettings(bpy.typ
      def unregister(cls):
          del bpy.types.Scene.cycles_curves
  
 +class CyclesAOVSettings(bpy.types.PropertyGroup):
 +    @classmethod
 +    def register(cls):
 +        cls.name = StringProperty(name="Name")
 +        cls.type = EnumProperty(name="Type", items=enum_aov_types, 
default='COLOR')
 +
+ def update_render_passes(self, context):
+     scene = context.scene
+     rd = scene.render
+     rl = rd.layers.active
+     rl.update_render_passes()
+ 
  class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
      @classmethod
      def register(cls):
@@@ -1204,24 -1202,84 +1213,103 @@@
                  name="Debug Ray Bounces",
                  description="Store Debug Ray Bounces pass",
                  default=False,
+                 update=update_render_passes,
+                 )
+ 
+         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=25,
+                 default=8,
+         )
+         cls.denoising_relative_pca = BoolProperty(
+                 name="Relative filter",
+                 description="When removing pixels 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,
+         )
+         cls.denoising_store_passes = BoolProperty(
+                 name="Store denoising passes",
+                 description="Store the denoising feature passes and the noisy 
image",
+                 default=False,
+                 update=update_render_passes,
+         )
 -
 +        cls.aovs = bpy.props.CollectionProperty(type=CyclesAOVSettings)
 +        cls.active_aov = IntProperty(default=0)
 +        cls.use_pass_crypto_object = BoolProperty(
 +                name="CryptoMatte Object",
 +                description="CryptoMatte Object pass",
 +                default=False,
++                update=update_render_passes,
 +                )
 +        cls.use_pass_crypto_material = BoolProperty(
 +                name="CryptoMatte Material",
 +                description="CryptoMatte Material pass",
 +                default=False,
++                update=update_render_passes,
 +                )
 +        cls.pass_crypto_depth = IntProperty(
 +                name="CryptoMatte Depth",
 +                description="CryptoMatte Depth",
 +                default=4, min=2, max=16, step=2,
++                update=update_render_passes,
 +                )
      @classmethod
      def unregister(cls):
          del bpy.types.SceneRenderLayer.cycles
diff --cc intern/cycles/blender/blender_session.cpp
index 3a847022350,c6a59577507..9d142578fe8
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@@ -397,9 -398,42 +398,19 @@@ void BlenderSession::render(
  
                BL::RenderLayer b_rlay = *b_single_rlay;
  
 -              /* add passes */
 -              array<Pass> passes;
 -              if(session_params.device.advanced_shading) {
 -                      passes = sync->sync_render_passes(b_rlay, 
*b_layer_iter);
 -              }
 -              else {
 -                      Pass::add(PASS_COMBINED, passes);
 -              }
 +              sync->sync_film(b_rlay, *b_layer_iter, 
session_params.device.advanced_shading);
  
 -              buffer_params.passes = passes;
 +              buffer_params.passes = scene->film->passes;
+ 
+               PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
+               bool use_denoising = !session_params.progressive_refine && 
get_boolean(crl, "use_denoising");
 -              buffer_params.denoising_data_pass = use_denoising;
+               session->tile_manager.schedule_denoising = use_denoising;
+               session->params.use_denoising = use_denoising;
 -              scene->film->denoising_data_pass = 
buffer_params.denoising_data_pass;
 -              scene->film->denoising_flags = 0;
 -              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 = get_int(crl, 
"denoising_radius");
+               session->params.denoising_strength = get_float(crl, 
"denoising_strength");
+               session->params.denoising_feature_strength = get_float(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);
 -              scene->film->tag_update(scene);
                scene->integrator->tag_update(scene);
  
                int view_index = 0;
@@@ -542,12 -574,9 +551,9 @@@ void BlenderSession::bake(BL::Object& b
        /* ensure kernels are loaded before we do any scene updates */
        session->load_kernels();
  
-       if(session->progress.get_cancel())
-               return;
- 
        if(shader_type == SHADER_EVAL_UV) {
                /* force UV to be available */
 -              Pass::add(PASS_UV, scene->film->passes);
 +              scene->film->passes.add(PASS_UV);
        }
  
        int bake_pass_filter = bake_pass_filter_get(pass_filter);
@@@ -656,8 -696,11 +673,13 @@@ void BlenderSession::do_write_update_re
                                /* copy pixels */
                                read = buffers->get_pass_rect(pass_type, 
exposure, sample, components, &pixels[0]);
                        }
-                       else if (b_pass.name().substr(0, 4) == "AOV ") {
 -                      else {
++                      else if(b_pass.name().substr(0, 4) == "AOV ") {
 +                              read = 
buffers->get_aov_rect(ustring(b_pass.name().substr(4)), exposure, sample, 
components, &pixels[0]);
++                      } else {
+                               int denoising_offset = 
BlenderSync::get_denoising_pass(b_pass);
+                               if(denoising_offset >= 0) {
+                                       read = 
buffers->get_denoising_pass_rect(denoising_offset, exposure, sample, 
components, &pixels[0]);
+                               }
                        }
  
                        if(!read) {
diff --cc intern/cycles/blender/blender_sync.cpp
index 5fcdab8e5fc,41723599874..47c87a3b76f
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@@ -525,86 -528,82 +528,139 @@@ PassType BlenderSync::get_pass_type(BL:
        return PASS_NONE;
  }
  
+ int BlenderSync::get_denoising_pass(BL::RenderPass& b_pass)
+ {
+       string name = b_pass.name();
+       if(name.substr(0, 10) != "Denoising ") {
+               return -1;
+       }
+       name = name.substr(10);
+ 
+ #define MAP_PASS(passname, offset) if(name == passname) ret

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to