Mask in a videopane
Hi
I'm trying to make something like the example "dynamic_alpha.maxpat" where a drawn black area (using lcd) is transparent on a videoplance - a mask. However in mine I don't want to see through to noise or anything else on the videoplane I want to see through to what is behind the plane. Can anyone point out what I should do to modify ether mine (below) or the example that comes with max? Thanks in advance.
Garrett
I always have trouble with jit.alphablend..it's not as intuitive as I'd like, but I'm probably thinking about it the wrong way. That said...TA-DA!
Things I added are in purple..just took them out of the jit.alphablend tutorial..make sure to hit the purple loadmess so that the mode is correct..you can use mode to invert the mask in jit.alphablend
Hi
Thanks for your reply.
>I always have trouble with jit.alphablend..it's not as intuitive
>as I'd like, but I'm probably thinking about it the wrong way.
That would be two of us then. This still isn't quite right though,if you play a movie with black the black in the movie disappears when it should stay visible. The transparency processing is happening based on colour. What I'm attempting to do is make my mask an alpha channel so the transparency is colour independent.
Garrett
i think the problem with both your techniques is that you are trying to do alpha blending in opengl world, but you're using jit.alphablend, which does alpha blending in matrix world .
if you unpack the matrix coming out of jit.alphablend, and look at the alpha channel, you should notice that it is all white, which means that jit.alphablend does not preserve the alpha channel passed in.
the solution is really quite simple. just use jit.pack/unpack to plug your alpha mask into a qt.movie, and plug directly into jit.gl.videoplane. (depth_enable *should* be 0, if you're blending with other gl objects).
Hi Robtherich
I knew it must be easier than messing with a jit.gl.slab, that seemed overkill. Many thanks for this :)
Garrett
But what if you have more than a few masks (and all becomes sluggish) and would like to do the whole thing in OpenGL?
I tried messing with co.alphablend.jxs and cc.alphaglue.jxs but I can not seem to figure out what to do with them to make it work.
Anyone has any ideas?
see if this helps you at all..i was having a lot of trouble with the alphablend shader and was wrestling with it for a while...here is my patch that finally let me figure it out...it basically only applies an effect on a certain masked area based on either luminance or motion, so it's not dealing with alphachannels specifically..but it might get you closer (dont forget to save and reload the patch so the loadmess's and loadbangs are correctly turned on)
Thanks laserpilot. I already saw a version of your patch on another thread. But unfortunately this doesn't help me that much because co.alphablend.jxs doesn't seem to be as simple and as intuitive as jit.alphablend.
And robtherich's patch with 3 masks (3 jit.unpacks) really gets the patch from 60fps to 19fps :(