/* 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: Qamera3DFloatingQubes.qtzThis kernel calculates the alpha of the image based on the distance from the center. The mask fades out according to the
input_fade_power.
kernel vec4 msBlackRadialPowerMask(sampler input_image, float input_max_radius, float input_fade_power)
{
vec2 image_size = samplerSize(input_image);
vec2 image_center = image_size*0.5;
vec2 pixel_coord = samplerCoord(input_image);
float pel_distance = distance(pixel_coord,image_center);
vec4 pixel = sample(input_image, pixel_coord);
float distance_ratio = clamp(pel_distance/input_max_radius,0.0,1.0);
float alpha = clamp(1.0-(pow(distance_ratio,input_fade_power)),0.0,1.0);
pixel.a = alpha;
return pixel;
}