Commit: 7dbca7064c5cf62adf935e61a58080b1dcadfffc
Author: Lukas Stockner
Date:   Sat Jun 4 21:29:28 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB7dbca7064c5cf62adf935e61a58080b1dcadfffc

Render: Add denoising passes to the Render code

These passes will eventually be hidden from the user, but for now they're really
useful for debugging.

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

M       source/blender/makesdna/DNA_scene_types.h
M       source/blender/render/intern/source/render_result.c

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

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index d7a949d..75423ca 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -267,6 +267,18 @@ typedef enum ScenePassType {
        SCE_PASS_DEBUG                    = (1 << 31),  /* This is a virtual 
pass. */
 } ScenePassType;
 
+typedef enum SceneExtendedPassType {
+       SCE_PASS_DENOISE_NORMAL           = (1UL << 32),
+       SCE_PASS_DENOISE_NORMAL_VAR       = (1UL << 33),
+       SCE_PASS_DENOISE_ALBEDO           = (1UL << 34),
+       SCE_PASS_DENOISE_ALBEDO_VAR       = (1UL << 35),
+       SCE_PASS_DENOISE_DEPTH            = (1UL << 36),
+       SCE_PASS_DENOISE_DEPTH_VAR        = (1UL << 37),
+       SCE_PASS_DENOISE_NOISY            = (1UL << 38), /* The original noisy 
image (only the components that are denoised). */
+       SCE_PASS_DENOISE_NOISY_VAR        = (1UL << 39),
+       SCE_PASS_DENOISE_CLEAN            = (1UL << 40), /* If present, these 
image components are added to the denoised image. */
+} SceneExtendedPassType;
+
 /* note, srl->passflag is treestore element 'nr' in outliner, short still... */
 
 /* View - MultiView */
diff --git a/source/blender/render/intern/source/render_result.c 
b/source/blender/render/intern/source/render_result.c
index ded6267..85aac40 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -356,6 +356,57 @@ static const char *name_from_passtype(uint64_t passtype, 
int channel)
                if (channel == 1) return "SubsurfaceCol.G";
                return "SubsurfaceCol.B";
        }
+       if (passtype == SCE_PASS_DENOISE_NORMAL) {
+               if (channel == -1) return "DenoiseNormal";
+               if (channel == 0) return "DenoiseNormal.X";
+               if (channel == 1) return "DenoiseNormal.Y";
+               return "DenoiseNormal.Z";
+       }
+       if (passtype == SCE_PASS_DENOISE_NORMAL_VAR) {
+               if (channel == -1) return "DenoiseNormalVar";
+               if (channel == 0) return "DenoiseNormalVar.X";
+               if (channel == 1) return "DenoiseNormalVar.Y";
+               return "DenoiseNormalVar.Z";
+       }
+       if (passtype == SCE_PASS_DENOISE_ALBEDO) {
+               if (channel == -1) return "DenoiseAlbedo";
+               if (channel == 0) return "DenoiseAlbedo.R";
+               if (channel == 1) return "DenoiseAlbedo.G";
+               return "DenoiseAlbedo.B";
+       }
+       if (passtype == SCE_PASS_DENOISE_ALBEDO_VAR) {
+               if (channel == -1) return "DenoiseAlbedoVar";
+               if (channel == 0) return "DenoiseAlbedoVar.R";
+               if (channel == 1) return "DenoiseAlbedoVar.G";
+               return "DenoiseAlbedoVar.B";
+       }
+       if (passtype == SCE_PASS_DENOISE_DEPTH) {
+               if (channel == -1) return "DenoiseDepth";
+               return "DenoiseDepth.Z";
+       }
+       if (passtype == SCE_PASS_DENOISE_DEPTH_VAR) {
+               if (channel == -1) return "DenoiseDepthVar";
+               return "DenoiseDepthVar.Z";
+       }
+       if (passtype == SCE_PASS_DENOISE_NOISY) {
+               if (channel == -1) return "DenoiseNoisy";
+               if (channel == 0) return "DenoiseNoisy.R";
+               if (channel == 1) return "DenoiseNoisy.G";
+               return "DenoiseNoisy.B";
+       }
+       if (passtype == SCE_PASS_DENOISE_NOISY_VAR) {
+               if (channel == -1) return "DenoiseNoisyVar";
+               if (channel == 0) return "DenoiseNoisyVar.R";
+               if (channel == 1) return "DenoiseNoisyVar.G";
+               return "DenoiseNoisyVar.B";
+       }
+       if (passtype == SCE_PASS_DENOISE_CLEAN) {
+               if (channel == -1) return "DenoiseClean";
+               if (channel == 0) return "DenoiseClean.R";
+               if (channel == 1) return "DenoiseClean.G";
+               return "DenoiseClean.B";
+       }
+
        return "Unknown";
 }
 
@@ -454,6 +505,33 @@ static uint64_t passtype_from_name(const char *str)
        if (STRPREFIX(str, "SubsurfaceCol"))
                return SCE_PASS_SUBSURFACE_COLOR;
 
+       if (STRPREFIX(str, "DenoiseNormal"))
+               return SCE_PASS_DENOISE_NORMAL;
+
+       if (STRPREFIX(str, "DenoiseNormalVar"))
+               return SCE_PASS_DENOISE_NORMAL_VAR;
+
+       if (STRPREFIX(str, "DenoiseAlbedo"))
+               return SCE_PASS_DENOISE_ALBEDO;
+
+       if (STRPREFIX(str, "DenoiseAlbedoVar"))
+               return SCE_PASS_DENOISE_ALBEDO_VAR;
+
+       if (STRPREFIX(str, "DenoiseDepth"))
+               return SCE_PASS_DENOISE_DEPTH;
+
+       if (STRPREFIX(str, "DenoiseDepthVar"))
+               return SCE_PASS_DENOISE_DEPTH_VAR;
+
+       if (STRPREFIX(str, "DenoiseNoisy"))
+               return SCE_PASS_DENOISE_NOISY;
+
+       if (STRPREFIX(str, "DenoiseNoisyVar"))
+               return SCE_PASS_DENOISE_NOISY_VAR;
+
+       if (STRPREFIX(str, "DenoiseClean"))
+               return SCE_PASS_DENOISE_CLEAN;
+
        return 0;
 }

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

Reply via email to