[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48824] trunk/blender/source/blender: Fixes for keying screen:
Sergey Sharybin
sergey.vfx at gmail.com
Wed Jul 11 09:46:37 CEST 2012
Revision: 48824
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48824
Author: nazgul
Date: 2012-07-11 07:46:36 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
Fixes for keying screen:
- Fixed issue with black areas appearing when too many sites
are defined.
Currently tweak epsilon value for this, but probably actual
issue is somewhere else, can't see it yet.
- Fixed issue with bright pixels appearing in the sites, was
caused by accumulating color for pixels, which isn't needed.
Once color for pixel was set stop iterating via triangles.
Could give some speedup too.
- Ignore markers which are outside of frame bounds, they were
giving bad triangulation and they can't affect on gradient
due to color fir such sites is not known.
- Sites used to be created at position without track offset
taken into account.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/voronoi.c
trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
Modified: trunk/blender/source/blender/blenlib/intern/voronoi.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/voronoi.c 2012-07-11 02:12:43 UTC (rev 48823)
+++ trunk/blender/source/blender/blenlib/intern/voronoi.c 2012-07-11 07:46:36 UTC (rev 48824)
@@ -39,7 +39,7 @@
#include "BLI_voronoi.h"
#include "BLI_utildefines.h"
-#define VORONOI_EPS 1e-3
+#define VORONOI_EPS 1e-2
enum {
voronoiEventType_Site = 0,
Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp 2012-07-11 02:12:43 UTC (rev 48823)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp 2012-07-11 07:46:36 UTC (rev 48824)
@@ -104,10 +104,20 @@
/* count sites */
for (track = (MovieTrackingTrack *) tracksbase->first, sites_total = 0; track; track = track->next) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
+ float pos[2];
- if ((marker->flag & MARKER_DISABLED) == 0) {
- sites_total++;
+ if (marker->flag & MARKER_DISABLED)
+ continue;
+
+ add_v2_v2v2(pos, marker->pos, track->offset);
+
+ if (!IN_RANGE_INCL(pos[0], 0.0f, 1.0f) ||
+ !IN_RANGE_INCL(pos[1], 0.0f, 1.0f))
+ {
+ continue;
}
+
+ sites_total++;
}
if (!sites_total)
@@ -128,10 +138,19 @@
VoronoiSite *site;
ImBuf *pattern_ibuf;
int j;
+ float pos[2];
if (marker->flag & MARKER_DISABLED)
continue;
+ add_v2_v2v2(pos, marker->pos, track->offset);
+
+ if (!IN_RANGE_INCL(pos[0], 0.0f, 1.0f) ||
+ !IN_RANGE_INCL(pos[1], 0.0f, 1.0f))
+ {
+ continue;
+ }
+
site = &sites[i];
pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
@@ -153,8 +172,8 @@
mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
IMB_freeImBuf(pattern_ibuf);
- site->co[0] = marker->pos[0] * width;
- site->co[1] = marker->pos[1] * height;
+ site->co[0] = pos[0] * width;
+ site->co[1] = pos[1] * height;
}
IMB_freeImBuf(ibuf);
@@ -308,9 +327,11 @@
if (barycentric_coords_v2(a->co, b->co, c->co, co, w)) {
if (barycentric_inside_triangle_v2(w)) {
- color[0] += a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
- color[1] += a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
- color[2] += a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
+ color[0] = a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
+ color[1] = a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
+ color[2] = a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
+
+ break;
}
}
}
More information about the Bf-blender-cvs
mailing list