forked from crosire/reshade-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonochrome.fx
39 lines (32 loc) · 784 Bytes
/
Monochrome.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
/**
* Monochrome
* by Christian Cann Schuldt Jensen ~ CeeJay.dk
*
* Monochrome removes color and makes everything black and white.
*/
uniform float3 Coefficients <
ui_type = "color";
> = float3(0.21, 0.72, 0.07);
uniform float ColorSaturation <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
> = 0.0;
#include "ReShade.fxh"
float3 MonochromePass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
// Calculate monochrome
float3 grey = dot(Coefficients, color);
// Adjust the remaining saturation
color = lerp(grey, color, ColorSaturation);
// Return the result
return saturate(color);
}
technique Monochrome
{
pass
{
VertexShader = PostProcessVS;
PixelShader = MonochromePass;
}
}