[Bf-blender-cvs] [dbb9eba] master: Fixed border extension for the sunbeams node.

Lukas Tönne noreply at git.blender.org
Tue Sep 23 11:44:17 CEST 2014


Commit: dbb9eba0fb81b41c15deccc97a6d7c2d9825cb60
Author: Lukas Tönne
Date:   Tue Sep 23 11:42:11 2014 +0200
Branches: master
https://developer.blender.org/rBdbb9eba0fb81b41c15deccc97a6d7c2d9825cb60

Fixed border extension for the sunbeams node.

This ensures that the beams color does not darken along borders,
by using the last valid color of the ray as the border color (extending
colors in the direction of the source point).

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	scons
M	source/blender/compositor/operations/COM_SunBeamsOperation.cpp

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 5ea1456..18bf273 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 5ea1456cf5bf9caa32d4988284cc0b75637dd45d
+Subproject commit 18bf273c38b0d52429274159f1d4d4d00be59e30
diff --git a/release/scripts/addons b/release/scripts/addons
index 59ff66f..655cd36 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 59ff66fa7aca6a56dfa516ee4a456428516d2c6f
+Subproject commit 655cd369b4b34e2969a3b167394e00caf0fde4b1
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 9c1b725..8f33ffc 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 9c1b7252bb510cc527c4ef2fd5aa3b586d095e98
+Subproject commit 8f33ffcebed445755d3453b8f486306bcf2b142a
diff --git a/scons b/scons
index 1ec9310..625d446 160000
--- a/scons
+++ b/scons
@@ -1 +1 @@
-Subproject commit 1ec93106c40fab0c339d09c7ed9897c85ddf3da5
+Subproject commit 625d446ae8996ff1b3d660c44e2827fc832cf12b
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
index 5caaff7..bcef652 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
@@ -138,6 +138,7 @@ struct BufferLineAccumulator {
 		int x, y, num;
 		float v, dv;
 		float falloff_factor;
+		float border[4];
 
 		if ((int)pt_ofs[0] == 0 && (int)pt_ofs[1] == 0) {
 			copy_v4_v4(output, input->getBuffer() + COM_NUMBER_OF_CHANNELS * ((int)source[0] + input->getWidth() * (int)source[1]));
@@ -146,19 +147,26 @@ struct BufferLineAccumulator {
 
 		/* initialise the iteration variables */
 		float *buffer = init_buffer_iterator(input, source, pt_ofs, dist_min, dist_max, x, y, num, v, dv, falloff_factor);
-
-		int tot = 0;
+		zero_v3(border);
+		border[3] = 1.0f;
 
 		/* v_local keeps track of when to decrement v (see below) */
 		float v_local = v - floorf(v);
 
 		for (int i = 0; i < num; i++) {
-			/* range check, abort when running beyond the image border */
-			if (x < rect.xmin || x >= rect.xmax || y < rect.ymin || y >= rect.ymax)
-				break;
-
-			float f = 1.0f - (float)i * falloff_factor;
-			madd_v4_v4fl(output, buffer, buffer[3] * f * f);
+			float weight = 1.0f - (float)i * falloff_factor;
+			weight *= weight;
+			
+			/* range check, use last valid color when running beyond the image border */
+			if (x >= rect.xmin && x < rect.xmax && y >= rect.ymin && y < rect.ymax) {
+				madd_v4_v4fl(output, buffer, buffer[3] * weight);
+				/* use as border color in case subsequent pixels are out of bounds */
+				copy_v4_v4(border, buffer);
+			}
+			else {
+				madd_v4_v4fl(output, border, border[3] * weight);
+			}
+			
 			/* TODO implement proper filtering here, see
 			 * http://en.wikipedia.org/wiki/Lanczos_resampling
 			 * http://en.wikipedia.org/wiki/Sinc_function
@@ -166,9 +174,8 @@ struct BufferLineAccumulator {
 			 * using lanczos with x = distance from the line segment,
 			 * normalized to a == 0.5f, could give a good result
 			 *
-			 * for now just count samples and divide equally at the end ...
+			 * for now just divide equally at the end ...
 			 */
-			tot++;
 
 			/* decrement u */
 			x -= fxx;




More information about the Bf-blender-cvs mailing list