It looks like you're new here. If you want to get involved, click one of these buttons!
I dug in my old computer and found an old project I had. I had made a basic color correction shader that worked well. I wanted to share it years ago I had already given up on the game project and I couldn't find the latest source code. It not's the latest version I made.
So here's the shader code, it may or may not work as is in a game but it can be useful anyways. Basically it's like the color balance filter in Photoshop, Krita, the Gimp... You put more or less red, green, blue on the dark or light parts of the image. In image editing software the brightness is divided in 3, dark, mid and light, while in my shader I divided it in 2.
A basic setting that works well with this kind of shader is to put more blue in the dark parts and more orange in the light parts. You have to change correcdark and correclight parameters for that, they represent colors.
The final shader had a transition between 2 color corrections but I couldn't find the source code on my computer. The goal was for the color correction to change when the player moved to different parts of the level.
It works by putting the shader on all objects. The energy vector is to even the brightness or each color.
Some things are commented out, I don't remember why but if the shader doesn't work as is try to uncomment things.
In the scene
[[email protected]]
at the end of the scene
[ColorGrading]
ShaderList = ColorGradingShader
[ColorGradingShader]
Code = "
#define energy vec3(0.7, 0.41, 0.89)
#define correcdark vec3(0.0, 0.0, 1.0)
#define correclight vec3(1.0, 0.0, 0.0)
void main()
{
gl_FragColor = texture2D(Texture,gl_TexCoord[0]);
gl_FragColor.rgb += mix( correcdark * energy, correclight * energy, dot(vec3(0.3, 0.59, 0.11), texture2D(Texture,gl_TexCoord[0]).rgb));
}
"
ParamList = Texture ; # correcdark # correclight
;correcdark = (0.0, 0.0, 1.0)
;correclight = (1.0, 0.0, 0.0)
Comments
@grumly thanks for sharing this. This might be nice to add to the wiki if you don't mind me doing that?
Sure but first make sure it works.
Yep will do. Shouldn't take much to fix it if so.
Hi @grumly, nice to see you around almost 8 years later!
Thanks for taking the time to share your color correction shader with us.