Brightness and Contrast Filter

I just wrote my first 2d filter which sets the brightness and contrast of the screen. If your game looks dull and pale you can add the filter and set the values in the script to your liking.



uniform sampler2D bgl_RenderedTexture;


const float contrast = 2;    //1 is no contrast.
const float brightness = 1.5;    //1 is no brightness


void main()
{
    vec4 color = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
    
    color = ((color-1)*max(contrast,0));
    color = color+brightness;
     
    gl_FragColor = color; 
}   

Nice Work !:smiley:

super simple 2d filters are something I have been needing to sutudy to understand GLSL :smiley:

this + maniuplating the brightness = bloom pulsing.

you can tell me were you learn exactly?

Glsl isn’t exclusive to the BGE so you can just search for glsl programming examples and tutorials and just apply them to the BGE.

Thanks now my game looks even better, its like fake HDR but without the dynamic lighting.