swap alpha channels with jit.unpack jit.pack


    Aug 15 2006 | 3:09 am
    I am stumped... it's frustrating when you see a problem as going to be easy to solve and it turns out to be real challenge.
    All I want to do is use a difference key as a revealing mask on another video and then composit that over another video... i have spent two days on this... I have no idea why it is not working!
    here is an example of what i want to do, and how i think it sould work, it works ok but am sure there is an easier way.
    thanks,
    tim
    max v2;

    • Aug 14 2006 | 8:59 pm
      On Aug 14, 2006, at 8:09 PM, Timothy Devine wrote:
      >
      > I am stumped... it's frustrating when you see a problem as going to
      > be easy to solve and it turns out to be real challenge.
      >
      > All I want to do is use a difference key as a revealing mask on
      > another video and then composit that over another video... i have
      > spent two days on this... I have no idea why it is not working!
      >
      > here is an example of what i want to do, and how i think it sould
      > work, it works ok but am sure there is an easier way.
      You need to explain better what exactly you want to do and what apect
      of your patch is not working for you. Your patch seems to work as
      expected by your patch design as far as I can tell. I'm not sure why
      you're subtracting the red difference key from the chilis.jpg, but I
      assume you have a reason for that. I'm also not sure why you're
      alphablending with colorwheel and then trying to do a luminance key
      to it. However, perhaps this is just for illustration and there would
      otherwise be a fourth stream for the luminance key. Hard to say.
      Otherwise your patch seems simple and an appropriate way to achieve
      what I believe you're describing. I've attached a version of a
      difference keying example I use when teaching at bottom. It only
      makes a binary mask, but is otherwise similar to what you are doing
      prior to the luminance key.
      You could speed things up a bit if you use 1 plane matrices for your
      lowpass filter, and the absdiff operator, replacing jit.brcosa with
      jit.charmap or jit.map. Alternately, you could make much faster using
      the GPU, but that will be more involved. Once you get it working on
      the CPU, you might then look at porting your algorithm to a single
      shader for the GPU.
      -Joshua
    • Aug 15 2006 | 7:18 am
      Hi joshua,
      Thanks!
      here is an updated version that shows you what i want to do. I took your advice with the GPU stuff ... i think i get it, it works much faster!
      thanks for your help
      max v2;
    • Aug 15 2006 | 7:50 pm
      Hi Timothy,
      If you are using Jitter 1.6, you should have a look at the
      cc.alphaglue.jxs shader with param lum2alpha 1. This will take the
      luminance of the second input and use that as the alpha channel for the
      left input. You will then need an alphablend shader, which I have so
      kindly offered below. Save the following text as co.alphablend.jxs and
      throw it in your jitter-shaders/composite folder.
      Let me know how you get on with that.
      //Andrew Benson
      alphablending composite operator
    • Aug 16 2006 | 12:44 am
      Thanks Andrew!
      It seems like the right way to go. My only problem is the Erase from the trigger object erases my absdiff slab, so I can't create a mask. also i am not sure if the alphablending composite operator was all that was supposed to be in the text file that i created and copied into my jitter-shaders/composite folder. the shader I created does not detect it.
      Thanks again it is much simpler!
      I will keep trying with the alphablending composite operator, do not really understand it fully. my patch is below.
      tim
      max v2;
    • Aug 18 2006 | 1:14 am
      Hi all,
      Is there an alphablending composite operator already in max? I can't seem to find one. Is there any other way to combine two images, one with an alpha in openGL using a slab, like jit.alphablend?
    • Aug 18 2006 | 1:28 am
      There are any number of ways to combine 2 images in opengl. You could
      use 2 layered jit.gl.videoplanes. Another way would be to use a
      compositing slab operation and display the result on a single
      jit.gl.videoplane. Look in your jitter-shaders/composite folder, all
      of the photoshop layer blend modes are there. Have a look at tutorial
      42 for more information.
      wes
      On 8/17/06, Timothy Devine wrote:
      >
      > Hi all,
      >
      > Is there an alphablending composite operator already in max? I can't seem to find one. Is there any other way to combine two images, one with an alpha in openGL using a slab, like jit.alphablend?
      >
      >
      >
      >
      >
    • Aug 18 2006 | 1:33 am
      If i use 2 layered jit.gl.videoplanes will that utilize the alpha channel if it is there? The Photoshop blend modes won't use the alpha.
      tim
    • Aug 18 2006 | 1:42 am
      On 8/17/06, Timothy Devine wrote:
      >
      > If i use 2 layered jit.gl.videoplanes will that utilize the alpha channel if it is there?
      Yes depending on your blend_mode attribute.
      The Photoshop blend modes won't use the alpha.
      True, but you can modify them to use the alpha channel however you
      want. It's quite easy to do. If you don't know GLSL, there are a
      number of tutorials online that can exaplin the basics. Personally, I
      would go this route as it's more flexible than using the OpenGL fixed
      function pipeline's blend_modes.
      wes
      >
      > tim
      >
    • Aug 18 2006 | 1:51 am
      Thanks wes.
      I will give GLSL a shot.
      tim
    • Aug 18 2006 | 2:30 am
      FWIW, Andrew Benson just posted an alphablend shader to the list earlier
      this week. Check the archives...
      -Joshua
      --------------------------------------------------------------------
      mail2web - Check your email from the web at
    • Aug 18 2006 | 4:17 am
      Actually, here is a question ive been meaning to ask, for the OpenGL
      blend modes, do any of them have 'photoshop' equivalents? for example
      6, 1 seems like overlay. The reason I ask, is so I can give the modes
      some accurate names in a UI in building, rather than just numbers.
      I did a rudementary search, to no avail. Far too much signal to noise.
      Thanks!
      v a d e //
      www.vade.info
      abstrakt.vade.info
      On Aug 17, 2006, at 10:30 PM, jkc@musork.com wrote:
      >
      > FWIW, Andrew Benson just posted an alphablend shader to the list
      > earlier
      > this week. Check the archives...
      >
      > -Joshua
      >
      > --------------------------------------------------------------------
      > mail2web - Check your email from the web at
      > http://mail2web.com/ .
      >
      >
      >
    • Aug 18 2006 | 6:36 am
      FWIW, I just emailed the shader directly to Timothy, but putting
      together an alphablend shader would make a great first project for
      learning GLSL. It's amazing what you can accomplish with just a couple
      lines of code.
      Andrew B.
    • Aug 18 2006 | 11:31 am
    • Aug 18 2006 | 11:49 am
      Sorry, I can't seem to find the shader. Could someone link me to it?
    • Nov 20 2006 | 5:24 pm
      Could you send me this interesting shader please? (co.alphablend.jxs)
      It could be very nice because it misses some parts directly in the post. Can you send it in an attachment to avoid the missing parts?
      Thank you very much!