How to determine GPU with Alpha-Channel?
-
Hi All!!
Is there is someone who know how to detect that GPU stream consists alpha-Channel?I need change mode projector blending mode to transparent for all transparent/partically-transparent GPU-streams.Thanks in advance. -
I can't think of any prebuilt actors that can offer you this feature.
The only thought I have, is that a GLSL shader could be used to strip away the RGB video values, and leave only the Alpha.Then the 'calc brightness' actor could be used to determine if there are alpha values, and how much.I haven't seen a shader that does this, although I would think this would be a rather simple shader. -
Thanks, DusX !
As I've understand, you suggest to use Shader to calculate Alpha-brightness? Good idea!I'll try this and post here if it will be successful.Do you mean Isadora doesnt have any build-in actors to isolate alpha-channel? -
Exactly. There are no built-in actors to isolate alpha (correct me please if I am wrong).A Shader may be a good option for adding this feature.Since shaders are expected to output video, simply output the alpha as a black and white video, then use the 'calc brightness' actor to give you a numerical reading.Please let me know if you succeed... -
Dear @Mikhail + All,
Good idea Ryan. Here's the shader code to strip out RGB and give you only alpha. Then you could use the CalcBrightness actor after the GLSL Shader actor. If the brightness ever goes below 100, then there is alpha.Best Wishes,Markuniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform sampler2D tex0;
void main(void) {
vec4 c0 = texture2D(tex0, gl_TexCoord[0].xy);
gl_FragColor = vec4(1.0, c0.a, c0.a, c0.a);
}
-
@ mark @Mikhail
If a you want a B&W representation of alpha layer (not red and white), the code is this one (c0.a also in red layer)uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform sampler2D tex0;
void main(void) {
vec4 c0 = texture2D(tex0, gl_TexCoord[0].xy);
gl_FragColor = vec4(c0.a, c0.a, c0.a, c0.a);
}
Best wishes,
Jacques
-
Thanks!! I can make use of this as well. :)Does this warrant a KB article?
-
@jhoepffner - Mine made black and white? It was just not transparent. Yes? (Slightly confused by your addition and the mention of red.)
-
When I use yours on film with alpha mask, the mask is in red (not in black).Because you wright "gl_FragColor = vec4(1.0, c0.a, c0.a, c0.a);" with 1.0 in red valueThe value of the alpha mask is not important now, because you dont use it anymore so you can write "gl_FragColor = vec4(c0.a, c0.a, c0.a, c0.a);" or "gl_FragColor = vec4(c0.a, c0.a, c0.a, 0.0);"I join a patch with the result with your proposition and my correctionAll the best,Jacques -
I just got to testing this method today.. and its perfect!
-
To : [DusX](http://troikatronix.com/troikatronixforum/profile/149/DusX) , [jhoepffner](http://troikatronix.com/troikatronixforum/profile/15/jhoepffner) , [mark](http://troikatronix.com/troikatronixforum/profile/2/mark) , Wow! Thanks Guys! You're cool!A lot of thanks! I try to use this shader also in my patch.