Just discovered it’s possible to apply an effect iteratively in a CIKernel, by editing the JavaScript filter function. I’m going to have some fun with iterative glitching effects, I think!
This code simply applies a color addition on each pass, so if you feed in a black image, and set Color to a dark grey, the color of the output image get pregressively lighter as you turn up the number of Iterations.
Kernel Code:
kernel vec4 additionEffect(sampler image, __color Color)
{
return sample(image, samplerCoord(image)) + Color;
}
JavaScript from bottom panel (with ‘Edit Filter Function’ option turned on):
function __image main(__image image, __color Color, __index Iterations) {
var result = additionEffect.apply(image.definition, null, image, Color);
for(i = 0; i < Iterations; i++) {
result = additionEffect.apply(result.definition, null, result, Color);
}
return result;
}
You could iteratively apply some kind of distortion effect, using different values for each pass using the same method. You could even use the JS Math.random() function to to randomise the values being sent to each iteration of you CIKernel function, for added glitchy fun.
Sadly I don’t have time to play with this at the moment, but I can see some cool implementations, including maybe the possibility of doing something like this in a single CIFilter.