Hi,
I use Magic a lot for sending visuals directly to LED strips through Processing.
Processing has good libraries for both spout and syphon, but they have a quirky behavior if they receive video with a transparent background. They will have trails and get stuck because all the pixels do not update with each frame, it only updates the pixels that change.
You can fix this in the Processing sketches by adding a black background to each frame, but this also dulls the entire signal for some reason. Dim images will no longer show up.
The fix in Magic I've found is to always have a black polygon covering the whole bottom layer. This way everything comes up as it should.
Resolume has a simple checkbox for each output to add a black background. This fixes things the same way without having to add an extra layer.
So I figured this may be an easy thing to add to Magic as well so that things can work easier right of the gate without having to add a workaround.
A small issue, but one that also should be easy to implement!
"Add Black Background" option
Re: "Add Black Background" option
Use this GLShader to remove the alpha:
Code: Select all
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec4 tex = texture(iChannel0,uv);
fragColor = vec4(tex.xyz, 1.0);
}
Re: "Add Black Background" option
Yup that sounds easy enough .So I figured this may be an easy thing to add to Magic as well so that things can work easier right of the gate without having to add a workaround.
Re: "Add Black Background" option
Thanks both for the responses!
Question for Sadler: I'm still a little confused on implementing your fix. But I'd like to try it.. Where do you place that function?
Question for Sadler: I'm still a little confused on implementing your fix. But I'd like to try it.. Where do you place that function?
Re: "Add Black Background" option
Save the code into a text file (e.g. RemoveAlpha.txt) and load the text file into the GLShader module.
Re: "Add Black Background" option
Sadler's suggestion definitely works, though your black polygon idea is also perfectly reasonable (and may be slightly faster).