Alphablur Shader

Dec 14, 2008 at 12:18am

Alphablur Shader

Hi,

I’ve read the Jitter tutorials I could find on writing your own shader but still find myself stumped. Would it be fairly easy to convert blur shader included with the Jitter install to a blur that would effect only the alpha channel. I understand that I need to somehow address a vec4 texture and then somehow target only the alpha channel for the effects of the blur. I eventually want to take on the “orange” book but feel I should probably learn some “C” or “Processing” first since I’ve never done any text coding before. If anyone knows of any tutorials that would help me write an alphablur shader or can offer some pointers about how to adapt the shader below I would be very grateful.

Thanks,
S.



blur the alpha channel only

Width of filter


< ![CDATA[
/*
* Derek Gerstmann – derek@cycling74.com
* Copyright 2005 – Cycling ’74
*
* GLSL fragment program for a simple 5 tap blur filter.
*
*/

uniform sampler2DRect image;

varying vec2 texcoord11;
varying vec2 texcoord00;
varying vec2 texcoord02;
varying vec2 texcoord20;
varying vec2 texcoord22;

void main()
{
vec4 blur;

blur = texture2DRect(image, texcoord11);
blur += texture2DRect(image, texcoord00);
blur += texture2DRect(image, texcoord02);
blur += texture2DRect(image, texcoord20);
blur += texture2DRect(image, texcoord22);

gl_FragColor = 0.2 * blur;
}
]]>

#41338

You must be logged in to reply to this topic.