-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathColShift.fx
More file actions
69 lines (58 loc) · 1.51 KB
/
ColShift.fx
File metadata and controls
69 lines (58 loc) · 1.51 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "ReShade.fxh"
uniform float HardRedCutoff <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Hard Red Cutoff";
> = float(0.85);
uniform float SoftRedCutoff <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Soft Red Cutoff";
> = float(0.6);
uniform float HardGreenCutoff <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Hard Green Cutoff";
> = float(0.6);
uniform float SoftGreenCutoff <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Soft Green Cutoff";
> = float(0.85);
uniform float BlueCutoff <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Blue Cutoff";
> = float(0.3);
uniform bool Yellow <
ui_type = "checkbox";
ui_label = "Yellow instead of Green";
> = false;
float3 ColShiftPass(float4 position: SV_Position, float2 texcoord: TexCoord): SV_Target
{
float3 input = tex2D(ReShade::BackBuffer, texcoord).rgb;
if (input.r >= HardRedCutoff && input.g <= HardGreenCutoff && input.b <= BlueCutoff)
{
if (Yellow)
return input.rrb;
else
return input.grb;
}
if (input.r >= SoftRedCutoff && input.g <= SoftGreenCutoff && input.b <= BlueCutoff)
{
float alphaR = (input.r - SoftRedCutoff) / (HardRedCutoff - SoftRedCutoff);
if (Yellow)
return lerp(input.rgb, input.rrb, alphaR);
else
return lerp(input.rgb, input.grb, alphaR);
}
return input;
}
technique ColShift
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ColShiftPass;
}
}