[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47228] branches/soc-2011-tomato/source/ blender/compositor/operations: Several small fixes to nodes:

Sergey Sharybin sergey.vfx at gmail.com
Wed May 30 16:39:21 CEST 2012


Revision: 47228
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47228
Author:   nazgul
Date:     2012-05-30 14:39:20 +0000 (Wed, 30 May 2012)
Log Message:
-----------
Several small fixes to nodes:

- Code formation fix in keying node
- Fixed crash when creating keying screen for frame where there's no movie
- Attempt to improve keying node to handle alpha on hair better

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingOperation.cpp	2012-05-30 14:33:24 UTC (rev 47227)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingOperation.cpp	2012-05-30 14:39:20 UTC (rev 47228)
@@ -47,7 +47,7 @@
 	float mid = pixel[0] + pixel[1] + pixel[2] - min - max;
 	float val = (1.0f - screen_balance) * min + screen_balance * mid;
 
-	return max - val;
+	return (max - val) * (1.0f - val) * (1.0f - val);
 }
 
 KeyingOperation::KeyingOperation(): NodeOperation()
@@ -92,7 +92,7 @@
 	if (primary_channel != screen_primary_channel) {
 		/* different main channel means pixel is on foreground */
 		color[0] = 1.0f;
-        }
+	}
         else if (saturation >= screen_saturation) {
 		/* saturation of main channel is more than screen, definitely a background */
 		color[0] = 0.0f;
@@ -102,7 +102,7 @@
 
 		distance = 1.0f - saturation / screen_saturation;
 
-		color[0] = distance;
+		color[0] = distance * distance;
 
 		if (color[0] < this->clipBlack)
 			color[0] = 0.0f;
@@ -110,5 +110,5 @@
 			color[0] = 1.0f;
 		else
 			color[0] = (color[0] - this->clipBlack) / (this->clipWhite - this->clipBlack);
-        }
+	}
 }

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp	2012-05-30 14:33:24 UTC (rev 47227)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp	2012-05-30 14:39:20 UTC (rev 47228)
@@ -102,11 +102,14 @@
 	if (!sites_total)
 		return NULL;
 
-	triangulation = (TriangulationData *) MEM_callocN(sizeof(TriangulationData), "keying screen triangulation data");
-
 	BKE_movieclip_user_set_frame(&user, framenumber);
 	ibuf = BKE_movieclip_get_ibuf(movieClip, &user);
 
+	if (!ibuf)
+		return NULL;
+
+	triangulation = (TriangulationData *) MEM_callocN(sizeof(TriangulationData), "keying screen triangulation data");
+
 	sites = (VoronoiSite *) MEM_callocN(sizeof(VoronoiSite) * sites_total, "keyingscreen voronoi sites");
 	track = (MovieTrackingTrack *) tracksbase->first;
 	i = 0;




More information about the Bf-blender-cvs mailing list