I'm trying to create a shader that cyclically turns an image to black and white and then again to colorful. And I have written a code that turns the image to B&W:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 xy = fragCoord.xy / iResolution.xy;
vec4 texColor = texture(iChannel0, xy);
fragColor = (texColor + texColor.yzxw + texColor.zxyw) / 3.;
//fragColor = texColor; This is for turning back to colorful
}
So the problem is that I do not understand how to cycle this process. I think I should consider using ITime, but I'm not sure about