#line 1 "unknown"

#line 1 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\VR_CAS_Color.fx"
#line 57
uniform float CASContrast <
ui_category = "Sharpening";
ui_type = "drag";
ui_label = "Contrast Adaptation";
ui_tooltip = "Adjusts the range the shader adapts to high contrast (0 is not all the way off).  Higher values = more high contrast sharpening.";
ui_min = 0.0; ui_max = 1.0;
> = 0.5;
#line 65
uniform float MaxDelta <
ui_category = "Sharpening";
ui_type = "drag";
ui_label = "Max color delta";
ui_tooltip = "The maximum amount the sharpened color value may differ from its original value. Lower values may help reduce oversharpening in scenes with small details.";
ui_min = 0.0; ui_max = 1.0;
> = 1.0;
#line 73
uniform float Sharpening <
ui_category = "Sharpening";
ui_type = "drag";
ui_label = "Sharpening intensity";
ui_tooltip = "Adjusts sharpening intensity by averaging the original pixels to the sharpened result.  1.0 is the unmodified default.";
ui_min = 0.0; ui_max = 1.0;
> = 1.0;
#line 1 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShade.fxh"
#line 50
namespace ReShade
{
#line 61
static const float AspectRatio = 3224 * (1.0 / 1923);
static const float2 PixelSize = float2((1.0 / 3224), (1.0 / 1923));
static const float2 ScreenSize = float2(3224, 1923);
#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 81 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\VR_CAS_Color.fx"
texture TexColor : COLOR;
sampler sTexColor {Texture = TexColor; SRGBTexture = true;};
#line 85
float3 CASPass(float4 vpos, float2 texcoord)
{
#line 92
float3 a =  tex2D(sTexColor, texcoord, int2(-1, -1)).rgb;
float3 b =  tex2D(sTexColor, texcoord, int2(0, -1)).rgb;
float3 c =  tex2D(sTexColor, texcoord, int2(1, -1)).rgb;
float3 d =  tex2D(sTexColor, texcoord, int2(-1, 0)).rgb;
#line 97
float3 g =  tex2D(sTexColor, texcoord, int2(-1, 1)).rgb;
#line 110
float3 e = tex2D(sTexColor, texcoord).rgb;
float3 f =  tex2D(sTexColor, texcoord, int2(1, 0)).rgb;
#line 113
float3 h =  tex2D(sTexColor, texcoord, int2(0, 1)).rgb;
float3 i =  tex2D(sTexColor, texcoord, int2(1, 1)).rgb;
#line 123
float3 mnRGB = min(min(min(d, e), min(f, b)), h);
float3 mnRGB2 = min(mnRGB, min(min(a, c), min(g, i)));
mnRGB += mnRGB2;
#line 127
float3 mxRGB = max(max(max(d, e), max(f, b)), h);
float3 mxRGB2 = max(mxRGB, max(max(a, c), max(g, i)));
mxRGB += mxRGB2;
#line 132
float3 rcpMRGB = rcp(mxRGB);
float3 ampRGB = saturate(min(mnRGB, 2.0 - mxRGB) * rcpMRGB);
#line 136
ampRGB = rsqrt(ampRGB);
#line 138
float peak = -3.0 * CASContrast + 8.0;
float3 wRGB = -rcp(ampRGB * peak);
#line 141
float3 rcpWeightRGB = rcp(4.0 * wRGB + 1.0);
#line 146
float3 window = (b + d) + (f + h);
float3 outColor = saturate((window * wRGB + e) * rcpWeightRGB);
outColor = e + clamp(outColor - e, -MaxDelta, MaxDelta);
#line 150
return lerp(e, outColor, Sharpening);
}
#line 155
uniform float Contrast <
ui_category = "Color adjustments";
ui_type = "drag";
ui_label = "Contrast";
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float Brightness <
ui_category = "Color adjustments";
ui_type = "drag";
ui_label = "Brightness";
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
uniform float Saturation <
ui_category = "Color adjustments";
ui_type = "drag";
ui_label = "Color saturation";
ui_min = 0.0; ui_max = 2.0;
> = 1.0;
#line 174
float3 VRColorAdjustmentPass(float3 color)
{
color = lerp(0.5, color, Contrast) + (Brightness - 1);
if (Saturation != 1.0)
{
float intensity = dot(float3(0.2125, 0.7154, 0.0721), color.rgb);
color = lerp(intensity, color, Saturation);
}
return color;
}
#line 186
uniform float SharpeningRadius <
ui_category = "Performance";
ui_type = "drag";
ui_label = "Sharpening radius";
ui_tooltip = "The radius from the eye center at which sharpening gets disabled. You can lower this for a minor performance improvement.";
ui_min = 0.0; ui_max = 1.5;
> = 1.0;
#line 194
uniform bool SingleImage <
ui_category = "Performance";
ui_label = "Single image for both eyes";
ui_tooltip = "For the radius setting to work properly, you need to specify if both eye views are contained in a single image or submitted as separate images. If the sharpening effect looks wrong, toggle this setting and see if it improves.";
> = true;
#line 201
float3 VRSharpenColorPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float2 fromCenter;
if (SingleImage)
{
fromCenter = float2(texcoord.x < 0.5 ? 0.25 : 0.75, 0.5) - texcoord;
fromCenter.x *= 2;
} else
fromCenter = float2(0.5, 0.5) - texcoord;
float distSqr = dot(fromCenter, fromCenter) * 4;
#line 212
float3 color;
if (Sharpening != 0 && distSqr < SharpeningRadius*SharpeningRadius)
color = CASPass(vpos, texcoord);
else
color = tex2D(sTexColor, texcoord).rgb;
#line 218
return VRColorAdjustmentPass(color);
}
#line 221
technique VRSharpenColor <
ui_label = "VR Image Sharpening and Color adjustment";
>
{
pass
{
VertexShader = PostProcessVS;
PixelShader = VRSharpenColorPass;
SRGBWriteEnable = true;
}
}

