[Bf-blender-cvs] [e855ded] soc-2016-cycles_denoising: Cycles Denoising: Implement the denoising data render passes in Cycles

Lukas Stockner noreply at git.blender.org
Fri May 27 21:47:19 CEST 2016


Commit: e855dede3881106194cb8fdfdaced0dde0b4ac01
Author: Lukas Stockner
Date:   Fri May 27 15:24:45 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rBe855dede3881106194cb8fdfdaced0dde0b4ac01

Cycles Denoising: Implement the denoising data render passes in Cycles

The parameters aren't set anywhere yet since that requires them to be added to the RenderLayer first.

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

M	intern/cycles/kernel/kernel_types.h
M	intern/cycles/render/buffers.cpp
M	intern/cycles/render/buffers.h
M	intern/cycles/render/film.cpp
M	intern/cycles/render/film.h

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

diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 02e69c7..613a3db 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1021,6 +1021,11 @@ typedef struct KernelFilm {
 	float mist_inv_depth;
 	float mist_falloff;
 
+	int pass_denoising;
+	int pass_no_denoising;
+	int pass_pad4;
+	int pass_pad5;
+
 #ifdef __KERNEL_DEBUG__
 	int pass_bvh_traversal_steps;
 	int pass_bvh_traversed_instances;
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index 558f5e5..5ad1e18 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -42,6 +42,9 @@ BufferParams::BufferParams()
 	full_width = 0;
 	full_height = 0;
 
+	denoising_passes = false;
+	selective_denoising = false;
+
 	Pass::add(PASS_COMBINED, passes);
 }
 
@@ -68,7 +71,13 @@ int BufferParams::get_passes_size()
 
 	foreach(Pass& pass, passes)
 		size += pass.components;
-	
+
+	if(denoising_passes) {
+		/* Feature passes: 7 Channels (3 Color, 3 Normal, 1 Depth) + 7 Variance
+		 * Color passes: 3 Noisy (RGB) + 3 Variance [+ 3 Skip (RGB)] */
+		size += selective_denoising? 23: 20;
+	}
+
 	return align_up(size, 4);
 }
 
diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h
index dca2d1d..0188712 100644
--- a/intern/cycles/render/buffers.h
+++ b/intern/cycles/render/buffers.h
@@ -51,6 +51,9 @@ public:
 
 	/* passes */
 	vector<Pass> passes;
+	bool denoising_passes;
+	/* If only some light path types should be denoised, an additional pass is needed. */
+	bool selective_denoising;
 
 	/* functions */
 	BufferParams();
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index 95cb10a..e8dc220 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -267,6 +267,8 @@ Film::Film()
 {
 	exposure = 0.8f;
 	Pass::add(PASS_COMBINED, passes);
+	denoising_passes = false;
+	selective_denoising = false;
 	pass_alpha_threshold = 0.5f;
 
 	filter_type = FILTER_BOX;
@@ -423,6 +425,15 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 		kfilm->pass_stride += pass.components;
 	}
 
+	if(denoising_passes) {
+		kfilm->pass_denoising = kfilm->pass_stride;
+		kfilm->pass_stride += 20;
+		if(selective_denoising) {
+			kfilm->pass_no_denoising = kfilm->pass_stride;
+			kfilm->pass_stride += 3;
+		}
+	}
+
 	kfilm->pass_stride = align_up(kfilm->pass_stride, 4);
 	kfilm->pass_alpha_threshold = pass_alpha_threshold;
 
@@ -457,7 +468,9 @@ bool Film::modified(const Film& film)
 		&& filter_width == film.filter_width
 		&& mist_start == film.mist_start
 		&& mist_depth == film.mist_depth
-		&& mist_falloff == film.mist_falloff);
+		&& mist_falloff == film.mist_falloff
+		&& denoising_passes == film.denoising_passes
+		&& selective_denoising == film.selective_denoising);
 }
 
 void Film::tag_passes_update(Scene *scene, const vector<Pass>& passes_)
diff --git a/intern/cycles/render/film.h b/intern/cycles/render/film.h
index 966e00a..5871499 100644
--- a/intern/cycles/render/film.h
+++ b/intern/cycles/render/film.h
@@ -53,6 +53,8 @@ class Film {
 public:
 	float exposure;
 	vector<Pass> passes;
+	bool denoising_passes;
+	bool selective_denoising;
 	float pass_alpha_threshold;
 
 	FilterType filter_type;




More information about the Bf-blender-cvs mailing list