adding a layer as a "screen" bleding mode

Mar 28, 2012 at 11:20am

adding a layer as a "screen" bleding mode

Hi all, is there a way of using jit.op to have a layer covering completely whatever is underneath excluding where it’s black?
I have some video with white parts and would like to have some red stripes for example on top. So i create those on a black background, but of course when i add them to white they produce white. If i multiply is ok but in the black parts of the upper layer the result is black of course erasing the first layer. So what kind of operation should i use?

Mar 28, 2012 at 11:54am

Look into [jit.alphablend], if I understand you correctly, then that is what you need. If you have the red stripes on a black background, use [jit.matrix 4 char (width) (height) @ planemap 1 1 2 3] to duplicate the R plane onto the A plane, then send it to the left inlet of [jit.alphablend] and your original video to the right.

This will result in all the red stripes entire blended with the original matrix. If you only need them where the white parts are, you might want to perform additional operations on the alpha channel of the remapped matrix.

Mar 28, 2012 at 12:51pm

thanks a lot i’ll try that

Mar 28, 2012 at 2:33pm

If you have trouble figuring it out, maybe post the patch…

Mar 28, 2012 at 5:33pm

according to this website the equation for Screen mode is:
R = 1 – (1-Base) × (1-Blend)

this can easily be achieved with standard jit.op operators, but this is a perfect task to try out jit.gen/jit.pix/

– Pasted Max Patch, click to expand. –
Mar 28, 2012 at 6:11pm

actually i made a mistake and i need “hard light” so that red on both black and white i visible, but i see how to implement it now.. thanks Robert
and Secip Xynic

Mar 28, 2012 at 11:36pm

Somehow i still find troubles having an if in jit.op (i have no max 6 yet). In the next patch i’m trying to have the red text both on the white and on the black…

Mar 29, 2012 at 8:21am

Thank you,cause i have the same question.thanks


You must be logged in to reply to this topic.