[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59014] branches/soc-2011-tomato/source/ blender/compositor/operations: Re-arrange AA sampling a bit

Sergey Sharybin sergey.vfx at gmail.com
Thu Aug 8 09:38:56 CEST 2013


Revision: 59014
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59014
Author:   nazgul
Date:     2013-08-08 07:38:56 +0000 (Thu, 08 Aug 2013)
Log Message:
-----------
Re-arrange AA sampling a bit

Apparently when calculating UV from upsampled
corners warped result seems too much doggy.

Now result seems to be exactly the same as it
was before AA changes (apart from AA-ed edges :)

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackMaskOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackMaskOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackMaskOperation.cpp	2013-08-08 07:38:49 UTC (rev 59013)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackMaskOperation.cpp	2013-08-08 07:38:56 UTC (rev 59014)
@@ -45,15 +45,15 @@
 	float frame_space_corners[4][2];
 
 	for (int i = 0; i < 4; i++) {
-		frame_space_corners[i][0] = this->m_corners[i][0] * this->getWidth() * kernel_size;
-		frame_space_corners[i][1] = this->m_corners[i][1] * this->getHeight() * kernel_size;
+		frame_space_corners[i][0] = this->m_corners[i][0] * this->getWidth() ;
+		frame_space_corners[i][1] = this->m_corners[i][1] * this->getHeight();
 	}
 
 	int inside_counter = 0;
 	for (int dx = 0; dx < kernel_size; dx++) {
 		for (int dy = 0; dy < kernel_size; dy++) {
-			point[0] = x * kernel_size + dx;
-			point[1] = y * kernel_size + dy;
+			point[0] = x + (float) dx / kernel_size;
+			point[1] = y + (float) dy / kernel_size;
 
 			if (isect_point_tri_v2(point, frame_space_corners[0], frame_space_corners[1], frame_space_corners[2]) ||
 			    isect_point_tri_v2(point, frame_space_corners[0], frame_space_corners[2], frame_space_corners[3]))

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp	2013-08-08 07:38:49 UTC (rev 59013)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp	2013-08-08 07:38:56 UTC (rev 59014)
@@ -147,15 +147,15 @@
 	float color_accum[4];
 
 	for (int i = 0; i < 4; i++) {
-		frame_space_corners[i][0] = this->m_corners[i][0] * this->getWidth() * kernel_size;
-		frame_space_corners[i][1] = this->m_corners[i][1] * this->getHeight() * kernel_size;
+		frame_space_corners[i][0] = this->m_corners[i][0] * this->getWidth();
+		frame_space_corners[i][1] = this->m_corners[i][1] * this->getHeight();
 	}
 
 	zero_v4(color_accum);
 	for (int sample_dx = 0; sample_dx < kernel_size; sample_dx++) {
 		for (int sample_dy = 0; sample_dy < kernel_size; sample_dy++) {
-			float current_x = x * kernel_size + sample_dx,
-			      current_y = y * kernel_size + sample_dy;
+			float current_x = x + (float)sample_dx / kernel_size,
+			      current_y = y + (float)sample_dy / kernel_size;
 			if (isPointInsideQuad(current_x, current_y, frame_space_corners)) {
 				float current_color[4];
 				float u, v, dx, dy;




More information about the Bf-blender-cvs mailing list