I have restored the old gamma correction and moved the new gamma correction to two new cvars.
It would be great if some of these cvars die out by 2.07 release, but for testing purposes all the options are available now.
The new version is committed in svn rev 15320, only TDM developers have access to it as of now.
If you are TDM developer and the fate of gamma correction is important to you, please spend some time testing all these cvars in the near future.
So in this new version we have:
1) r_gamma and r_brightness work exactly as before.
They are configured when you move sliders in main menu.
They affect the very-very final picture, even affect the main menu itself.
They work via modifying the device gamma ramp, which is i) quite annoying if TDM crashes, and ii) can easily lead to color banding.
The formula is: color -> pow(brightness * color, 1 / gamma);
2) r_ambientMinLevel and r_ambientGamma are the new parameters for "soft gamma" discussed here.
They can only be configured by modifying the cvars in console yet (sliders to be discussed).
They affect only the ambient lighting, so they don't work in menu and they don't affect light sources behavior.
They work by applying conversion formula at the end of ambient shader, so they i) don't mess with your Windows settings, and ii) do not exhibit any color banding.
The formula is: color -> pow(minLevel + (1-minLevel) * color, 1 / gamma)
The r_ambientMinLevel cvar linearly transforms the colors so that everything which normally receives zero light will have color = minLevel.
The r_ambientGamma cvar has exactly the same mathemetical effect as the old r_gamma (but it affects only ambient lighting).
Note that most of these ways are not intended to be used together.
E.g. You should use gamma correction either global (r_gamma) or for ambient only (r_ambientGamma).
You probably should not combine r_ambientMinLevel and r_ambientGamma together.
So it is like: use r_gamma + r_brightness as before, use r_ambientGamma only, or use r_ambientMinLevel only.
But of course you can use several types of adjustment at the same time if you want, they'll combine rather nicely.