alpha, and cc.brightness.ip.jxs

    Jan 20 2013 | 1:16 am
    masters of gl, please step forward...
    i work with three layers of grayscale live video all rendered into the same window, some with alpha.
    before rendering, i need to adjust brightness and contrast (same for all layers) which i do via and the cc.brightness/contrast.ip.jxs shaders.
    now, this works well until i aply this to a video with alpha - if i do, the alpha is not transparent any more but displayed as solid grey.
    if i bypass the two, it works as it should. did i do anything wrong or do these shaders simply not support alpha?
    (and what would i do then?)
    if you look at the patch attached, the middle one is the problem.
    apart i am wondering if there is a neater way to program this anyway... currently, i use six slabs for basically just adjusting brightness and contrast which does seem somewhat excessive...
    any help highly appreciated!!

    • Jan 21 2013 | 7:57 pm
      hm... maybe i should phrase my question different...: the most elegant solution to all of the above i can imagine would be something like an "adjustment layer".. so like in photoshop or avid or any of these programs a layer, which just sits on top and changes the contrast/brightness of all layers below. is anything like that possible in gl-world?
      i tried it with an empty videoplane @layer 10 but that does not have any effect...
      best and thanks!
    • Jan 21 2013 | 8:51 pm
      if you take a look at the cc.contrast shader, you see that the alpha value is ignored when sampling the input texture.
      your options are to either edit the shader or reapply your alpha channel with something like the cc.alphaglue shader.
      probably the best option is to use and the supplied gen file @gen brcosa
      if you look at that gen patcher, you see that the alpha channel is passed on unaffected.
    • Jan 24 2013 | 12:30 am
      you can try this......
      this is a modified version of the cc.brcosa.jxs.... hope it can help you...
    • Jan 24 2013 | 12:40 am
      hm, that seem all to be good options!
      i solved it for the time being by just doing the alphablending on the cpu-side with jit.alphablend before going to gpu-land but i will give that definitely a try!!
      thank you guys so much!
    • Feb 10 2013 | 4:18 pm
      just for the record:
      since i do not work in argb but just greyscale+alpha (2 planes only), did not get alphaglue to work and the conversion to argb via jit.pack is slowing things down quite a bit, in the end i went a third way - which works surprinsingly well: i simply process alpha and image separately (jit.unpack) and bring them together in the end by loading the alpha to a texture (@colormode intensity) and then append this to the baselayer video plane (pretty much like with the other alphalayer in the patch above). performance wise this seems to be the most efficient way - at least in my patch.