Custom Filter

in these papers you can find more information on my works on blender game engine

Blender Game  Engine » 2D Filter » Custom Filter



Custom Filters

Custom filters give you the ability to define your own 2d filter using GLSL. its usage is the same as built-in filters, but you must select "Custom Filter" in 2D Filter actuator, then write shader program into Text Editor and then place shader script name on actuator. see Fig 1.

Fig 1. Custom Filter

In Fig 1. you can see GLSL shader program for blue Sepia filter in Text Editor, and Custom Filter actuator that uses this shader program.

OpenGL Shading Language (GLSL)

See GLSL specification on

Also you can use these uniform variables in your shader program:

  • bgl_RenderedTexture
    • usage: uniform sampler2D bgl_RenderedTexture;
  • bgl_TextureCoordinateOffset
    • usage: uniform vec2 bgl_TextureCoordinateOffset[9];
  • bgl_TextureWidth
    • usage: uniform float bgl_TextureWidth;
  • bgl_TextureHeight
    • usage: uniform float bgl_TextureHeight;


Example Shader Program 

 Blue Sepia Example:


uniform sampler2D bgl_RenderedTexture;
  void main(void)
    vec4 texcolor = texture2D(bgl_RenderedTexture,

    float gray = dot(texcolor.rgb,

                     vec3(0.299, 0.587, 0.114));
    gl_FragColor = vec4(gray * vec3(0.8, 1.0, 1.2),


Custom Filter Gallery

If you write a custom shader program, you can send it to me via email.