View Single Post
Old 11-08-2018, 05:45 PM   #29
wwwmaze
Human being with feelings
 
Join Date: Oct 2009
Posts: 115
Default

Give that a try Eli. It's probably not very efficient because it replaces the alpha of the foreground on pixel level.
I couldn't find another way, apart from chroma-keying with gfx_keyedblit maybe.

PHP Code:
// Selective Blender
// blends parts of the foreground defined by the
// grey-level of a reference (mask) into the background
// 
// Track-order (depending on project settings): 
// VideoProcessor - background - foreground - mask

//@param1:blend 'blend amount' 1 0 1 0.5 0.01
//@param2:mode 'blend mode' 0 0 19 0 1

//@param4:sub 'subtract?' 0 0 1 0 1

oldCS=colorspace;
colorspace='RGBA';

bg=input_track(0);
fg=input_track(1);
mask=input_track(2);

gfx_blit(bg);

gfx_dest fsMask gfx_img_resize(fsMask,project_w,project_h);
gfx_blit(mask);

gfx_dest fsFg gfx_img_resize(fsFg,project_w,project_h);
gfx_blit(fg);

gfx_evalrect(0,0,project_w,project_h,
    
"a=max(0,min(255,0.2989*sr+0.5870*sg+0.1140*sb));",
    
0,fsMask);

gfx_dest=-1;
gfx_a=blend*(sub?-1:1);
gfx_mode=(sub?1:mode)|0x10000;
gfx_blit(fsFg);

colorspace=oldCS

Last edited by wwwmaze; 11-09-2018 at 07:04 AM. Reason: enable multiprocessing
wwwmaze is offline   Reply With Quote