Forums > Jitter

adding a layer as a "screen" bleding mode

March 28, 2012 | 11:20 am

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?
Thanks
A


March 28, 2012 | 11:54 am

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.


March 28, 2012 | 12:51 pm

thanks a lot i’ll try that
A


March 28, 2012 | 2:33 pm

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


March 28, 2012 | 5:33 pm

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/jit.gl.pix.

– Pasted Max Patch, click to expand. –

March 28, 2012 | 6:11 pm

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
A


March 28, 2012 | 11:36 pm

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…


March 29, 2012 | 8:21 am

Thank you,cause i have the same question.thanks


Viewing 8 posts - 1 through 8 (of 8 total)