Tweaked HDR/ambient

This commit is contained in:
Robert Beckebans 2015-12-25 12:03:59 +01:00
parent a501209c8b
commit 6aa87784a3
3 changed files with 28 additions and 15 deletions

View file

@ -47,14 +47,14 @@ struct PS_OUT
#define USE_TECHNICOLOR 1 // [0 or 1]
#define Technicolor_Amount 0.6 // [0.00 to 1.00]
#define Technicolor_Amount 0.5 // [0.00 to 1.00]
#define Technicolor_Power 4.0 // [0.00 to 8.00]
#define Technicolor_RedNegativeAmount 0.88 // [0.00 to 1.00]
#define Technicolor_GreenNegativeAmount 0.88 // [0.00 to 1.00]
#define Technicolor_BlueNegativeAmount 0.88 // [0.00 to 1.00]
#define USE_VIBRANCE 1
#define Vibrance 0.5 // [-1.00 to 1.00]
#define Vibrance 0.5 // [-1.00 to 1.00]
#define Vibrance_RGB_Balance float3( 1.0, 1.0, 1.0 )
#define USE_FILMGRAIN 1

View file

@ -43,13 +43,13 @@ struct PS_OUT
float4 color : COLOR;
};
float A = 0.15;
float B = 0.50;
float C = 0.10;
float D = 0.20;
float E = 0.02;
float F = 0.30;
float W = 11.2;
float A = 0.22; // shoulder strength
float B = 0.3; // linear strength
float C = 0.10; // linear angle
float D = 0.20; // toe strength
float E = 0.01; // toe numerator
float F = 0.30; // toe denominator
float W = 11.2; // linear white point
float3 Uncharted2Tonemap( float3 x )
{
@ -98,16 +98,29 @@ void main( PS_IN fragment, out PS_OUT result )
float Ymax = hdrMaxLuminance;
#if 1
#if 0
// advanced Reinhard operator, artistically desirable to burn out bright areas
//float L = Yr * ( 1.0 + Yr / ( Ymax * Ymax ) ) / ( 1.0 + Yr );
float L = Yr * ( 1.0 + Yr / ( Ymax * Ymax ) ) / ( 1.0 + Yr );
color.rgb *= L;
// http://freespace.virgin.net/hugo.elias/graphics/x_posure.htm
// exponential tone mapper that is very similar to the Uncharted one
// very good in keeping the colors natural
float L = 1.0 - exp( -Yr );
color.rgb *= L;
//float exposure = 1.0;
//float L = ( 1.0 - exp( -Yr * exposure ) );
//color.rgb *= L;
// Kodak filmic tone mappping, includes gamma correction
//float3 rgb = max( float3( 0 ), color.rgb - float3( 0.004 ) );
//color.rgb = rgb * ( float3( 0.5 ) + 6.2 * rgb ) / ( float3( 0.06 ) + rgb * ( float3( 1.7 ) + 6.2 * rgb ) );
// http://iwasbeingirony.blogspot.de/2010/04/approximating-film-with-tonemapping.html
//const float cutoff = 0.025;
//color.rgb += ( cutoff * 2.0 - color.rgb ) * saturate( cutoff * 2 - color.rgb ) * ( 0.25 / cutoff ) - cutoff;
//color.rgb = color.rgb * ( float3( 0.5 ) + 6.2 * color.rgb ) / ( float3( 0.06 ) + color.rgb * ( float3( 1.7 ) + 6.2 * color.rgb ) );
#else
// Uncharted 2 tone mapper but looks weird :(
// Uncharted 2 tone mapping based on Kodak film curve
//float exposure = ( hdrKey / hdrAverageLuminance ) * 0.2;
//float exposure = Yr * 1.0;

View file

@ -258,7 +258,7 @@ idCVar r_ldrContrastThreshold( "r_ldrContrastThreshold", "1.1", CVAR_RENDERER |
idCVar r_ldrContrastOffset( "r_ldrContrastOffset", "3", CVAR_RENDERER | CVAR_FLOAT, "" );
idCVar r_useFilmicPostProcessEffects( "r_useFilmicPostProcessEffects", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "apply several post process effects to mimic a filmic look" );
idCVar r_forceAmbient( "r_forceAmbient", "0.3", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.4f );
idCVar r_forceAmbient( "r_forceAmbient", "0.2", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.4f );
// RB end
const char* fileExten[3] = { "tga", "png", "jpg" };