#line 1 "unknown"

#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\Prism.fx"
#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShadeUI.fxh"
#line 22 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\Prism.fx"
#line 24
uniform int Aberration <        ui_type = "slider"; 
ui_label = "Aberration scale in pixels";
ui_min = -48; ui_max = 48;
> = 6;
#line 29
uniform float Curve <      ui_type = "slider"; 
ui_label = "Aberration curve";
ui_min = 0.0; ui_max = 4.0; ui_step = 0.01;
> = 1.0;
#line 34
uniform bool Automatic <
ui_label = "Automatic sample count";
ui_tooltip = "Amount of samples will be adjusted automatically";
ui_category = "Performance";
ui_category_closed = true;
> = true;
#line 41
uniform int SampleCount <        ui_type = "slider"; 
ui_label = "Samples";
ui_tooltip = "Amount of samples (only even numbers are accepted, odd numbers will be clamped)";
ui_min = 6; ui_max = 32;
ui_category = "Performance";
> = 8;
#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShade.fxh"
#line 50
namespace ReShade
{
#line 61
static const float AspectRatio = 1608 * (1.0 / 960);
static const float2 PixelSize = float2((1.0 / 1608), (1.0 / 960));
static const float2 ScreenSize = float2(1608, 960);
#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 53 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\Prism.fx"
#line 56
float3 Spectrum(float Hue)
{
float Hue4 = Hue * 4.0;
float3 HueColor = abs(Hue4 - float3(1.0, 2.0, 1.0));
HueColor = saturate(1.5 - HueColor);
HueColor.xz += saturate(Hue4 - 3.5);
HueColor.z = 1.0 - HueColor.z;
return HueColor;
}
#line 67
sampler SamplerColor
{
Texture = ReShade::BackBufferTex;
AddressU = MIRROR;
AddressV = MIRROR;
};
#line 74
void ChromaticAberrationPS(float4 vois : SV_Position, float2 texcoord : TexCoord, out float3 BluredImage : SV_Target)
{
#line 77
float Aspect =  (1608 * (1.0 / 960));
#line 79
float Pixel = (1.0 / 960);
#line 83
float Samples = Automatic ? max(6.0, 2.0 * ceil(abs(Aberration) * 0.5) + 2.0) : floor(SampleCount * 0.5) * 2.0;
#line 85
Samples = min(Samples,  48 );
#line 87
float Sample = 1.0 / Samples;
#line 90
float2 RadialCoord = texcoord - 0.5;
RadialCoord.x *= Aspect;
#line 94
float Mask = pow(2.0 * length(RadialCoord) * rsqrt(Aspect * Aspect + 1.0), Curve);
#line 96
float OffsetBase = Mask * Aberration * Pixel * 2.0;
#line 99
if(abs(OffsetBase) < Pixel) BluredImage = tex2D(SamplerColor, texcoord).rgb;
else
{
BluredImage = 0.0;
for (float P = 0.0; P < Samples; P++)
{
float Progress = P / Samples;
float Offset = OffsetBase * (Progress - 0.5) + 1.0;
#line 109
float2 Position = RadialCoord / Offset;
#line 111
Position.x /= Aspect;
#line 113
Position += 0.5;
#line 116
BluredImage += Spectrum(Progress) * tex2Dlod(SamplerColor, float4(Position, 0.0, 0.0)).rgb;
}
BluredImage *= 2.0 / Samples;
}
}
#line 127
technique ChromaticAberration < ui_label = "Chromatic Aberration"; >
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ChromaticAberrationPS;
}
}

