Bläddra i källkod

add back in brightness and contrast controls, as well as the capacity to shut tonemapping off

Azaezel 6 år sedan
förälder
incheckning
338e66b7e6

+ 11 - 1
Templates/Full/game/shaders/common/postFx/hdr/finalPassCombineP.hlsl

@@ -101,7 +101,17 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
    sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g;
    sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b;
 
-   sample = float4(tonemap(sample.rgb),1);
+   // Apply contrast
+   sample.rgb = ((sample.rgb - 0.5f) * Contrast) + 0.5f;
+
+   // Apply brightness
+   //sample.rgb += Brightness;
+
+   //tonemapping - TODO fix up eye adaptation
+   if ( g_fEnableToneMapping > 0.0f )
+   {
+      sample.rgb = tonemap(sample.rgb);
+   }
 
    return sample;
 }

+ 14 - 2
Templates/Full/game/shaders/common/postFx/hdr/gl/finalPassCombineP.glsl

@@ -38,7 +38,7 @@ uniform float g_fMiddleGray;
 uniform float g_fWhiteCutoff;
 
 uniform float g_fEnableBlueShift;
-uniform vec3 g_fBlueShiftColor; 
+uniform vec3 g_fBlueShiftColor;
 
 uniform float g_fBloomScale;
 
@@ -92,7 +92,7 @@ void main()
       // Lerp between current color and blue, desaturated copy
       vec3 rodColor = dot( _sample.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor;
       _sample.rgb = mix( _sample.rgb, rodColor, coef );
-	  
+
       rodColor = dot( bloom.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor;
       bloom.rgb = mix( bloom.rgb, rodColor, coef );
    }
@@ -105,5 +105,17 @@ void main()
    _sample.g = texture( colorCorrectionTex, _sample.g ).g;
    _sample.b = texture( colorCorrectionTex, _sample.b ).b;
 
+   // Apply contrast
+   _sample.rgb = ((_sample.rgb - 0.5f) * Contrast) + 0.5f;
+
+   // Apply brightness
+   //_sample.rgb += Brightness;
+
+   //tonemapping - TODO fix up eye adaptation
+   if ( g_fEnableToneMapping > 0.0f )
+   {
+      _sample.rgb = tonemap(_sample.rgb);
+   }
+
    OUT_col = _sample;
 }