[Shader Library] Dream Vision Post Processing Filter (GLSL)



Shader Library - Dream Vision PostFX



This new shader, from Geeks3D’s shader library, shows the kind of vision one may have in a dream…

You can grab the GLSL shader and the demo here:
Download GXL - Dream Vision PostFX
This demo requires GeeXLab and does not use Python so you can use the version of GeeXLab without Python.

Unzip the source code somewhere, start GeeXLab and drop the file Dream_Vision_Demo.xml in GeeXLab.

Shader desription

Language: OpenGL 2 – GLSL

Type: Post processing filter.

Inputs

  • sceneTex (sampler2D): the final scene image.

Ouputs: color buffer

Shader code:

[Vertex_Shader]
void main()
{	
  gl_Position = ftransform();		
  gl_TexCoord[0] = gl_MultiTexCoord0;
}
[Pixel_Shader]
uniform sampler2D sceneTex; // 0
void main ()
{
  vec2 uv = gl_TexCoord[0].xy;
  vec4 c = texture2D(sceneTex, uv);
  
  c += texture2D(sceneTex, uv+0.001);
  c += texture2D(sceneTex, uv+0.003);
  c += texture2D(sceneTex, uv+0.005);
  c += texture2D(sceneTex, uv+0.007);
  c += texture2D(sceneTex, uv+0.009);
  c += texture2D(sceneTex, uv+0.011);

  c += texture2D(sceneTex, uv-0.001);
  c += texture2D(sceneTex, uv-0.003);
  c += texture2D(sceneTex, uv-0.005);
  c += texture2D(sceneTex, uv-0.007);
  c += texture2D(sceneTex, uv-0.009);
  c += texture2D(sceneTex, uv-0.011);

  c.rgb = vec3((c.r+c.g+c.b)/3.0);
  c = c / 9.5;
  gl_FragColor = c;
}			



Geeks3D.com

↑ Grab this Headline Animator