alpha, jit.gl.slab and cc.brightness.ip.jxs
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 jit.gl.slab 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 jit.gl.slabs, 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!!
karl
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!
k
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 jit.gl.pix and the supplied gen file @gen brcosa
if you look at that gen patcher, you see that the alpha channel is passed on unaffected.
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!
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.
best
k