PDA

View Full Version : Requests: Blend plugin


Soulhunter
22nd January 2006, 19:13
A filter like "Overlay" (blending two clips) but with the possibility to affect the opacity of a pixel (from clip2 that gets "blendet in" clip1) depending on the luma level of the appropriate source pixel (from clip1)

Well, maybe some examples explain it better...


Example1:

BlendIt(Clip1,Clip2,Opacity=1,LowLevWeight=0,MidLevWeight=100,HighLevWeight=0)

Level 000 -> Clip2 Opacity = 000% / Clip1 Opacity = 100%
"
Level 032 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 064 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 128 -> Clip2 Opacity = 100% / Clip1 Opacity = 000%
"
Level 192 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 224 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 255 -> Clip2 Opacity = 000% / Clip1 Opacity = 100%


Example2:

BlendIt(Clip1,Clip2,Opacity=1,LowLevWeight=0,MidLevWeight=100,HighLevWeight=25)

Level 000 -> Clip2 Opacity = 000% / Clip1 Opacity = 100%
"
Level 032 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 064 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 128 -> Clip2 Opacity = 100% / Clip1 Opacity = 000%
"
Level 192 -> Clip2 Opacity = 075% / Clip1 Opacity = 025%
"
Level 224 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 255 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%


Example3:

BlendIt(Clip1,Clip2,Opacity=1,LowLevWeight=25,MidLevWeight=50,HighLevWeight=100)

Level 000 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 128 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 255 -> Clip2 Opacity = 100% / Clip1 Opacity = 000%


Example4:

BlendIt(Clip1,Clip2,Opacity=0.5,LowLevWeight=50,MidLevWeight=100,HighLevWeight=50)

Level 000 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 128 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 255 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%


etc.

:D


Tia n' Bye

mg262
22nd January 2006, 19:28
Can't you do this with a LUT + MaskedMerge [or masktools 2.0 equivalent]? I.e. make the mask by applying a lookup to clip1, then use the mask to merge the two clips. ... or do you need it to be faster?

Soulhunter
22nd January 2006, 20:14
Well, as makstools is still "a book with 7 seals" to me, I dont know ^^; But I guess a dll (or a modification of AviSynths Overlay code) would be the better way for such a "common" operation, no?


Tia n Bye

Manao
22nd January 2006, 20:44
Level 000 -> Clip2 Opacity = 000% / Clip1 Opacity = 100%
"
Level 032 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 064 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 128 -> Clip2 Opacity = 100% / Clip1 Opacity = 000%
"
Level 192 -> Clip2 Opacity = 050% / Clip1 Opacity = 050%
"
Level 224 -> Clip2 Opacity = 025% / Clip1 Opacity = 075%
"
Level 255 -> Clip2 Opacity = 000% / Clip1 Opacity = 100%mt_lutxy(clip1, clip2, "x 128 < x 128 / x * 128 x - 128 / y * + 256 x - 128 / x * x 128 - 128 / y * ?")Which is translated into :if ( x < 128 ) return (x / 128) * x + (128 - x) * y / 128
else return (256 - x) * x / 128 + (x - 128) * y / 128

Soulhunter
25th January 2006, 15:50
Ok, in the meantime I had another look at the masktools docu (reverse polish notation makes Soulhunters head hurt XD) but at the point I have to think up a way to make it a configurable (freely adjustable like in the examples above) function Im totally lost... :\


Tia n' Bye

Manao
25th January 2006, 16:01
If reverse polish gives you headache, there's the mt_polish function that will create a nice reverse polish string from a normal infix one.