I'm trying to figure out the implementation/algorithm behind Adobe After Effects' Lumetri Color white balance controls to create a similar or approximate version in a GLSL shader. Specifically, I'm interested in the white balance color picker, temperature and tint controls.
I know WHAT these do but I don't know exactly HOW they work. I can get a crude approximation playing with the LAB color space but the devil is in the details. I'm looking to answer these questions (with an implementation or an algorithm):
- How does the color picker translate an arbitrary RGB value into Temperature and Tint values (algorithm/implementation)
- Given arbitrary Temperature and Tint values, how does one transform the value of a random RGB pixel to be "white balance" corrected in the same way as it works in AE (algorithm/implementation)?
- What do the range of values for tint/temp from -300 to 300 represent?
What I know\tried
I've researched the theory behind white balance. R Neil Haugen from the adobe forum says
Temp is Red vs. Blue: slide to the left, the Red channel white-point drops as the Blue channel white point rises; slide to the right, the Red channel white point rises as the Blue channel white point drops.
Tint is Green vs. ganged Red and Blue: slide to the left, the Green channel white point rises while the Red and Blue channel white points drop; slide to the right, the Green channel white point drops while the Red and Blue channel white points rise.
I can clearly see this in my experiment:
This makes sense to me as it's similar to how WB works in cameras, where the X axis is blue\red (Temperature) and the Y axis is green\magenta (tint):
I realized that this somehow correlates to the LAB color space, where it looks like these axes are on the diagonals when A is plotted against B. I think it's diagonals because the XY axes are defined to be as blue-yellow and red-green.
The center of LAB space is at coordinates (0,0), so so I figured maybe there's a way to take an arbitrary RGB color, convert it to LAB space and then move it along the proper horizontal axes for Temperature\Tint. Not exactly sure about how to proceed from here, or what sources can I can consult with.
I did find these Shadertoy implementations, but looks like they only deals with temperature and not tint values:
https://www.shadertoy.com/view/4sc3D7
https://www.shadertoy.com/view/Mtjczz
Looking forwards for pointers at implementations/algorithms



