// ISADORA_PLUGIN_NAME("TT LaPlacian Emboss") // ISADORA_PLUGIN_DESC("Imposes an LaPlacian emboss filter on the source image. Increase the 'intensity' and 'spread' inputs to get more unusual effects.") // ISADORA_FLOAT_PARAM(intensity, inte, 0.0, 500.0, 100.0, "Intensity of the Matrix."); // ISADORA_FLOAT_PARAM(spread, sprd, -32.0, 32.0, 1.0, "The distance between the pixel samples. A value of 1.0 is normal; higher values will produce more intense effects."); // ISADORA_FLOAT_PARAM(bias, bias, 0.0, 100.0, 50.0, "Offsets the brightness of the output making it lighter or darker."); uniform float intensity; uniform float spread; uniform float bias; uniform vec2 resolution; uniform sampler2D tex0; void main() { vec2 xy = gl_TexCoord[0].xy; float texelWidth = 1.0 / resolution.x; float texelHeight = 1.0 / resolution.y; float sx = spread * texelWidth; float sy = spread * texelHeight; vec2 widthStep = vec2(sx, 0.0); vec2 heightStep = vec2(0.0, sy); vec2 widthHeightStep = vec2(sx, sy); vec2 widthNegativeHeightStep = vec2(sx, -sy); vec4 textureColor = texture2D(tex0, xy); float inten = intensity / 100.0; vec3 bot_left = texture2D(tex0, xy - widthHeightStep).rgb; vec3 bot_center = texture2D(tex0, xy - heightStep).rgb; vec3 bot_right = texture2D(tex0, xy + widthNegativeHeightStep).rgb; vec3 ctr_left = texture2D(tex0, xy - widthStep).rgb; vec3 ctr_center = texture2D(tex0, xy).rgb; vec3 ctr_right = texture2D(tex0, xy + widthStep).rgb; vec3 top_left = texture2D(tex0, xy - widthNegativeHeightStep).rgb; vec3 top_center = texture2D(tex0, xy + heightStep).rgb; vec3 top_right = texture2D(tex0, xy + widthHeightStep).rgb; vec3 resultColor; resultColor = top_left * 0.5 * inten + top_center * 1.0 * inten + top_right * 0.5 * inten; resultColor += ctr_left * 1.0 * inten + ctr_center * -6.0 * inten + ctr_right * 1.0 * inten; resultColor += bot_left * 0.5 * inten + bot_center * 1.0 * inten + bot_right * 0.5 * inten; resultColor += bias/100.0; gl_FragColor = vec4(resultColor, textureColor.a); }