Mask in a videopane

    Sep 19 2010 | 1:57 pm
    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.

    • Sep 19 2010 | 9:49 pm
      I always have trouble with'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 can use mode to invert the mask in jit.alphablend
    • Sep 20 2010 | 6:47 pm
      Thanks for your reply.
      >I always have trouble with'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.
    • Sep 20 2010 | 6:59 pm
      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, and plug directly into (depth_enable *should* be 0, if you're blending with other gl objects).
    • Sep 20 2010 | 7:55 pm
      Hi Robtherich
      I knew it must be easier than messing with a, that seemed overkill. Many thanks for this :)
    • Oct 10 2010 | 3:24 pm
      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?
    • Oct 10 2010 | 3:39 pm
      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 is my patch that finally let me figure 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)
    • Oct 10 2010 | 6:06 pm
      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 :(