forked from UTwelve/Reshade-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HackUImask.fx
124 lines (101 loc) · 2.94 KB
/
HackUImask.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// HackUImask
// by UTwelve
// work for FF14, Other game...can try...so subtle,so hack
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "ReShade.fxh"
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
uniform float BlackMaskPower <
ui_category = "Amount";
ui_label = "BlackMaskAmount";
ui_type = "slider";
ui_min = 0.0; ui_max = 2.0; ui_step = 0.1;
> = 1.0;
/*
uniform float ClampMax <
ui_category = "Clamp";
ui_label = "ClampMax";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0; ui_step = 1;
> = 1.0;
//+*/
uniform float Alpha <
ui_category = "Clamp";
ui_label = "Alpha";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0; ui_step = 0.1;
> = 0.1;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
texture HackUIMask_Tex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
sampler HackUIMask_Sampler { Texture = HackUIMask_Tex; };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void PS_HackUIMask(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
{
float4 UIMask = tex2D(ReShade::BackBuffer, texcoord).a ;
float4 MaskS = step(Alpha, UIMask) ;
color = tex2D(ReShade::BackBuffer, texcoord) ;
color.a = MaskS.a ;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void PS_HackUIRestore(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
{
color = tex2D(HackUIMask_Sampler, texcoord);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void PS_HackUICut(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
{
float4 GameScreen = tex2D(HackUIMask_Sampler, texcoord).a ;
float4 CutS = step(Alpha, GameScreen) ;
color.rgb = 0 ;
color.a = GameScreen.a * BlackMaskPower ;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//////////////////////////////////////////////
technique HackUIMask <
ui_tooltip = "Keep UI";
enabled = true;
>
{
pass PS_HackUIMask
{
VertexShader = PostProcessVS;
PixelShader = PS_HackUIMask;
RenderTarget = HackUIMask_Tex;
}
}
//////////////////////////////////////////////
technique HackUIRestore <
ui_tooltip = "Restore UI";
enabled = true;
>
{
pass
{
VertexShader = PostProcessVS;
PixelShader = PS_HackUIRestore;
ClearRenderTargets = false;
BlendEnable = true;
SrcBlend = SRCALPHA;
DestBlend = INVSRCALPHA;
}
}
//////////////////////////////////////////////
technique HackUICut <
ui_tooltip = "black mask,prevent UI from affecting other fx";
enabled = true;
>
{
pass
{
VertexShader = PostProcessVS;
PixelShader = PS_HackUICut;
ClearRenderTargets = false;
BlendEnable = true;
SrcBlend = SRCALPHA;
DestBlend = INVSRCALPHA;
}
}