I had a brainwave while adding a simple zoom effect (using code from the guys at Vidvox) to another effect:
What would happen if I used the brightness value from the input image, or another image, to alter the zoom level on a per-pixel basis?
The results (with a few extra tweaks and additions) are intriguing.
The hastily slapped-together CIKernel code looks like this:
kernel vec4 tb_zoomDistort(sampler Image, sampler Distortion, vec2 Center, float Level, float DistLevel)
Center.x = Center.x / 2.0;
Center.y = Center.y / 2.0;
vec4 pix = sample(Distortion, samplerCoord(Distortion));
float offset = ((pix.r + pix.g + pix.b) / 3.0) * DistLevel;
float Level = Level + offset;
loc = destCoord();
loc = samplerTransform(Image, loc);
modifiedCenter = samplerTransform(Image, Center);
loc = (loc – modifiedCenter) * (1.0 / Level) + modifiedCenter;
return sample(Image, loc);