RGB with Luminance Correction?

Hi there,

Beginner here where GLSL is concerned. I’m having a bit of an issue writing a simple shader to adjust color temperature. I see a number of examples of this on shadertoy, but can’t seem to adapt to my application. Essentially, I’m applying RGB corrections to each value, which, on the extreme end, darkens the overall image output. I know I need to do a luminance correction for this, but I’m not at all certain of what the formula to calculate it should be.

Thanks in advance for the help.