GPU & alphablending : how to ?

    Feb 02 2008 | 6:08 pm
    the question is in the title. Is there a shader to do an alphablending with gl objects ?
    thank you.

    • Feb 02 2008 | 6:16 pm
      you dont need shaders to blend alpha, just enable blend_enable 1, and use a blend_mode which uses alpha. Some cards may require lighting_enable 1 to be active, if you send a texture to an object that has alpha components (and you arent uploading it UYVY which removes the alpha channel), you should see transparency
      Unless you are asking something totally different? What do you want to do?
      On Feb 2, 2008, at 1:08 PM, Derrick Giscloux wrote:
      > > Hello, > > the question is in the title. > Is there a shader to do an alphablending with gl objects ? > > thank you.
    • Feb 02 2008 | 7:18 pm
      Thank you for the answer. I have several problem with a patch and many questions come all in time. I work on jitter-clone of the quartz composer patching called "light passage" by Zugakousaku (
      Perhaps you know it.
      My patch works fine, but I can't achieve the light effect at the bottom of the tunnel. Even with the blend_enable & blend_mode attributes. The problem is that with blend_enable 1 and the blend modes I tryed, the full image is transparent. I'd like to have transparency only in the black region around the light sphere. (please look at the file joined). I presume my photoshop picture file should have an alpha channel set to 0 in the black region and 255 in the light region or something like that. It is why I considered to do that with jit.op and jit.alphablend, but not very sure ...
      But the main problem is that texture disappears from the plane when I run in fullscreen. This was evoked in another thread and the @automatic and rendering in proper order proposals aren't very clear, since tutorial 31 seems not to work as expected.
      below pic file of the problem.
    • Feb 03 2008 | 5:16 pm
      yes it took me a while too to get around it , Vade's tutorials ( ) and Andrew Benson's receipes have been really helpfull to get some of the openGL magic :)
      hope this helps in the meantime :
    • Feb 12 2013 | 12:17 am
      i know there is countless threads about this and i read them all but i still do not get it - there is this mysterious co.alphablend.jxs shader but no documentation whatsoever so maybe someone could just show me the way...: i blend videos with proper alphachannels on videoplanes - that works fine. the only problem is, that AFTER the blending i want to apply some effects (as well on the gpu-side) so i would need something which works just like a videoplane with "blend_enable 1" and a layer order but which does not draw to a window but has an outlet i could feed into some other slab. how would i do this???
      the working videoplane version is in the patch below. i would need the same, but without drawing to a videoplane but just an outlet instead. who can give me a hand? k
    • Feb 14 2013 | 7:56 pm
      isn't there anyone who can explain this to me? this is seriously driving me nuts and i am pretty sure the solution is really easy... isn't there a way i can just use a slab for this (which i tried and it does sort of blend but ignores the append message of the alpha)...? ? k
    • Feb 14 2013 | 9:18 pm
      i'm pretty sure i answered this in your other post no?
      many of the default shaders ignore the alpha value, therefore you either edit them, or (IMO a much easier solution) use
      if you provide a complete working patch showing what you're trying to achieve, i'd be happy to offer a more specific solution.
    • Feb 14 2013 | 9:49 pm
      well..., you did. to be honest, the problem is i did not buy gen and i would not even know what to use it for except for this. and for editing shaders... frankly i have no idea how to do this (if i would understand code lines i would probably have none of these problems anyway). what about this co.alphablend.jxs-shader? it sounds exactly like what i am looking for but i can't find any help patch or any other documentation...?
      i just find it hard to believe i can not mix two inputs plus an alpha to one single texture. especially since it can be so easily done with videoplanes. i currently work with 8 videoplanes, to each one applying the very same effect chain (bunch of slabs) - which is not only "not pretty" but as well generates a different result as when i would apply these effects only once to a composited image.
      thank you so much for your help!!!! k
    • Feb 14 2013 | 10:53 pm
      to make it more clear what i am looking for, i updated my example patch from above so it is really working and shows exactly what i need... again, thank you so much for your help! k
    • Feb 14 2013 | 11:04 pm
      ok, if you don't want to edit the shaders or use gen, you can do what you want using add your videoplane layers to a and enable capturing on the node. you can then further process the captured texture.
    • Feb 14 2013 | 11:11 pm
      wow, that was quick! i do not fully understand it yet but i think i can safely say: YOU ARE MY HERO! (i guess you hear that a lot but still...) for the third time: thank you so much!!! k
    • Feb 15 2013 | 11:16 am
      just for reference: i finally understood these alphaglue/alphablend shaders too. it really is dead drop simple - i just did not get the fact that you have to combine them. for other being equally stupid below the same patch using these two (unmodified) shaders:
      best k
    • Feb 15 2013 | 5:54 pm
      Hey karl, I am trying to run the patch you posted. What do I use for "input: picture with proper alpha channel"? Is this a jpg image?
    • Feb 16 2013 | 2:16 pm
      hi, jpeg does not support alpha, i use targa. you can however as well use any other channel (r, g, b) of any image if you just select another output (2, 3, 4) of the jit.unpack. or you replace it with jit.rgb2luma and take any image (which gets converted to greyscale then which will get used as an alpha matte). best k
    • Feb 16 2013 | 7:35 pm
      interesting...: i changed my patch to do the compositing (6 layers, each with individual alpha) with shaders (alphaglue/alphablend, see above) and that does work - but introduces quite noticeable frame lagging. once i stop playback, everything is fine and the mattes and videos match perfectly but while playing some of them get delayed by about 1 frame. as well single wrong images appear briefly when switching to different slabs (eg. when i bypass one slabchain with a gate). i do not have this behaviour if i allocate a separate videoplane to each single compositing process - that performs flawlessly (apart from the problem with applying effects after that...). the approach i did not fully test yet because with a lot of layers this gets messy really quickly but i will post the outcome when i try that. best k