I’ve been tweaking the zoomDistort code, and have added seperate zooming for the Red, Green and Blue channels.
The zoom kernel code is very similar to the zoomRGB FX, with a couple of extra lines added to handle the brightness values from the input image.
/*
Zoom kernel courtesy of Vidvox
http://vidvox.net/phpBB2/viewtopic.php?t=1785&sid=1c5efa0005881bf0dc59f84b3498a7ed
*/
kernel vec4 tb_zoomDistort_RGB(sampler Image, sampler Distortion, vec2 Center, float Level, float DistLevel)
{
vec2 loc;
vec2 modifiedCenter;
Center.x = Center.x / 2.0;
Center.y = Center.y / 2.0;
vec4 pix = sample(Distortion, samplerCoord(Distortion));
float zoomR = Level + (pix.r * DistLevel);
float zoomG = Level + (pix.g * DistLevel);
float zoomB = Level + (pix.b * DistLevel);
loc = destCoord();
loc = samplerTransform(Image, loc);
modifiedCenter = samplerTransform(Image, Center);
vec2 locR = (loc – modifiedCenter) * (1.0 / zoomR) + modifiedCenter;
vec2 locG = (loc – modifiedCenter) * (1.0 / zoomG) + modifiedCenter;
vec2 locB = (loc – modifiedCenter) * (1.0 / zoomB) + modifiedCenter;
vec4 pix;
pix.r = sample(Image, locR).r;
pix.g = sample(Image, locG).g;
pix.b = sample(Image, locB).b;
pix.a = 1.0;
return pix;
}
Currently, the controls are a bit, well, uncontrollable. I’ll have to work out some sensible scaling for them at some point (maybe with some exponential sliders).