/* Published by b-l-a-c-k-o-p.com
Copyright (c) 2007-2008
http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
*/
SAMPLE: Qamera80sGreenGrid3.qtzThis takes normal inputs [0...1] for both x and y, and computes new image in texture "phase" space.
kernel vec4 msBlackTexPhase(sampler input_image, float input_phase_x, float input_phase_y)
{
float phase_x = clamp(input_phase_x,0.0,1.0)-0.5;
float phase_y = clamp(input_phase_y,0.0,1.0)-0.5;
vec2 image_size = samplerSize(input_image);
vec2 pixel_coord = samplerCoord(input_image);
vec2 normal_coord = pixel_coord/image_size;
normal_coord += vec2(phase_x,phase_y);
vec2 pel_coord = mod(normal_coord*image_size,image_size);
vec4 pel = sample(input_image, pel_coord);
return pel;
}