forked from crosire/reshade-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChromaticAberration.fx
39 lines (34 loc) · 1.13 KB
/
ChromaticAberration.fx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Chromatic Aberration
* by Christian Cann Schuldt Jensen ~ CeeJay.dk
*
* Distorts the image by shifting each color component, which creates color artifacts similar to those in a very cheap lens or a cheap sensor.
*/
uniform float2 Shift <
ui_type = "drag";
ui_min = -10; ui_max = 10;
ui_tooltip = "Distance (X,Y) in pixels to shift the color components. For a slightly blurred look try fractional values (.5) between two pixels.";
> = float2(2.5, -0.5);
uniform float Strength <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
> = 0.5;
#include "ReShade.fxh"
float3 ChromaticAberrationPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color, colorInput = tex2D(ReShade::BackBuffer, texcoord).rgb;
// Sample the color components
color.r = tex2D(ReShade::BackBuffer, texcoord + (ReShade::PixelSize * Shift)).r;
color.g = colorInput.g;
color.b = tex2D(ReShade::BackBuffer, texcoord - (ReShade::PixelSize * Shift)).b;
// Adjust the strength of the effect
return lerp(colorInput, color, Strength);
}
technique CA
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ChromaticAberrationPass;
}
}