2
\$\begingroup\$

After playing games like Star Wars Battlefront & GTA 5 I was wondering how dev's implement Color Correction in their Engines. I know that this can be done through the use of 3D LUT's but I was wondering if there are any other ways to do this. A good example of this would be in GTA 5 when a Characters special ability is triggered the colors on screen have a tint applied to them which over a period of 2 seconds the intensity of the effect gradually increases.

https://www.youtube.com/watch?v=LNGF7J3y5_Y

If someone can explain how this is done/ implemented that would be great.

\$\endgroup\$
4
\$\begingroup\$

Color correction is commonly done through post processing shaders. Basically first you render the scene to a framebuffer, then draw a fullscreen quad that has a shader that takes that framebuffer and applies some effects on it. This is how color correction, bloom, dof, motionblur etc. are done these days.

Here is a simple GLSL shader performing gamma correction.

uniform sampler2D framebuffer;
uniform vec2 resolution;

void main()
{
    //Read the framebuffer
    vec4 inColor = texture2D(framebuffer, gl_FragCoord.xy / resolution);
    float gamma = 2.2;
    //Gamma correct
    gl_FragColor = vec4(pow(inColor.rgb, vec3(1.0/gamma)), 1);
}
\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.