forked from crosire/reshade-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LiftGammaGain.fx
53 lines (43 loc) · 1.17 KB
/
LiftGammaGain.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
/**
* Lift Gamma Gain version 1.1
* by 3an and CeeJay.dk
*/
uniform float3 RGB_Lift <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "RGB Lift";
ui_tooltip = "Adjust shadows for Red, Green and Blue.";
> = float3(1.0, 1.0, 1.0);
uniform float3 RGB_Gamma <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "RGB Gamma";
ui_tooltip = "Adjust midtones for Red, Green and Blue.";
> = float3(1.0, 1.0, 1.0);
uniform float3 RGB_Gain <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "RGB Gain";
ui_tooltip = "Adjust highlights for Red, Green and Blue.";
> = float3(1.0, 1.0, 1.0);
#include "ReShade.fxh"
float3 LiftGammaGainPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
// -- Lift --
color = color * (1.5 - 0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
color = saturate(color); // Is not strictly necessary, but does not cost performance
// -- Gain --
color *= RGB_Gain;
// -- Gamma --
color = pow(color, 1.0 / RGB_Gamma);
return saturate(color);
}
technique LiftGammaGain
{
pass
{
VertexShader = PostProcessVS;
PixelShader = LiftGammaGainPass;
}
}