GLSL Chromakey
-
Hey there,
I just finished messing around with getting some glsl chromakey / green-screen shader code I found at shadertoy.com working in Izzy and thought I might share it here.
You can copy and paste the code below into a new GLSL actor. You can also use this user actor:Chromakey++.iua3
// this was converted into izziease from a bit of code "Created by jackdavenport in 2015-05-30"
// it may be found here https://www.shadertoy.com/view...// ISADORA_FLOAT_PARAM(thresh, thsh, 0.0, 1.0, 1.0, "Threshold amount.");
uniform float thresh;
// ISADORA_FLOAT_PARAM(padd, padd, 0.0, 1.0, 1.0, "Padding amount.");
uniform float padd;
// ISADORA_FLOAT_PARAM(red_color, red, 0.0, 1.0, 1.0, "Amount of red to key out.");
// ISADORA_FLOAT_PARAM(green_color, gren, 0.0, 1.0, 1.0, "Amount of green to key out.");
// ISADORA_FLOAT_PARAM(blue_color, blue, 0.0, 1.0, 1.0, "Amount of blue to key out.");uniform float red_color;
uniform float green_color;
uniform float blue_color;void mainImage ( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec4 greenScreen = vec4(red_color, green_color, blue_color, 1.0);
vec4 color = texture(iChannel0, uv);
vec3 diff = color.xyz - greenScreen.xyz;
float fac = smoothstep(thresh-padd,thresh+padd, dot(diff,diff));
color = mix(color, texture(iChannel1, uv), 1.-fac);
fragColor = color;
} -
It'd be great if you could add this to the TroikaTronix Add-Ons page, as it's the ideal place to archive useful tools for the community.
Best wishes,Woland
-
I would love to do that, was not sure if it is up to snuff I suppose and so shied away from that - but will do.
-alex