Help with Pixel Shader effect for brightness and contrast

Posted by Hans on Stack Overflow See other posts from Stack Overflow or by Hans
Published on 2009-06-03T13:22:10Z Indexed on 2010/06/12 5:33 UTC
Read the original article Hit count: 238

Filed under:

What is a simple pixel shader script effect to apply brightness and contrast?

I found this one, but it doesn't seem to be correct:

sampler2D input : register(s0);
float brightness : register(c0);
float contrast : register(c1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
    float4 color = tex2D(input, uv); 
    float4 result = color;
    result = color + brightness;
    result = result * (1.0+contrast)/1.0;

    return result;
}

thanks!

© Stack Overflow or respective owner

Related posts about shaders