#line 1 "unknown"

#line 1 "D:\Games\Kenshi\reshade-shaders\Shaders\FilmicPass.fx"
#line 1 "D:\Games\Kenshi\reshade-shaders\Shaders\ReShadeUI.fxh"
#line 7 "D:\Games\Kenshi\reshade-shaders\Shaders\FilmicPass.fx"
#line 9
uniform float Strength <      ui_type = "slider"; 
ui_min = 0.05; ui_max = 1.5;
ui_toolip = "Strength of the color curve altering";
> = 0.85;
#line 14
uniform float Fade <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 0.6;
ui_tooltip = "Decreases contrast to imitate faded image";
> = 0.4;
uniform float Contrast <      ui_type = "slider"; 
ui_min = 0.5; ui_max = 2.0;
> = 1.0;
uniform float Linearization <      ui_type = "slider"; 
ui_min = 0.5; ui_max = 2.0;
> = 0.5;
uniform float Bleach <      ui_type = "slider"; 
ui_min = -0.5; ui_max = 1.0;
ui_tooltip = "More bleach means more contrasted and less colorful image";
> = 0.0;
uniform float Saturation <      ui_type = "slider"; 
ui_min = -1.0; ui_max = 1.0;
> = -0.15;
#line 32
uniform float RedCurve <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float GreenCurve <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float BlueCurve <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float BaseCurve <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.5;
#line 45
uniform float BaseGamma <      ui_type = "slider"; 
ui_min = 0.7; ui_max = 2.0;
ui_tooltip = "Gamma Curve";
> = 1.0;
uniform float EffectGamma <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 0.65;
uniform float EffectGammaR <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float EffectGammaG <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float EffectGammaB <      ui_type = "slider"; 
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
#line 62
uniform float3 LumCoeff <
> = float3(0.212656, 0.715158, 0.072186);
#line 1 "D:\Games\Kenshi\reshade-shaders\Shaders\ReShade.fxh"
#line 50
namespace ReShade
{
#line 61
static const float AspectRatio = 1360 * (1.0 / 768);
static const float2 PixelSize = float2((1.0 / 1360), (1.0 / 768));
static const float2 ScreenSize = float2(1360, 768);
#line 67
texture BackBufferTex : COLOR;
texture DepthBufferTex : DEPTH;
#line 70
sampler BackBuffer { Texture = BackBufferTex; };
sampler DepthBuffer { Texture = DepthBufferTex; };
#line 74
float GetLinearizedDepth(float2 texcoord)
{
#line 79
texcoord.x /=  1;
texcoord.y /=  1;
#line 84
texcoord.x -=  0 / 2.000000001;
#line 89
texcoord.y +=  0 / 2.000000001;
#line 91
float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x *  1;
#line 100
const float N = 1.0;
depth /= 1000.0 - depth * (1000.0 - N);
#line 103
return depth;
}
}
#line 108
void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? 2.0 : 0.0;
position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
#line 65 "D:\Games\Kenshi\reshade-shaders\Shaders\FilmicPass.fx"
#line 67
float3 FilmPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 B = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 G = B;
float3 H = 0.01;
#line 73
B = saturate(B);
B = pow(B, Linearization);
B = lerp(H, B, Contrast);
#line 77
float A = dot(B.rgb, LumCoeff);
float3 D = A;
#line 80
B = pow(abs(B), 1.0 / BaseGamma);
#line 82
float a = RedCurve;
float b = GreenCurve;
float c = BlueCurve;
float d = BaseCurve;
#line 87
float y = 1.0 / (1.0 + exp(a / 2.0));
float z = 1.0 / (1.0 + exp(b / 2.0));
float w = 1.0 / (1.0 + exp(c / 2.0));
float v = 1.0 / (1.0 + exp(d / 2.0));
#line 92
float3 C = B;
#line 94
D.r = (1.0 / (1.0 + exp(-a * (D.r - 0.5))) - y) / (1.0 - 2.0 * y);
D.g = (1.0 / (1.0 + exp(-b * (D.g - 0.5))) - z) / (1.0 - 2.0 * z);
D.b = (1.0 / (1.0 + exp(-c * (D.b - 0.5))) - w) / (1.0 - 2.0 * w);
#line 98
D = pow(abs(D), 1.0 / EffectGamma);
#line 100
float3 Di = 1.0 - D;
#line 102
D = lerp(D, Di, Bleach);
#line 104
D.r = pow(abs(D.r), 1.0 / EffectGammaR);
D.g = pow(abs(D.g), 1.0 / EffectGammaG);
D.b = pow(abs(D.b), 1.0 / EffectGammaB);
#line 108
if (D.r < 0.5)
C.r = (2.0 * D.r - 1.0) * (B.r - B.r * B.r) + B.r;
else
C.r = (2.0 * D.r - 1.0) * (sqrt(B.r) - B.r) + B.r;
#line 113
if (D.g < 0.5)
C.g = (2.0 * D.g - 1.0) * (B.g - B.g * B.g) + B.g;
else
C.g = (2.0 * D.g - 1.0) * (sqrt(B.g) - B.g) + B.g;
#line 118
if (D.b < 0.5)
C.b = (2.0 * D.b - 1.0) * (B.b - B.b * B.b) + B.b;
else
C.b = (2.0 * D.b - 1.0) * (sqrt(B.b) - B.b) + B.b;
#line 123
float3 F = lerp(B, C, Strength);
#line 125
F = (1.0 / (1.0 + exp(-d * (F - 0.5))) - v) / (1.0 - 2.0 * v);
#line 127
float r2R = 1.0 - Saturation;
float g2R = 0.0 + Saturation;
float b2R = 0.0 + Saturation;
#line 131
float r2G = 0.0 + Saturation;
float g2G = (1.0 - Fade) - Saturation;
float b2G = (0.0 + Fade) + Saturation;
#line 135
float r2B = 0.0 + Saturation;
float g2B = (0.0 + Fade) + Saturation;
float b2B = (1.0 - Fade) - Saturation;
#line 139
float3 iF = F;
#line 141
F.r = (iF.r * r2R + iF.g * g2R + iF.b * b2R);
F.g = (iF.r * r2G + iF.g * g2G + iF.b * b2G);
F.b = (iF.r * r2B + iF.g * g2B + iF.b * b2B);
#line 145
float N = dot(F.rgb, LumCoeff);
float3 Cn = F;
#line 148
if (N < 0.5)
Cn = (2.0 * N - 1.0) * (F - F * F) + F;
else
Cn = (2.0 * N - 1.0) * (sqrt(F) - F) + F;
#line 153
Cn = pow(max(Cn,0), 1.0 / Linearization);
#line 155
float3 Fn = lerp(B, Cn, Strength);
return Fn;
}
#line 159
technique FilmicPass
{
pass
{
VertexShader = PostProcessVS;
PixelShader = FilmPass;
}
}

