(GLSL) Volumetric Light / Radial Blur Post Processing Filter (for webcam / video)



GLSL Hacker, volumetric light post processing filter, GeForce GTX 780


While I was browsing Shadertoy for the new version of MadShaders, I stumbled on this very cool post processing effect. This kind of volumetric light effect (actually a radial blur effect) is perfectly suited to add a nice illuminated touch to the webcam output.



GLSL Hacker, volumetric light post processing filter



I quickly coded a small GLSL Hacker demo that exploits this postfx filter with the webcam. The demo is available in the moon3d/gl-210-webcam/ folder of the code sample pack (download the DEV version, same thing for GLSL Hacker). Just load the demo_webcam_lua_win32_postfx_03.xml in GLSL Hacker and you are ready to play with it. This demo is available for Windows only.



Here is the GLSL fragment shader:

uniform sampler2D tex0;
uniform vec3 resolution; // screen resolution
#define T texture2D(tex0,.5+(p.xy*=.992))
void main() 
{
  vec3 p = gl_FragCoord.xyz/resolution-.5;
  vec3 o = T.rbb;
  for (float i=0.;i<100.;i++) 
    p.z += pow(max(0.,.5-length(T.rg)),2.)*exp(-i*.08);
  gl_FragColor=vec4(o*o+p.z,1);
}



GLSL Hacker, volumetric light post processing filter



More post processing filters are listed in the Shader Library.




Geeks3D.com

↑ Grab this Headline Animator