/*{ "CREDIT": "by VIDVOX", "ISFVSN": "2", "CATEGORIES": [ "Halftone Effect" ], "INPUTS": [ { "NAME": "inputImage", "TYPE": "image" }, { "NAME": "sharpness", "TYPE": "float", "MIN": 0.0, "MAX": 10.0, "DEFAULT": 1.0 }, { "NAME": "offset", "TYPE": "float", "MIN": 0.0, "MAX": 1.0, "DEFAULT": 0.0 }, { "NAME": "angle", "TYPE": "float", "MIN": 0.0, "MAX": 1.0, "DEFAULT": 0.5 }, { "NAME": "scale", "TYPE": "float", "MIN": 0.0, "MAX": 2.0, "DEFAULT": 1.0 }, { "NAME": "colorize", "TYPE": "float", "MIN": 0.0, "MAX": 1.0, "DEFAULT": 0.0 }, { "NAME": "fill", "TYPE": "float", "MIN": 0.0, "MAX": 1.0, "DEFAULT": 0.0 } ] }*/ #if __VERSION__ <= 120 varying vec2 left_coord; varying vec2 right_coord; varying vec2 above_coord; varying vec2 below_coord; varying vec2 lefta_coord; varying vec2 righta_coord; varying vec2 leftb_coord; varying vec2 rightb_coord; #else in vec2 left_coord; in vec2 right_coord; in vec2 above_coord; in vec2 below_coord; in vec2 lefta_coord; in vec2 righta_coord; in vec2 leftb_coord; in vec2 rightb_coord; #endif const float tau = 6.28318530718; float pattern() { float s = sin(tau * angle * 0.5); float c = cos(tau * angle * 0.5); vec2 tex = isf_FragNormCoord * RENDERSIZE; vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * max(scale,0.001); float d = point.y; return ( fill + sin(d + offset * tau) ) * 4.0; } void main() { vec4 color = IMG_THIS_PIXEL(inputImage); vec4 colorL = IMG_NORM_PIXEL(inputImage, left_coord); vec4 colorR = IMG_NORM_PIXEL(inputImage, right_coord); vec4 colorA = IMG_NORM_PIXEL(inputImage, above_coord); vec4 colorB = IMG_NORM_PIXEL(inputImage, below_coord); vec4 colorLA = IMG_NORM_PIXEL(inputImage, lefta_coord); vec4 colorRA = IMG_NORM_PIXEL(inputImage, righta_coord); vec4 colorLB = IMG_NORM_PIXEL(inputImage, leftb_coord); vec4 colorRB = IMG_NORM_PIXEL(inputImage, rightb_coord); vec4 final = color + sharpness * (8.0*color - colorL - colorR - colorA - colorB - colorLA - colorRA - colorLB - colorRB); float average = ( final.r + final.g + final.b ) / 3.0; final = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a ); final = mix (color * final, final, 1.0-colorize); gl_FragColor = final; }