GarageGames/Torque3D — pull request #862 by Azaezel (2014-10-24 13:33:31+00:00)
Title: linear gamma correction

source:
implements an MFT_Imposter shadergen feature used to filter out imposter captures and glows. otherwise when loading an albedo/diffuse texture, shadergen will insert a tex2DLinear method call to colorcorrect the loaded result

script:
the previous gamma correction slider operated closer to a brightness slider. This has been updated to correct for monitor gamma, and an actual brightness / contrast pair added.

shader:
gamma correction consists of a first and last step.
-- first: return float4(pow(abs(sampl.rgb), 2.2), sampl.a); to feed the coloration into the lighting calculations
present in torque.hlsl/glsl
-- last: color.rgb = pow( abs(color.rgb), OneOverGamma ); to turn the color range back into normal monitor color space
present in the HDR shader-chain's finalPassCombineP.hlsl/glsl, and gammaP.hlsl which the engine falls back to if the HDR postfx is disabled

short term impact: what-you-see-is-what-you-get coloration from texture tool to engine. (also brings hdr and non-hdr coloration much closer.)

long term impact: vital to correct calculations once the PBR track is fully engaged.

*special note* you may notice a few extra spaces in terrFeatureGLSL.cpp and terrFeatureHLSL.cpp. leave them. they're due to cutting out an if-switch used by deferred shading that will be put back.