-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathReShade.fx
More file actions
113 lines (99 loc) · 3.4 KB
/
ReShade.fx
File metadata and controls
113 lines (99 loc) · 3.4 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
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
#define region //I use this to have code regions similar to C#'s #region/#endregion in Notepad++
#if !defined(__RESHADE__) || __RESHADE__ < 20000
#pragma message "Oudated version of ReShade, certain shaders may not work properly\n"
#endif
#include "MassFX\KeyCodes.h"
#include "MassFX\Other.cfg"
#define STR(value) #value
#define STE(value) STR(value)
#pragma reshade screenshot_key RESHADE_SCREENSHOT_KEY
#pragma reshade screenshot_format RESHADE_SCREENSHOT_FORMAT
#pragma reshade screenshot_path "\\MassFX\\Screenshots"
#if RESHADE_SHOW_FPS
#pragma reshade showfps
#endif
#if RESHADE_SHOW_CLOCK
#pragma reshade showclock
#endif
#if RESHADE_SHOW_STATISTICS
#pragma reshade showstatistics
#endif
#if RESHADE_SHOW_TOGGLE_MESSAGES
#pragma reshade showtogglemessage
#endif
namespace ReShade {
#ifdef region // Global Variables
static const float AspectRatio = BUFFER_WIDTH * BUFFER_RCP_HEIGHT;
static const float2 PixelSize = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
static const float2 ScreenSize = float2(BUFFER_WIDTH, BUFFER_HEIGHT);
uniform float Timer < source = "timer"; >;
uniform float FrameTime < source = "frametime"; >;
uniform float2 MouseCoords < source = "mousepoint"; >;
#endif
#ifdef region// Global Textures and Samplers
texture BackBufferTex : COLOR;
texture DepthBufferTex : DEPTH;
texture OriginalColorTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
#if RESHADE_DEPTH_LINEARIZATION
texture LinearizedDepthTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R32F; };
#else
texture LinearizedDepthTex : DEPTH;
#endif
sampler BackBuffer { Texture = BackBufferTex; };
sampler OriginalColor { Texture = OriginalColorTex; };
sampler OriginalDepth { Texture = DepthBufferTex; };
sampler LinearizedDepth { Texture = LinearizedDepthTex; };
#endif
#ifdef region // Full-screen triangle vertex shader
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 texcoord : TEXCOORD)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? 2.0 : 0.0;
pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
#endif
#ifdef region// Color and depth buffer copy and linearization shaders
float4 PS_CopyBackBuffer(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
return tex2D(BackBuffer, texcoord);
}
#if RESHADE_DEPTH_LINEARIZATION
void PS_DepthLinearization(float4 vpos : SV_Position, float2 texcoord : TEXCOORD0, out float depth : SV_Target)
{
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
texcoord.y = 1.0 - texcoord.y;
#endif
depth = tex2D(OriginalDepth, texcoord).x;
#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
const float C = 0.01;
depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
depth = 1.0 - depth;
#endif
const float N = 1.0;
depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);
}
#endif
#endif
}
technique Setup < enabled = true; >
{
pass ColorBackup
{
VertexShader = ReShade::VS_PostProcess;
PixelShader = ReShade::PS_CopyBackBuffer;
RenderTarget = ReShade::OriginalColorTex;
}
#if RESHADE_DEPTH_LINEARIZATION
pass DepthLinearization
{
VertexShader = ReShade::VS_PostProcess;
PixelShader = ReShade::PS_DepthLinearization;
RenderTarget = ReShade::LinearizedDepthTex;
}
#endif
}
#define EFFECT(name) STE(MassFX\Shaders\name.fx)
#include STE(MassFX\Config.cfg)
#include STE(MassFX\Order.cfg)