├── Reshade
└── reshade-shaders
│ ├── Textures
│ ├── AreaLUT.png
│ ├── iMMERSE_bluenoise.png
│ └── iMMERSE_rtgi_dict.png
│ └── Shaders
│ ├── AstrayFX
│ ├── BloomingHDR.fx
│ ├── TobiiEye_FreePie_AstrayFX.py
│ ├── OneShot
│ │ └── Limbo_Mod.fx
│ ├── Trails.fx
│ └── DLAA_Plus.fx
│ ├── iMMERSE
│ ├── MartysMods
│ │ ├── mmx_debug.fxh
│ │ ├── mmx_deferred.fxh
│ │ ├── mmx_input.fxh
│ │ ├── mmx_random.fxh
│ │ ├── mmx_camera.fxh
│ │ ├── mmx_qmc.fxh
│ │ ├── mmx_depth.fxh
│ │ ├── mmx_texture.fxh
│ │ ├── mmx_colorspaces.fxh
│ │ ├── mmx_fft.fxh
│ │ ├── mmx_global.fxh
│ │ ├── mmx_bxdf.fxh
│ │ └── mmx_math.fxh
│ └── MartysMods_SHARPEN.fx
│ ├── Custom
│ ├── ClipboardX.fx
│ ├── Vignette2.fx
│ ├── AnamFlare.fx
│ └── KeepUIX.fx
│ ├── Vignette.fx
│ ├── CAS.fx
│ └── brussell
│ └── EyeAdaption.fx
├── AuroraShade
└── reshade-shaders
│ └── Shaders
│ ├── AstrayFX
│ ├── BloomingHDR.fx
│ ├── TobiiEye_FreePie_AstrayFX.py
│ ├── OneShot
│ │ └── Limbo_Mod.fx
│ └── Trails.fx
│ └── Custom
│ ├── ClipboardX.fx
│ ├── Vignette2.fx
│ ├── AnamFlare.fx
│ └── KeepUIX.fx
├── Shaders&Effects.md
├── README.md
└── README_EN.md
/Reshade/reshade-shaders/Textures/AreaLUT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MapleRecall/reshade-FFXIV-EnhancedGamePlay/HEAD/Reshade/reshade-shaders/Textures/AreaLUT.png
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/AstrayFX/BloomingHDR.fx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MapleRecall/reshade-FFXIV-EnhancedGamePlay/HEAD/Reshade/reshade-shaders/Shaders/AstrayFX/BloomingHDR.fx
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Textures/iMMERSE_bluenoise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MapleRecall/reshade-FFXIV-EnhancedGamePlay/HEAD/Reshade/reshade-shaders/Textures/iMMERSE_bluenoise.png
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Textures/iMMERSE_rtgi_dict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MapleRecall/reshade-FFXIV-EnhancedGamePlay/HEAD/Reshade/reshade-shaders/Textures/iMMERSE_rtgi_dict.png
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/AstrayFX/BloomingHDR.fx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MapleRecall/reshade-FFXIV-EnhancedGamePlay/HEAD/AuroraShade/reshade-shaders/Shaders/AstrayFX/BloomingHDR.fx
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_debug.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | namespace Debug
21 | {
22 |
23 | float3 viridis(float t)
24 | {
25 | const float3 c0 = float3( 0.2777273272234177, 0.005407344544966578, 0.3340998053353061);
26 | const float3 c1 = float3( 0.1050930431085774, 1.404613529898575, 1.384590162594685);
27 | const float3 c2 = float3(-0.3308618287255563, 0.214847559468213, 0.09509516302823659);
28 | const float3 c3 = float3(-4.634230498983486, -5.799100973351585, -19.33244095627987);
29 | const float3 c4 = float3( 6.228269936347081, 14.17993336680509, 56.69055260068105);
30 | const float3 c5 = float3( 4.776384997670288,-13.74514537774601, -65.35303263337234);
31 | const float3 c6 = float3(-5.435455855934631, 4.645852612178535, 26.3124352495832);
32 |
33 | return c0+t*(c1+t*(c2+t*(c3+t*(c4+t*(c5+t*c6)))));
34 | }
35 |
36 | } //namespace
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_deferred.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_global.fxh"
21 | #include "mmx_math.fxh"
22 |
23 | namespace Deferred
24 | {
25 | //normals, RG8 octahedral encoded XY = gbuffer normals, ZW = geometry normals
26 | texture NormalsTexV3 { Width = BUFFER_WIDTH_DLSS; Height = BUFFER_HEIGHT_DLSS; Format = RGBA16; };
27 | sampler sNormalsTexV3 { Texture = NormalsTexV3; MinFilter = POINT; MipFilter = POINT; MagFilter = POINT;};
28 |
29 | //motion vectors, RGBA16F, XY = delta uv, Z = confidence, W = depth because why not
30 | texture MotionVectorsTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RG16F; };
31 | sampler sMotionVectorsTex { Texture = MotionVectorsTex; };
32 |
33 | float3 get_normals(float2 uv)
34 | {
35 | float2 encoded = tex2Dlod(sNormalsTexV3, uv, 0).xy;
36 | return -Math::octahedral_dec(encoded); //fixes bugs in RTGI, positive z gives better precision
37 | }
38 |
39 | float3 get_geometry_normals(float2 uv)
40 | {
41 | float2 encoded = tex2Dlod(sNormalsTexV3, uv, 0).zw;
42 | return -Math::octahedral_dec(encoded);
43 | }
44 |
45 | float2 get_motion(float2 uv)
46 | {
47 | return tex2Dlod(sMotionVectorsTex, uv, 0).xy;
48 | }
49 |
50 | float4 get_motion_wide(float2 uv)
51 | {
52 | return tex2Dlod(sMotionVectorsTex, uv, 0);
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/AstrayFX/TobiiEye_FreePie_AstrayFX.py:
--------------------------------------------------------------------------------
1 | #To use this script load it up in FreePie and make sure you have Tobii Eye Tracker fully installed and Enabled.
2 |
3 | #Then make sure to start FreePie in Admin mode then run this script. Once that is done Move your head the full
4 | #length of your monitor so that it calibrates it's center. Then start your game with reshade and start my Shader.
5 | #Once in game and in SuperDepth3D's Menu use the Calibrate slider to reduce the ghosting in game to a tolerable
6 | #level. There should be a veary slight delay in tracking this is ok for now maybe it can be improved later.
7 |
8 | #Thank you and as always for more information head over to http://www.Depth3D.com
9 | #If you like to dontate please do at. https://www.buymeacoffee.com/BlueSkyDefender
10 |
11 | #Downloads Needed
12 | #https://andersmalmgren.github.io/FreePIE/
13 | #https://gaming.tobii.com/getstarted/
14 |
15 | #If you don't know what your doing don't adjust the script below this line.
16 | def map_tobii(n):
17 | IsLooking = tobiiEyeX.userPresence == "Present"
18 | Center = 4
19 | MC = Center * 2
20 |
21 | if (IsLooking): #and enabled):
22 | #yaw = rotobiiEyeX.yaw
23 | #roll = tobiiEyeX.roll
24 | #x = tobiiEyeX.averageEyePositionInMmX
25 | #y = tobiiEyeX.averageEyePositionInMmY
26 | #z = tobiiEyeX.averageEyePositionInMmZ
27 | x = tobiiEyeX.averageEyePositionNormalizedX * MC - Center
28 | y = tobiiEyeX.averageEyePositionNormalizedY * MC - Center
29 | z = round(tobiiEyeX.averageEyePositionNormalizedZ * MC)
30 | #x = tobiiEyeX.normalizedCenterDeltaX
31 | #y = tobiiEyeX.normalizedCenterDeltaY
32 | #x = tobiiEyeX.gazePointInPixelsX
33 | #y = tobiiEyeX.gazePointInPixelsY
34 | else :
35 | #yaw = 0
36 | #roll = 0
37 | x = 0
38 | y = 0
39 | z = 0
40 |
41 | #freePieIO[0].yaw = 0
42 | #freePieIO[0].pitch = 0
43 | #freePieIO[0].roll = 0
44 | freePieIO[0].x = x
45 | freePieIO[0].y = y
46 | freePieIO[0].z = z
47 |
48 | #diagnostics.watch(enabled)
49 | #diagnostics.watch(yaw)
50 | #diagnostics.watch(roll)
51 | diagnostics.watch(x)
52 | diagnostics.watch(y)
53 | diagnostics.watch(z)
54 |
55 | #Tobii update function
56 | def update():
57 | map_tobii(0)
58 |
59 | if starting:
60 | #enabled = True
61 | system.setThreadTiming(TimingTypes.HighresSystemTimer)
62 | system.threadExecutionInterval = 0
63 | tobiiEyeX.update += update
64 |
65 | #toggleA = keyboard.getPressed(Key.X)
66 |
67 | #if toggleA:
68 | #enabled = not enabled
69 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/AstrayFX/TobiiEye_FreePie_AstrayFX.py:
--------------------------------------------------------------------------------
1 | #To use this script load it up in FreePie and make sure you have Tobii Eye Tracker fully installed and Enabled.
2 |
3 | #Then make sure to start FreePie in Admin mode then run this script. Once that is done Move your head the full
4 | #length of your monitor so that it calibrates it's center. Then start your game with reshade and start my Shader.
5 | #Once in game and in SuperDepth3D's Menu use the Calibrate slider to reduce the ghosting in game to a tolerable
6 | #level. There should be a veary slight delay in tracking this is ok for now maybe it can be improved later.
7 |
8 | #Thank you and as always for more information head over to http://www.Depth3D.com
9 | #If you like to dontate please do at. https://www.buymeacoffee.com/BlueSkyDefender
10 |
11 | #Downloads Needed
12 | #https://andersmalmgren.github.io/FreePIE/
13 | #https://gaming.tobii.com/getstarted/
14 |
15 | #If you don't know what your doing don't adjust the script below this line.
16 | def map_tobii(n):
17 | IsLooking = tobiiEyeX.userPresence == "Present"
18 | Center = 4
19 | MC = Center * 2
20 |
21 | if (IsLooking): #and enabled):
22 | #yaw = rotobiiEyeX.yaw
23 | #roll = tobiiEyeX.roll
24 | #x = tobiiEyeX.averageEyePositionInMmX
25 | #y = tobiiEyeX.averageEyePositionInMmY
26 | #z = tobiiEyeX.averageEyePositionInMmZ
27 | x = tobiiEyeX.averageEyePositionNormalizedX * MC - Center
28 | y = tobiiEyeX.averageEyePositionNormalizedY * MC - Center
29 | z = round(tobiiEyeX.averageEyePositionNormalizedZ * MC)
30 | #x = tobiiEyeX.normalizedCenterDeltaX
31 | #y = tobiiEyeX.normalizedCenterDeltaY
32 | #x = tobiiEyeX.gazePointInPixelsX
33 | #y = tobiiEyeX.gazePointInPixelsY
34 | else :
35 | #yaw = 0
36 | #roll = 0
37 | x = 0
38 | y = 0
39 | z = 0
40 |
41 | #freePieIO[0].yaw = 0
42 | #freePieIO[0].pitch = 0
43 | #freePieIO[0].roll = 0
44 | freePieIO[0].x = x
45 | freePieIO[0].y = y
46 | freePieIO[0].z = z
47 |
48 | #diagnostics.watch(enabled)
49 | #diagnostics.watch(yaw)
50 | #diagnostics.watch(roll)
51 | diagnostics.watch(x)
52 | diagnostics.watch(y)
53 | diagnostics.watch(z)
54 |
55 | #Tobii update function
56 | def update():
57 | map_tobii(0)
58 |
59 | if starting:
60 | #enabled = True
61 | system.setThreadTiming(TimingTypes.HighresSystemTimer)
62 | system.threadExecutionInterval = 0
63 | tobiiEyeX.update += update
64 |
65 | #toggleA = keyboard.getPressed(Key.X)
66 |
67 | #if toggleA:
68 | #enabled = not enabled
69 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_input.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | //HDR input handling, as far as that's possible...
21 |
22 | #define BUFFER_COLOR_SPACE_WTF 0
23 | #define BUFFER_COLOR_SPACE_SRGB 1
24 | #define BUFFER_COLOR_SPACE_SCRGB 2
25 | #define BUFFER_COLOR_SPACE_ST2084 3 //PQ
26 | #define BUFFER_COLOR_SPACE_HLG 4 //Hybrid Log-Gamma - who actually uses that?
27 |
28 | /*=============================================================================
29 | Perceptual Quantizer
30 | =============================================================================*/
31 |
32 | //IN: non-linear signal value [0, 1]
33 | //OUT: linearized signal Y also in [0, 1] as we're not doing HDR scaling here!
34 | float3 pq_linearize(float3 E)
35 | {
36 | //using inverse values here for more accurate transform
37 | const float i_m1 = 6.27739463602;
38 | const float i_m2 = 0.0126833135157;
39 | const float c1 = 107.0/128.0;
40 | const float c2 = 2413.0/128.0;
41 | const float c3 = 2392.0/128.0;
42 |
43 | E = saturate(E);
44 | E = pow(E, i_m2);
45 | return pow(abs(max(0.0, E - c1) * rcp(c2 - c3 * E)), i_m1);
46 | }
47 |
48 | //IN: Y [0, 1]
49 | //OUT: nonlinear E [0, 1]
50 | float3 pq_delinearize(float3 Y)
51 | {
52 | const float m1 = 1305.0/8192.0;
53 | const float m2 = 2523.0/32.0;
54 | const float c1 = 107.0/128.0;
55 | const float c2 = 2413.0/128.0;
56 | const float c3 = 2392.0/128.0;
57 |
58 | Y = saturate(Y);
59 | Y = pow(Y, m1);
60 |
61 | float3 E = mad(Y, c2, c1) * rcp(mad(Y, c3, 1));
62 | return pow(abs(E), m2);
63 | }
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_random.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_math.fxh"
21 |
22 | namespace Random
23 | {
24 |
25 | //PG: found using hash prospector, bias 0.10704308166917044
26 | //if you copy it with those exact coefficients, I will know >:)
27 | uint uint_hash(uint x)
28 | {
29 | x ^= x >> 16;
30 | x *= 0x21f0aaad;
31 | x ^= x >> 15;
32 | x *= 0xd35a2d97;
33 | x ^= x >> 16;
34 | return x;
35 | }
36 |
37 | float uint_to_unorm(uint u)//32
38 | {
39 | return asfloat((u >> 9u) | 0x3f800000u) - 1.0;
40 | }
41 |
42 | float2 uint_to_unorm2(uint u)//16|16
43 | {
44 | return asfloat((uint2(u << 7u, u >> 9u) & 0x7fff80u) | 0x3f800000u) - 1.0;
45 | }
46 |
47 | float3 uint_to_unorm3(uint u)//11|11|10
48 | {
49 | return asfloat((uint3(u >> 9u, u << 2u, u << 13u ) & 0x7ff000u) | 0x3f800000u) - 1.0;
50 | }
51 |
52 | float4 uint_to_unorm4(uint u)//8|8|8|8
53 | {
54 | return asfloat((uint4(u >> 9u, u >> 1u, u << 7u, u << 15u) & 0x7f8000u) | 0x3f800000u) - 1.0;
55 | }
56 |
57 | float next1D(inout uint rng_state){rng_state = uint_hash(rng_state);return uint_to_unorm(rng_state);}
58 | float2 next2D(inout uint rng_state){rng_state = uint_hash(rng_state);return uint_to_unorm2(rng_state);}
59 | float3 next3D(inout uint rng_state){rng_state = uint_hash(rng_state);return uint_to_unorm3(rng_state);}
60 | float4 next4D(inout uint rng_state){rng_state = uint_hash(rng_state);return uint_to_unorm4(rng_state);}
61 |
62 | float2 boxmuller(float2 u)
63 | {
64 | float2 g; sincos(TAU * u.x, g.x, g.y);
65 | return g * sqrt(-2.0 * log(1 - u.y));
66 | }
67 |
68 | float3 boxmuller3D(float3 u)
69 | {
70 | float3 g; sincos(TAU * u.x, g.x, g.y);
71 | g.z = u.y * 2.0 - 1.0;
72 | g.xy *= sqrt(1.0 - g.z * g.z);
73 | return g * sqrt(-2.0 * log(u.z));
74 | }
75 |
76 | }
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_camera.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_global.fxh"
21 | #include "mmx_depth.fxh"
22 |
23 | #ifndef _MARTYSMODS_GLOBAL_FOV
24 | #define _MARTYSMODS_GLOBAL_FOV 60.0
25 | #endif
26 |
27 | //All sorts coordinate transforms for world/view/projection
28 |
29 | namespace Camera
30 | {
31 |
32 | float depth_to_z(float depth)
33 | {
34 | return depth * RESHADE_DEPTH_LINEARIZATION_FAR_PLANE + 1.0;
35 | }
36 |
37 | float z_to_depth(float z)
38 | {
39 | float ifar = rcp(RESHADE_DEPTH_LINEARIZATION_FAR_PLANE);
40 | return z * ifar - ifar;
41 | }
42 |
43 | float2 proj_to_uv(float3 pos)
44 | {
45 | //optimized math to simplify matrix mul
46 | //using TAAU ratios here since we're most likely to use the actual depth buffer data here.
47 | static const float3 uvtoprojADD = float3(-tan(radians(_MARTYSMODS_GLOBAL_FOV) * 0.5).xx, 1.0) * BUFFER_ASPECT_RATIO_DLSS.yxx;
48 | static const float3 uvtoprojMUL = float3(-2.0 * uvtoprojADD.xy, 0.0);
49 | static const float4 projtouv = float4(rcp(uvtoprojMUL.xy), -rcp(uvtoprojMUL.xy) * uvtoprojADD.xy);
50 | return (pos.xy / pos.z) * projtouv.xy + projtouv.zw;
51 | }
52 |
53 | float3 uv_to_proj(float2 uv, float z)
54 | {
55 | //optimized math to simplify matrix mul
56 | //using TAAU ratios here since we're most likely to use the actual depth buffer data here.
57 | static const float3 uvtoprojADD = float3(-tan(radians(_MARTYSMODS_GLOBAL_FOV) * 0.5).xx, 1.0) * BUFFER_ASPECT_RATIO_DLSS.yxx;
58 | static const float3 uvtoprojMUL = float3(-2.0 * uvtoprojADD.xy, 0.0);
59 | static const float4 projtouv = float4(rcp(uvtoprojMUL.xy), -rcp(uvtoprojMUL.xy) * uvtoprojADD.xy);
60 | return (uv.xyx * uvtoprojMUL + uvtoprojADD) * z;
61 | }
62 |
63 | float3 uv_to_proj(float2 uv)
64 | {
65 | float z = depth_to_z(Depth::get_linear_depth(uv));
66 | return uv_to_proj(uv, z);
67 | }
68 |
69 | float3 uv_to_proj(float2 uv, sampler2D linearz, int mip)
70 | {
71 | float z = tex2Dlod(linearz, float4(uv.xyx, mip)).x;
72 | return uv_to_proj(uv, z);
73 | }
74 |
75 | }
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/Custom/ClipboardX.fx:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // ClipboardX (c) maplerecall
3 | // -------------------------------------
4 |
5 | // -------------------------------------
6 | // Includes
7 | // -------------------------------------
8 |
9 | #include "ReShade.fxh"
10 |
11 | // -------------------------------------
12 | // Textures
13 | // -------------------------------------
14 |
15 | texture ClipboardX_Texture
16 | {
17 | Width = BUFFER_WIDTH;
18 | Height = BUFFER_HEIGHT;
19 | Format = RGBA8;
20 | };
21 |
22 | // -------------------------------------
23 | // Samplers
24 | // -------------------------------------
25 |
26 | sampler Sampler
27 | {
28 | Texture = ClipboardX_Texture;
29 | };
30 |
31 | // -------------------------------------
32 | // Variables
33 | // -------------------------------------
34 |
35 | uniform float BlendIntensity <
36 | ui_label = "Alpha blending level";
37 | ui_type = "drag";
38 | ui_min = 0; ui_max = 1;
39 | ui_step = 0.001;
40 | > = 0.5;
41 |
42 | uniform bool DetectSky <
43 | ui_label = "Detect sky (requires depth buffer)";
44 | ui_type = "radio";
45 | > = false;
46 |
47 | uniform float BlendIntensitySky <
48 | ui_label = "Alpha blending level for sky";
49 | ui_type = "drag";
50 | ui_min = 0; ui_max = 1;
51 | ui_step = 0.001;
52 | > = 1.0;
53 |
54 |
55 | uniform bool Debug <
56 | ui_label = "Debug Alpha";
57 | ui_type = "radio";
58 | > = false;
59 |
60 |
61 | // -------------------------------------
62 | // Entrypoints
63 | // -------------------------------------
64 |
65 | void PS_CopyX(float4 pos : SV_Position, float2 texCoord : TEXCOORD, out float4 frontColor : SV_Target)
66 | {
67 | frontColor = tex2D(ReShade::BackBuffer, texCoord);
68 | }
69 |
70 | void PS_PasteX(float4 pos : SV_Position, float2 texCoord : TEXCOORD, out float4 frontColor : SV_Target)
71 | {
72 | const float4 backColor = tex2D(ReShade::BackBuffer, texCoord);
73 |
74 | if (Debug)
75 | {
76 |
77 | if (step(1, pos.x / 32 % 2) == step(1, pos.y / 32 % 2))
78 | frontColor = lerp(0.45, backColor, backColor.a);
79 | else
80 | frontColor = lerp(0.55, backColor, backColor.a);
81 | frontColor.a *= backColor.a;
82 |
83 | return;
84 | }
85 |
86 |
87 | frontColor = tex2D(Sampler, texCoord);
88 |
89 | float depth=0;
90 |
91 | if(DetectSky && ReShade::GetLinearizedDepth(texCoord) == 1)
92 | {
93 | frontColor = lerp(backColor, frontColor, min(1.0, BlendIntensitySky));
94 | }
95 | else
96 | {
97 | frontColor = lerp(backColor, frontColor, min(1.0, BlendIntensity));
98 | }
99 | }
100 |
101 | // -------------------------------------
102 | // Techniques
103 | // -------------------------------------
104 |
105 | technique CopyX
106 | {
107 | pass
108 | {
109 | VertexShader = PostProcessVS;
110 | PixelShader = PS_CopyX;
111 | RenderTarget = ClipboardX_Texture;
112 | }
113 | }
114 |
115 | technique PasteX
116 | {
117 | pass
118 | {
119 | VertexShader = PostProcessVS;
120 | PixelShader = PS_PasteX;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/Custom/ClipboardX.fx:
--------------------------------------------------------------------------------
1 | // -------------------------------------
2 | // ClipboardX (c) maplerecall
3 | // -------------------------------------
4 |
5 | // -------------------------------------
6 | // Includes
7 | // -------------------------------------
8 |
9 | #include "ReShade.fxh"
10 |
11 | // -------------------------------------
12 | // Textures
13 | // -------------------------------------
14 |
15 | texture ClipboardX_Texture
16 | {
17 | Width = BUFFER_WIDTH;
18 | Height = BUFFER_HEIGHT;
19 | Format = RGBA8;
20 | };
21 |
22 | // -------------------------------------
23 | // Samplers
24 | // -------------------------------------
25 |
26 | sampler Sampler
27 | {
28 | Texture = ClipboardX_Texture;
29 | };
30 |
31 | // -------------------------------------
32 | // Variables
33 | // -------------------------------------
34 |
35 | uniform float BlendIntensity <
36 | ui_label = "Alpha blending level";
37 | ui_type = "drag";
38 | ui_min = 0; ui_max = 1;
39 | ui_step = 0.001;
40 | > = 0.5;
41 |
42 | uniform bool DetectSky <
43 | ui_label = "Detect sky (requires depth buffer)";
44 | ui_type = "radio";
45 | > = false;
46 |
47 | uniform float BlendIntensitySky <
48 | ui_label = "Alpha blending level for sky";
49 | ui_type = "drag";
50 | ui_min = 0; ui_max = 1;
51 | ui_step = 0.001;
52 | > = 1.0;
53 |
54 |
55 | uniform bool Debug <
56 | ui_label = "Debug Alpha";
57 | ui_type = "radio";
58 | > = false;
59 |
60 |
61 | // -------------------------------------
62 | // Entrypoints
63 | // -------------------------------------
64 |
65 | void PS_CopyX(float4 pos : SV_Position, float2 texCoord : TEXCOORD, out float4 frontColor : SV_Target)
66 | {
67 | frontColor = tex2D(ReShade::BackBuffer, texCoord);
68 | }
69 |
70 | void PS_PasteX(float4 pos : SV_Position, float2 texCoord : TEXCOORD, out float4 frontColor : SV_Target)
71 | {
72 | const float4 backColor = tex2D(ReShade::BackBuffer, texCoord);
73 |
74 | if (Debug)
75 | {
76 |
77 | if (step(1, pos.x / 32 % 2) == step(1, pos.y / 32 % 2))
78 | frontColor = lerp(0.45, backColor, backColor.a);
79 | else
80 | frontColor = lerp(0.55, backColor, backColor.a);
81 | frontColor.a *= backColor.a;
82 |
83 | return;
84 | }
85 |
86 |
87 | frontColor = tex2D(Sampler, texCoord);
88 |
89 | float depth=0;
90 |
91 | if(DetectSky && ReShade::GetLinearizedDepth(texCoord) == 1)
92 | {
93 | frontColor = lerp(backColor, frontColor, min(1.0, BlendIntensitySky));
94 | }
95 | else
96 | {
97 | frontColor = lerp(backColor, frontColor, min(1.0, BlendIntensity));
98 | }
99 | }
100 |
101 | // -------------------------------------
102 | // Techniques
103 | // -------------------------------------
104 |
105 | technique CopyX
106 | {
107 | pass
108 | {
109 | VertexShader = PostProcessVS;
110 | PixelShader = PS_CopyX;
111 | RenderTarget = ClipboardX_Texture;
112 | }
113 | }
114 |
115 | technique PasteX
116 | {
117 | pass
118 | {
119 | VertexShader = PostProcessVS;
120 | PixelShader = PS_PasteX;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/Shaders&Effects.md:
--------------------------------------------------------------------------------
1 | # Shaders & Effects
2 |
3 | 这个文档包含了一些 Shaders 说明和以及本预设的整体思路与结构
4 |
5 | ## 改进过的 Shaders
6 |
7 | 这些 Shaders 或多或少解决了一些原版存在的问题,或者扩展了一些功能。
8 |
9 | ### FFKeepUIX
10 |
11 | 
12 | 
13 |
14 | * 增加排除指定区域的功能,使用方法:
15 | * 关闭性能模式来开启编辑功能
16 | * 在编辑模式下将绿框覆盖诗人、占星和武僧的量普
17 | * 选择你所使用的 UI 主题
18 | * 重新打开性能模式
19 | > 如果你同时玩占星,诗人,武僧,并且量普位置还完全不一样,那就没办法了
20 |
如果你不玩这三个职业,关闭这个功能可以十分略微地提升性能
21 |
如果你完全不在意 UI 被一起处理,可以直接关闭这个 shader 对应的两个 effects
22 |
23 | 
24 |
25 | * 优化遮罩功能,原版的遮罩并不正常工作,这个 Shader 修复了这个问题,可以略微降低UI的亮度,减少对后续 Shader 的影响
26 |
27 | > FFKeepUI 用于还原被滤镜处理过的 UI 元素以避免界面出现奇怪的阴影和颜色,原版的 FFKeepUI 在 ReShade 下存在部分职业量普不正常的问题,虽然现在有 REST 的解决方案,但它会导致切换功能异常,并无法监测性能开销,无法同时生成原始和处理后的截图,泛用性不佳。这个Shader针对大多数人的使用习惯增加了一个排除指定区域的功能,使得职业量表区可以和背景被一起调整,从而避免奇怪的边框问题,并对不同游戏UI主题进行了适配以缓解排除区域被其它 UI 遮挡时出现的问题。
28 |
29 | ### ClipboardX
30 |
31 | * 增加天空区域单独处理
32 |
33 | > Clipboard 可以按比例混合原始画面和处理后的画面,从而达到减淡的效果。FFXIV 的一些地区和天气下的天空比较有特色,对于高饱和度的限制会影响一些天空的视觉表现。这个Shader在原版的基础上增加了对天空区域的单独处理,使得天空可以更接近原始的色调。
34 |
35 | ### PPFX_SSDO_X
36 |
37 | * 增加了近距离淡出的选项。可以配合其它 AO Shader 针对不同距离使用。对于本预设,主要用于在最高配制下与 MXAO 搭配,MAXO 提供近距离,精细的AO,SSDO 提供中等距离的广泛的AO。
38 |
39 | * 增加了高光减益,原版的 SSDO 没有对计算原始像素亮度,这会导致一些发光/高亮区域被错误的增加阴影。
40 |
41 | ### AnamorphicFlare
42 |
43 | 基于 BloomAndLensFlares 简化而来,提供电影中常见的横向光晕效果,为黑暗场景中的高光提供一些电影化的效果。
44 |
45 | ## Effect 顺序以及作用说明
46 |
47 | 
48 |
49 | 如上图所示,除了首尾的 KeepUI,本预设按照一定的顺序排列了 effects 来确保效果被正确应用,这些 effects 按顺序大致分为4组:
50 |
51 | ### 1. 前期处理,包含锐化、AO 以及 GI
52 |
53 | > 这些效果从定义上来说属于“原始画面”或者“世界”本身应该存在或者增强的内容,所以它们应该应用在任何摄影与调色之前
54 |
55 | 1. CAS
56 |
一个快速高效的抗锯齿方案算法,结果自然
57 |
58 | 2. PPFX SSDO X
59 |
一个相比 MXAO 开销稍低的 AO 效果,用于提供相对广泛的阴影
60 |
61 | 3. MXAO
62 |
一个高质量的 AO 效果,可以提供精细的阴影,但开销较高,只在最高预设中使用
63 |
64 | 4. Glamayre Fast Effect
65 |
一个超级高效的效果合集,包含 FXAA、锐化、快速 AO、快速 GI 等功能,低配福音,本预设主要使用它来提供 GI, 以及在平衡和轻量预设预设中提供锐化与 AO
66 |
67 | ### 2. 摄影处理,用于模拟景深
68 |
69 | 1. ADOF
70 |
用于过场动画中的自动景深,效果相对自然
71 |
72 | 3. CinematicDOF
73 |
用于偶尔拍摄特写或者移轴效果的的手动景深,根据鼠标位置对焦,有良好的前景虚化效果,但是效果相对激进
74 |
75 | ### 3. 后期处理,用于调色与增加特效
76 |
77 | 1. Clipboard X
78 |
用于混合调色前后的图像以达到减淡的目的
79 |
80 | 2. BloomingHDR
81 |
提供 ACES 色调映射和 HDR 风格化处理
82 |
感兴趣的话可以参考[这篇来自 UE 的文档](https://docs.unrealengine.com/4.26/en-US/RenderingAndGraphics/PostProcessEffects/ColorGrading/)来了解这个色调映射方案,从而理解它是怎么解决 FFXIV 在的高光过饱和的问题
83 |
84 | 3. EyeAdaption
85 |
提供亮度自适应,在色调映射和 HDR 风格化处理后画面整体对比度会有所提高,但这会降低一些黑暗场景的可见度。这个效果会稍微增加这些场景的亮度来确保游玩体验。
86 |
87 | 4. Vegnette2
88 |
一个复制的临边昏暗效果,用于一些可无的调整
89 |
90 | 5. Anamorphic Flare
91 |
为黑暗场景中的高光提供一些提供电影中常见的横向光晕效果。这类效果其实在游戏中各过场动画、技能特效中被广泛应用。
92 |
93 | 6. PandaFX
94 |
一些电影化效果的集合,本预设中主要用于调整红色和蓝色的平衡来的添加些许风格化效果
95 |
96 | ### 4. 遮罩,包括临边昏暗与模拟 21:9 的黑边
97 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_qmc.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | //All things quasirandom
21 | #include "mmx_global.fxh"
22 |
23 | namespace QMC
24 | {
25 |
26 | #if _BITWISE_SUPPORTED
27 | // improved golden ratio sequences v2 (P. Gilcher, 2023)
28 | // https://www.shadertoy.com/view/csdGWX
29 | float roberts1(in uint idx, in float seed)
30 | {
31 | uint useed = uint(seed * exp2(32.0));
32 | uint phi = 2654435769u;
33 | return float(phi * idx + useed) * exp2(-32.0);
34 | }
35 |
36 | float2 roberts2(in uint idx, in float2 seed)
37 | {
38 | uint2 useed = uint2(seed * exp2(32.0));
39 | uint2 phi = uint2(3242174889u, 2447445413u);
40 | return float2(phi * idx + useed) * exp2(-32.0);
41 | }
42 |
43 | float3 roberts3(in uint idx, in float3 seed)
44 | {
45 | uint3 useed = uint3(seed * exp2(32.0));
46 | uint3 phi = uint3(776648141u, 1412856951u, 2360945575u);
47 | return float3(phi * idx + useed) * exp2(-32.0);
48 | }
49 | #else //DX9 is a jackass, nothing new...
50 | //improved golden ratio sequences v1 (P. Gilcher, 2022)
51 | //PG22 improved golden ratio sequences (https://www.shadertoy.com/view/mts3zN)
52 | //these just use complementary coefficients and produce identical (albeit flipped)
53 | //patterns, and run into numerical problems 2x-3x later than the canonical coefficients
54 | float roberts1(float idx, float seed) {return frac(seed + idx * 0.38196601125);}
55 | float2 roberts2(float idx, float2 seed) {return frac(seed + idx * float2(0.245122333753, 0.430159709002));}
56 | float3 roberts3(float idx, float3 seed) {return frac(seed + idx * float3(0.180827486604, 0.328956393296, 0.450299522098));}
57 |
58 | #endif
59 |
60 | float roberts1(in uint idx) {return roberts1(idx, 0.5);}
61 | float2 roberts2(in uint idx) {return roberts2(idx, 0.5.xx);}
62 | float3 roberts3(in uint idx) {return roberts3(idx, 0.5.xxx);}
63 |
64 | //this bins random numbers into sectors, to cover a 2D domain evenly
65 | //given a known number of samples. For e.g. 4x4 samples it rescales all
66 | //per-sample random numbers to make sure each lands in its own grid cell
67 | //for non-square numbers the distribution is imperfect but still usable
68 |
69 | //calculate the coefficients used in the operation
70 | float3 get_stratificator(int n_samples)
71 | {
72 | float3 stratificator;
73 | stratificator.xy = rcp(float2(ceil(sqrt(n_samples)), n_samples));
74 | stratificator.z = stratificator.y / stratificator.x;
75 | return stratificator;
76 | }
77 |
78 | float2 get_stratified_sample(float2 per_sample_rand, float3 stratificator, int i)
79 | {
80 | float2 stratified_sample = frac(i * stratificator.xy + stratificator.xz * per_sample_rand);
81 | return stratified_sample;
82 | }
83 |
84 | } //namespace
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/Vignette.fx:
--------------------------------------------------------------------------------
1 | /**
2 | * Vignette version 1.3
3 | * by Christian Cann Schuldt Jensen ~ CeeJay.dk
4 | *
5 | * Darkens the edges of the image to make it look more like it was shot with a camera lens.
6 | * May cause banding artifacts.
7 | */
8 |
9 | #include "ReShadeUI.fxh"
10 |
11 | uniform int Type <
12 | ui_type = "combo";
13 | ui_items = "Original\0New\0TV style\0Untitled 1\0Untitled 2\0Untitled 3\0Untitled 4\0";
14 | > = 0;
15 | uniform float Ratio < __UNIFORM_SLIDER_FLOAT1
16 | ui_min = 0.15; ui_max = 6.0;
17 | ui_tooltip = "Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.";
18 | > = 1.0;
19 | uniform float Radius < __UNIFORM_SLIDER_FLOAT1
20 | ui_min = -1.0; ui_max = 3.0;
21 | ui_tooltip = "lower values = stronger radial effect from center";
22 | > = 2.0;
23 | uniform float Amount < __UNIFORM_SLIDER_FLOAT1
24 | ui_min = -2.0; ui_max = 1.0;
25 | ui_tooltip = "Strength of black. -2.00 = Max Black, 1.00 = Max White.";
26 | > = -1.0;
27 | uniform int Slope < __UNIFORM_SLIDER_INT1
28 | ui_min = 2; ui_max = 16;
29 | ui_tooltip = "How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers).";
30 | > = 2;
31 | uniform float2 Center < __UNIFORM_SLIDER_FLOAT2
32 | ui_min = 0.0; ui_max = 1.0;
33 | ui_tooltip = "Center of effect for 'Original' vignette type. 'New' and 'TV style' do not obey this setting.";
34 | > = float2(0.5, 0.5);
35 |
36 | #include "ReShade.fxh"
37 |
38 | float4 VignettePass(float4 vpos : SV_Position, float2 tex : TexCoord) : SV_Target
39 | {
40 | float4 color = tex2D(ReShade::BackBuffer, tex);
41 |
42 | if (Type == 0)
43 | {
44 | // Set the center
45 | float2 distance_xy = tex - Center;
46 |
47 | // Adjust the ratio
48 | distance_xy *= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
49 |
50 | // Calculate the distance
51 | distance_xy /= Radius;
52 | float distance = dot(distance_xy, distance_xy);
53 |
54 | // Apply the vignette
55 | color.rgb *= (1.0 + pow(distance, Slope * 0.5) * Amount); //pow - multiply
56 | }
57 |
58 | if (Type == 1) // New round (-x*x+x) + (-y*y+y) method.
59 | {
60 | tex = -tex * tex + tex;
61 | color.rgb = saturate(((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH)*(BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH) * Ratio * tex.x + tex.y) * 4.0) * color.rgb;
62 | }
63 |
64 | if (Type == 2) // New (-x*x+x) * (-y*y+y) TV style method.
65 | {
66 | tex = -tex * tex + tex;
67 | color.rgb = saturate(tex.x * tex.y * 100.0) * color.rgb;
68 | }
69 |
70 | if (Type == 3)
71 | {
72 | tex = abs(tex - 0.5);
73 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
74 |
75 | tc = saturate(tc - 0.495);
76 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
77 | }
78 |
79 | if (Type == 4)
80 | {
81 | tex = abs(tex - 0.5);
82 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
83 |
84 | tc = saturate(tc - 0.495) - 0.0002;
85 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.0); //or maybe abs(tc*100-1) (-(tc*100)-1)
86 | }
87 |
88 | if (Type == 5) // MAD version of 2
89 | {
90 | tex = abs(tex - 0.5);
91 | float tc = tex.x * (-2.0 * tex.y + 1.0) + tex.y; //XOR
92 |
93 | tc = saturate(tc - 0.495);
94 | color.rgb *= (pow((-tc * 200 + 1.0), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
95 | //color.rgb *= (pow(((tc*200.0)-1.0),4)); //or maybe abs(tc*100-1) (-(tc*100)-1)
96 | }
97 |
98 | if (Type == 6) // New round (-x*x+x) * (-y*y+y) method.
99 | {
100 | //tex.y /= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
101 | float tex_xy = dot(float4(tex, tex), float4(-tex, 1.0, 1.0)); //dot is actually slower
102 | color.rgb = saturate(tex_xy * 4.0) * color.rgb;
103 | }
104 |
105 | return color;
106 | }
107 |
108 | technique Vignette
109 | {
110 | pass
111 | {
112 | VertexShader = PostProcessVS;
113 | PixelShader = VignettePass;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/Custom/Vignette2.fx:
--------------------------------------------------------------------------------
1 | /**
2 | * Vignette version 1.3
3 | * by Christian Cann Schuldt Jensen ~ CeeJay.dk
4 | *
5 | * Darkens the edges of the image to make it look more like it was shot with a camera lens.
6 | * May cause banding artifacts.
7 | */
8 | // Lightly optimized by Marot Satil for the GShade project.
9 |
10 | uniform int Type <
11 | ui_type = "combo";
12 | ui_items = "Original\0New\0TV style\0Untitled 1\0Untitled 2\0Untitled 3\0Untitled 4\0";
13 | > = 0;
14 | uniform float Ratio <
15 | ui_type = "slider";
16 | ui_min = 0.15; ui_max = 6.0;
17 | ui_tooltip = "Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.";
18 | > = 1.0;
19 | uniform float Radius <
20 | ui_type = "slider";
21 | ui_min = -1.0; ui_max = 3.0;
22 | ui_tooltip = "lower values = stronger radial effect from center";
23 | > = 2.0;
24 | uniform float Amount <
25 | ui_type = "slider";
26 | ui_min = -2.0; ui_max = 1.0;
27 | ui_tooltip = "Strength of black. -2.00 = Max Black, 1.00 = Max White.";
28 | > = -1.0;
29 | uniform int Slope <
30 | ui_type = "slider";
31 | ui_min = 2; ui_max = 16;
32 | ui_tooltip = "How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers).";
33 | > = 2;
34 | uniform float2 Center <
35 | ui_type = "slider";
36 | ui_min = 0.0; ui_max = 1.0;
37 | ui_tooltip = "Center of effect for 'Original' vignette type. 'New' and 'TV style' do not obey this setting.";
38 | > = float2(0.5, 0.5);
39 |
40 | #include "ReShade.fxh"
41 | #if GSHADE_DITHER
42 | #include "TriDither.fxh"
43 | #endif
44 |
45 | float4 VignettePass(float4 vpos : SV_Position, float2 tex : TexCoord) : SV_Target
46 | {
47 | float4 color = tex2D(ReShade::BackBuffer, tex);
48 |
49 | if (Type == 0)
50 | {
51 | // Set the center
52 | float2 distance_xy = tex - Center;
53 |
54 | // Adjust the ratio
55 | distance_xy *= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
56 |
57 | // Calculate the distance
58 | distance_xy /= Radius;
59 | const float distance = dot(distance_xy, distance_xy);
60 |
61 | // Apply the vignette
62 | color.rgb *= (1.0 + pow(distance, Slope * 0.5) * Amount); //pow - multiply
63 | }
64 |
65 | if (Type == 1) // New round (-x*x+x) + (-y*y+y) method.
66 | {
67 | tex = -tex * tex + tex;
68 | color.rgb = saturate(((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH)*(BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH) * Ratio * tex.x + tex.y) * 4.0) * color.rgb;
69 | }
70 |
71 | if (Type == 2) // New (-x*x+x) * (-y*y+y) TV style method.
72 | {
73 | tex = -tex * tex + tex;
74 | color.rgb = saturate(tex.x * tex.y * 100.0) * color.rgb;
75 | }
76 |
77 | if (Type == 3)
78 | {
79 | tex = abs(tex - 0.5);
80 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
81 |
82 | tc = saturate(tc - 0.495);
83 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
84 | }
85 |
86 | if (Type == 4)
87 | {
88 | tex = abs(tex - 0.5);
89 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
90 |
91 | tc = saturate(tc - 0.495) - 0.0002;
92 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.0); //or maybe abs(tc*100-1) (-(tc*100)-1)
93 | }
94 |
95 | if (Type == 5) // MAD version of 2
96 | {
97 | tex = abs(tex - 0.5);
98 | float tc = tex.x * (-2.0 * tex.y + 1.0) + tex.y; //XOR
99 |
100 | tc = saturate(tc - 0.495);
101 | color.rgb *= (pow((-tc * 200 + 1.0), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
102 | //color.rgb *= (pow(((tc*200.0)-1.0),4)); //or maybe abs(tc*100-1) (-(tc*100)-1)
103 | }
104 |
105 | if (Type == 6) // New round (-x*x+x) * (-y*y+y) method.
106 | {
107 | //tex.y /= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
108 | const float tex_xy = dot(float4(tex, tex), float4(-tex, 1.0, 1.0)); //dot is actually slower
109 | color.rgb = saturate(tex_xy * 4.0) * color.rgb;
110 | }
111 | #if GSHADE_DITHER
112 | return color += TriDither(color.rgb, tex, BUFFER_COLOR_BIT_DEPTH);
113 | #else
114 | return color;
115 | #endif
116 | }
117 |
118 | technique Vignette2
119 | {
120 | pass
121 | {
122 | VertexShader = PostProcessVS;
123 | PixelShader = VignettePass;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/Custom/Vignette2.fx:
--------------------------------------------------------------------------------
1 | /**
2 | * Vignette version 1.3
3 | * by Christian Cann Schuldt Jensen ~ CeeJay.dk
4 | *
5 | * Darkens the edges of the image to make it look more like it was shot with a camera lens.
6 | * May cause banding artifacts.
7 | */
8 | // Lightly optimized by Marot Satil for the GShade project.
9 |
10 | uniform int Type <
11 | ui_type = "combo";
12 | ui_items = "Original\0New\0TV style\0Untitled 1\0Untitled 2\0Untitled 3\0Untitled 4\0";
13 | > = 0;
14 | uniform float Ratio <
15 | ui_type = "slider";
16 | ui_min = 0.15; ui_max = 6.0;
17 | ui_tooltip = "Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.";
18 | > = 1.0;
19 | uniform float Radius <
20 | ui_type = "slider";
21 | ui_min = -1.0; ui_max = 3.0;
22 | ui_tooltip = "lower values = stronger radial effect from center";
23 | > = 2.0;
24 | uniform float Amount <
25 | ui_type = "slider";
26 | ui_min = -2.0; ui_max = 1.0;
27 | ui_tooltip = "Strength of black. -2.00 = Max Black, 1.00 = Max White.";
28 | > = -1.0;
29 | uniform int Slope <
30 | ui_type = "slider";
31 | ui_min = 2; ui_max = 16;
32 | ui_tooltip = "How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers).";
33 | > = 2;
34 | uniform float2 Center <
35 | ui_type = "slider";
36 | ui_min = 0.0; ui_max = 1.0;
37 | ui_tooltip = "Center of effect for 'Original' vignette type. 'New' and 'TV style' do not obey this setting.";
38 | > = float2(0.5, 0.5);
39 |
40 | #include "ReShade.fxh"
41 | #if GSHADE_DITHER
42 | #include "TriDither.fxh"
43 | #endif
44 |
45 | float4 VignettePass(float4 vpos : SV_Position, float2 tex : TexCoord) : SV_Target
46 | {
47 | float4 color = tex2D(ReShade::BackBuffer, tex);
48 |
49 | if (Type == 0)
50 | {
51 | // Set the center
52 | float2 distance_xy = tex - Center;
53 |
54 | // Adjust the ratio
55 | distance_xy *= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
56 |
57 | // Calculate the distance
58 | distance_xy /= Radius;
59 | const float distance = dot(distance_xy, distance_xy);
60 |
61 | // Apply the vignette
62 | color.rgb *= (1.0 + pow(distance, Slope * 0.5) * Amount); //pow - multiply
63 | }
64 |
65 | if (Type == 1) // New round (-x*x+x) + (-y*y+y) method.
66 | {
67 | tex = -tex * tex + tex;
68 | color.rgb = saturate(((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH)*(BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH) * Ratio * tex.x + tex.y) * 4.0) * color.rgb;
69 | }
70 |
71 | if (Type == 2) // New (-x*x+x) * (-y*y+y) TV style method.
72 | {
73 | tex = -tex * tex + tex;
74 | color.rgb = saturate(tex.x * tex.y * 100.0) * color.rgb;
75 | }
76 |
77 | if (Type == 3)
78 | {
79 | tex = abs(tex - 0.5);
80 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
81 |
82 | tc = saturate(tc - 0.495);
83 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
84 | }
85 |
86 | if (Type == 4)
87 | {
88 | tex = abs(tex - 0.5);
89 | float tc = dot(float4(-tex.x, -tex.x, tex.x, tex.y), float4(tex.y, tex.y, 1.0, 1.0)); //XOR
90 |
91 | tc = saturate(tc - 0.495) - 0.0002;
92 | color.rgb *= (pow((1.0 - tc * 200), 4) + 0.0); //or maybe abs(tc*100-1) (-(tc*100)-1)
93 | }
94 |
95 | if (Type == 5) // MAD version of 2
96 | {
97 | tex = abs(tex - 0.5);
98 | float tc = tex.x * (-2.0 * tex.y + 1.0) + tex.y; //XOR
99 |
100 | tc = saturate(tc - 0.495);
101 | color.rgb *= (pow((-tc * 200 + 1.0), 4) + 0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
102 | //color.rgb *= (pow(((tc*200.0)-1.0),4)); //or maybe abs(tc*100-1) (-(tc*100)-1)
103 | }
104 |
105 | if (Type == 6) // New round (-x*x+x) * (-y*y+y) method.
106 | {
107 | //tex.y /= float2((BUFFER_RCP_HEIGHT / BUFFER_RCP_WIDTH), Ratio);
108 | const float tex_xy = dot(float4(tex, tex), float4(-tex, 1.0, 1.0)); //dot is actually slower
109 | color.rgb = saturate(tex_xy * 4.0) * color.rgb;
110 | }
111 | #if GSHADE_DITHER
112 | return color += TriDither(color.rgb, tex, BUFFER_COLOR_BIT_DEPTH);
113 | #else
114 | return color;
115 | #endif
116 | }
117 |
118 | technique Vignette2
119 | {
120 | pass
121 | {
122 | VertexShader = PostProcessVS;
123 | PixelShader = VignettePass;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_depth.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | //depth input handling
21 |
22 | #ifndef RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
23 | #define RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN 0
24 | #endif
25 | #ifndef RESHADE_DEPTH_INPUT_IS_REVERSED
26 | #define RESHADE_DEPTH_INPUT_IS_REVERSED 1
27 | #endif
28 | #ifndef RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
29 | #define RESHADE_DEPTH_INPUT_IS_LOGARITHMIC 0
30 | #endif
31 | #ifndef RESHADE_DEPTH_LINEARIZATION_FAR_PLANE
32 | #define RESHADE_DEPTH_LINEARIZATION_FAR_PLANE 1000.0
33 | #endif
34 | #ifndef RESHADE_DEPTH_MULTIPLIER
35 | #define RESHADE_DEPTH_MULTIPLIER 1 //mcfly: probably not a good idea, many shaders depend on having depth range 0-1
36 | #endif
37 | #ifndef RESHADE_DEPTH_INPUT_X_SCALE
38 | #define RESHADE_DEPTH_INPUT_X_SCALE 1
39 | #endif
40 | #ifndef RESHADE_DEPTH_INPUT_Y_SCALE
41 | #define RESHADE_DEPTH_INPUT_Y_SCALE 1
42 | #endif
43 | #ifndef RESHADE_DEPTH_INPUT_X_OFFSET
44 | #define RESHADE_DEPTH_INPUT_X_OFFSET 0 // An offset to add to the X coordinate, (+) = move right, (-) = move left
45 | #endif
46 | #ifndef RESHADE_DEPTH_INPUT_Y_OFFSET
47 | #define RESHADE_DEPTH_INPUT_Y_OFFSET 0 // An offset to add to the Y coordinate, (+) = move up, (-) = move down
48 | #endif
49 | #ifndef RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET
50 | #define RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET 0 // An offset to add to the X coordinate, (+) = move right, (-) = move left
51 | #endif
52 | #ifndef RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET
53 | #define RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET 0 // An offset to add to the Y coordinate, (+) = move up, (-) = move down
54 | #endif
55 |
56 | namespace Depth
57 | {
58 |
59 | //this is maybe a bit awkward but the only easy way to create overloads without redundant code
60 | #define TRANSFORM_LOG(x) x
61 | #define TRANSFORM_REVERSE(x) x
62 |
63 | #if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
64 | #undef TRANSFORM_LOG
65 | #define TRANSFORM_LOG(x) ((x) * lerp((x), 1.0, 0.04975)) //extremely precise approximation that does not rely on transcendentals
66 | #endif
67 |
68 | #if RESHADE_DEPTH_INPUT_IS_REVERSED
69 | #undef TRANSFORM_REVERSE
70 | #define TRANSFORM_REVERSE(x) (1.0 - (x))
71 | #endif
72 |
73 | #define LINEARIZE_OVERLOAD(_type) _type linearize(_type x) \
74 | { \
75 | x *= RESHADE_DEPTH_MULTIPLIER; \
76 | x = TRANSFORM_LOG(x); \
77 | x = TRANSFORM_REVERSE(x); \
78 | x /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - x * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - 1.0); \
79 | return saturate(x); \
80 | }
81 |
82 | LINEARIZE_OVERLOAD(float)
83 | LINEARIZE_OVERLOAD(float2)
84 | LINEARIZE_OVERLOAD(float3)
85 | LINEARIZE_OVERLOAD(float4)
86 |
87 | float2 correct_uv(float2 uv)
88 | {
89 | #if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
90 | uv.y = 1.0 - uv.y;
91 | #endif
92 | uv *= rcp(float2(RESHADE_DEPTH_INPUT_X_SCALE, RESHADE_DEPTH_INPUT_Y_SCALE));
93 | #if RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET
94 | uv.x -= RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET * BUFFER_RCP_WIDTH;
95 | #else
96 | uv.x -= RESHADE_DEPTH_INPUT_X_OFFSET / 2.000000001;
97 | #endif
98 | #if RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET
99 | uv.y += RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET * BUFFER_RCP_HEIGHT;
100 | #else
101 | uv.y += RESHADE_DEPTH_INPUT_Y_OFFSET / 2.000000001;
102 | #endif
103 | return uv;
104 | }
105 |
106 | float get_depth(float2 uv)
107 | {
108 | return tex2Dlod(DepthInput, float4(correct_uv(uv), 0, 0)).x;
109 | }
110 |
111 | float get_linear_depth(float2 uv)
112 | {
113 | float depth = get_depth(uv);
114 | depth = linearize(depth);
115 | return depth;
116 | }
117 |
118 | } //namespace
119 |
120 |
121 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_texture.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_global.fxh"
21 |
22 | namespace Texture
23 | {
24 |
25 | float4 sample2D_biquadratic(sampler s, float2 iuv, int2 size)
26 | {
27 | float2 q = frac(iuv * size);
28 | float2 c = (q * (q - 1.0) + 0.5) * rcp(size);
29 | float4 uv = iuv.xyxy + float4(-c, c);
30 | return (tex2Dlod(s, uv.xy, 0)
31 | + tex2Dlod(s, uv.xw, 0)
32 | + tex2Dlod(s, uv.zw, 0)
33 | + tex2Dlod(s, uv.zy, 0)) * 0.25;
34 | }
35 |
36 | float4 sample2D_biquadratic_auto(sampler s, float2 iuv)
37 | {
38 | return sample2D_biquadratic(s, iuv, tex2Dsize(s));
39 | }
40 |
41 | //Optimized Bspline bicubic filtering
42 | //FXC assembly: 37->25 ALU, 5->3 registers
43 | //One texture coord known early, better for latency
44 | float4 sample2D_bspline(sampler s, float2 iuv, int2 size)
45 | {
46 | float4 uv;
47 | uv.xy = iuv * size;
48 |
49 | float2 center = floor(uv.xy - 0.5) + 0.5;
50 | float4 d = float4(uv.xy - center, 1 + center - uv.xy);
51 | float4 d2 = d * d;
52 | float4 d3 = d2 * d;
53 |
54 | float4 o = d2 * 0.12812 + d3 * 0.07188; //approx |err|*255 < 0.2 < bilinear precision
55 | uv.xy = center - o.zw;
56 | uv.zw = center + 1 + o.xy;
57 | uv /= size.xyxy;
58 |
59 | float4 w = 0.16666666 + d * 0.5 + 0.5 * d2 - d3 * 0.3333333;
60 | w = w.wwyy * w.zxzx;
61 |
62 | return w.x * tex2Dlod(s, uv.xy, 0)
63 | + w.y * tex2Dlod(s, uv.zy, 0)
64 | + w.z * tex2Dlod(s, uv.xw, 0)
65 | + w.w * tex2Dlod(s, uv.zw, 0);
66 | }
67 |
68 | float4 sample2D_bspline_auto(sampler s, float2 iuv)
69 | {
70 | return sample2D_bspline(s, iuv, tex2Dsize(s));
71 | }
72 |
73 | float4 sample2D_catmullrom(in sampler tex, in float2 uv, in float2 texsize)
74 | {
75 | float2 UV = uv * texsize;
76 | float2 tc = floor(UV - 0.5) + 0.5;
77 | float2 f = UV - tc;
78 | float2 f2 = f * f;
79 | float2 f3 = f2 * f;
80 |
81 | float2 w0 = f2 - 0.5 * (f3 + f);
82 | float2 w1 = 1.5 * f3 - 2.5 * f2 + 1.0;
83 | float2 w3 = 0.5 * (f3 - f2);
84 | float2 w12 = 1.0 - w0 - w3;
85 |
86 | float4 ws[3];
87 | ws[0].xy = w0;
88 | ws[1].xy = w12;
89 | ws[2].xy = w3;
90 |
91 | ws[0].zw = tc - 1.0;
92 | ws[1].zw = tc + 1.0 - w1 / w12;
93 | ws[2].zw = tc + 2.0;
94 |
95 | ws[0].zw /= texsize;
96 | ws[1].zw /= texsize;
97 | ws[2].zw /= texsize;
98 |
99 | float4 ret;
100 | ret = tex2Dlod(tex, float2(ws[1].z, ws[0].w), 0) * ws[1].x * ws[0].y;
101 | ret += tex2Dlod(tex, float2(ws[0].z, ws[1].w), 0) * ws[0].x * ws[1].y;
102 | ret += tex2Dlod(tex, float2(ws[1].z, ws[1].w), 0) * ws[1].x * ws[1].y;
103 | ret += tex2Dlod(tex, float2(ws[2].z, ws[1].w), 0) * ws[2].x * ws[1].y;
104 | ret += tex2Dlod(tex, float2(ws[1].z, ws[2].w), 0) * ws[1].x * ws[2].y;
105 | float normfact = 1.0 / (1.0 - (f.x - f2.x)*(f.y - f2.y) * 0.25); //PG23: closed form for the weight sum
106 | return max(0, ret * normfact);
107 | }
108 |
109 | float4 sample2D_catmullrom_auto(sampler s, float2 iuv)
110 | {
111 | return sample2D_catmullrom(s, iuv, tex2Dsize(s));
112 | }
113 |
114 | //for LUTs, when the volumes are placed below each other
115 | float4 sample3D_trilinear(sampler s, float3 uvw, int3 size, int atlas_idx)
116 | {
117 | uvw = saturate(uvw);
118 | uvw = uvw * size - uvw;
119 | float3 rcpsize = rcp(size);
120 | uvw.xy = (uvw.xy + 0.5) * rcpsize.xy;
121 |
122 | float zlerp = frac(uvw.z);
123 | uvw.x = (uvw.x + uvw.z - zlerp) * rcpsize.z;
124 |
125 | float2 uv_a = uvw.xy;
126 | float2 uv_b = uvw.xy + float2(1.0/size.z, 0);
127 |
128 | int atlas_size = tex2Dsize(s).y * rcpsize.y;
129 | uv_a.y = (uv_a.y + atlas_idx) / atlas_size;
130 | uv_b.y = (uv_b.y + atlas_idx) / atlas_size;
131 |
132 | return lerp(tex2Dlod(s, uv_a, 0), tex2Dlod(s, uv_b, 0), zlerp);
133 | }
134 |
135 | //tetrahedral volume interpolation
136 | //also DX9 safe - emulated integers suck...
137 | float4 sample3D_tetrahedral(sampler s, float3 uvw, int3 size, int atlas_idx)
138 | {
139 | float3 p = saturate(uvw) * (size - 1);
140 | float3 c000 = floor(p); float3 c111 = ceil(p);
141 | float3 f = p - c000;
142 |
143 | float maxv = max(max(f.x, f.y), f.z);
144 | float minv = min(min(f.x, f.y), f.z);
145 | float medv = dot(f, 1) - maxv - minv;
146 |
147 | float3 minaxis = minv == f.x ? float3(1,0,0) : (minv == f.y ? float3(0,1,0) : float3(0,0,1));
148 | float3 maxaxis = maxv == f.x ? float3(1,0,0) : (maxv == f.y ? float3(0,1,0) : float3(0,0,1));
149 |
150 | int3 cmin = lerp(c111, c000, minaxis);
151 | int3 cmax = lerp(c000, c111, maxaxis);
152 |
153 | //3D barycentric
154 | float4 w = float4(1, maxv, medv, minv);
155 | w.xyz -= w.yzw;
156 |
157 | return tex2Dfetch(s, int2(c000.x + c000.z * size.x, c000.y + size.y * atlas_idx)) * w.x //000
158 | + tex2Dfetch(s, int2(cmax.x + cmax.z * size.x, cmax.y + size.y * atlas_idx)) * w.y //max
159 | + tex2Dfetch(s, int2(cmin.x + cmin.z * size.x, cmin.y + size.y * atlas_idx)) * w.z //min
160 | + tex2Dfetch(s, int2(c111.x + c111.z * size.x, c111.y + size.y * atlas_idx)) * w.w; //111
161 | }
162 |
163 | }
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_colorspaces.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | namespace Colorspace
21 | {
22 |
23 | float3 srgb_to_linear(float3 srgb)
24 | {
25 | return (srgb < 0.04045) ? srgb / 12.92 : pow(abs((srgb + 0.055) / 1.055), 2.4);
26 | }
27 |
28 | float3 linear_to_srgb(float3 lin)
29 | {
30 | return (lin < 0.0031308) ? 12.92 * lin : 1.055 * pow(abs(lin), 0.41666666) - 0.055;
31 | }
32 |
33 | float get_srgb_luma(float3 srgb)
34 | {
35 | float3 lin = srgb_to_linear(srgb);
36 | float luma = dot(lin, float3(0.2126729, 0.7151522, 0.072175)); //BT.709
37 | return (luma < 0.0031308) ? 12.92 * luma : 1.055 * pow(abs(luma), 0.41666666) - 0.055;
38 | }
39 |
40 | float3 rgb_to_hcv(in float3 RGB)
41 | {
42 | RGB = saturate(RGB);
43 | float Epsilon = 1e-10;
44 | // Based on work by Sam Hocevar and Emil Persson
45 | float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0/3.0) : float4(RGB.gb, 0.0, -1.0/3.0);
46 | float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
47 | float C = Q.x - min(Q.w, Q.y);
48 | float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z);
49 | return float3(H, C, Q.x);
50 | }
51 |
52 | float3 rgb_to_hsl(in float3 RGB)
53 | {
54 | float3 HCV = rgb_to_hcv(RGB);
55 | float L = HCV.z - HCV.y * 0.5;
56 | float S = HCV.y / (1.0000001 - abs(L * 2 - 1));
57 | return float3(HCV.x, S, L);
58 | }
59 |
60 | float3 hsl_to_rgb(in float3 HSL)
61 | {
62 | HSL = saturate(HSL);
63 | float3 RGB = saturate(float3(abs(HSL.x * 6.0 - 3.0) - 1.0,2.0 - abs(HSL.x * 6.0 - 2.0),2.0 - abs(HSL.x * 6.0 - 4.0)));
64 | float C = (1 - abs(2 * HSL.z - 1)) * HSL.y;
65 | return (RGB - 0.5) * C + HSL.z;
66 | }
67 |
68 | float3 rgb_to_hsv(float3 c)
69 | {
70 | float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
71 | float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
72 | float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
73 |
74 | float d = q.x - min(q.w, q.y);
75 | float e = 1.0e-10;
76 | return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
77 | }
78 |
79 | float3 hsv_to_rgb(float3 c)
80 | {
81 | float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
82 | float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
83 | return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
84 | }
85 |
86 | float3 rgb_to_xyz(float3 RGB)
87 | {
88 | static const float3x3 m = float3x3( 0.4124564, 0.3575761, 0.1804375,
89 | 0.2126729, 0.7151522, 0.0721750,
90 | 0.0193339, 0.1191920, 0.9503041);
91 | return mul(m, srgb_to_linear(RGB));
92 | }
93 |
94 |
95 | float3 xyz_to_rgb(float3 XYZ)
96 | {
97 | static const float3x3 m = float3x3( 3.2404542, -1.5371385, -0.4985314,
98 | -0.9692660, 1.8760108, 0.0415560,
99 | 0.0556434, -0.2040259, 1.0572252);
100 | return linear_to_srgb(mul(m, XYZ));
101 | }
102 |
103 | float3 xyz_to_cielab(float3 xyz)
104 | {
105 | xyz *= float3(1.05211, 1.0, 0.91842); // reciprocal of °2 D65 reference values
106 | xyz = xyz > 0.008856 ? pow(xyz, 1.0/3.0) : xyz * 7.787037 + 4.0/29.0;
107 | float L = (116.0 * xyz.y) - 16.0;
108 | float a = 500.0 * (xyz.x - xyz.y);
109 | float b = 200.0 * (xyz.y - xyz.z);
110 | return float3(L, a, b) * 0.01; //assumed L = 100 earlier
111 | }
112 |
113 | float3 cielab_to_xyz(float3 lab)
114 | {
115 | lab *= 100.0;
116 | float3 xyz;
117 | xyz.y = (lab.x + 16.0) / 116.0;
118 | xyz.x = xyz.y + lab.y / 500.0;
119 | xyz.z = xyz.y - lab.z / 200.0;
120 | xyz = xyz > 0.206897 ? xyz * xyz * xyz : 0.128418 * (xyz - 4.0/29.0);
121 | return max(0.0, xyz) * float3(0.95047, 1.0, 1.08883); // °2 D65 reference values
122 | }
123 |
124 | float3 rgb_to_cielab(float3 rgb)
125 | {
126 | return xyz_to_cielab(rgb_to_xyz(rgb));
127 | }
128 |
129 | float3 cielab_to_rgb(float3 lab)
130 | {
131 | return xyz_to_rgb(cielab_to_xyz(lab));
132 | }
133 |
134 | float3 xyz_to_lms(float3 xyz)
135 | {
136 | return mul(xyz, float3x3(0.7328, 0.4296,-0.1624,
137 | -0.7036, 1.6975, 0.0061,
138 | 0.0030, 0.0136, 0.9834));
139 | }
140 |
141 | //https://bottosson.github.io/posts/oklab/
142 | float3 rgb_to_oklab(float3 rgb)
143 | {
144 | rgb = srgb_to_linear(rgb);
145 | float3 lms = mul(rgb, float3x3( 0.4122214708, 0.2119034982, 0.0883024619,
146 | 0.5363325363, 0.6806995451, 0.2817188376,
147 | 0.0514459929, 0.1073969566, 0.6299787005));
148 |
149 |
150 |
151 | lms = pow(abs(lms), 1.0/3.0);
152 | return mul(lms, float3x3(0.2104542553, 1.9779984951, 0.0259040371,
153 | 0.7936177850, -2.4285922050, 0.7827717662,
154 | -0.0040720468, 0.4505937099, -0.8086757660));
155 | }
156 |
157 | float3 oklab_to_rgb(float3 oklab)
158 | {
159 | float3 lms = mul(oklab, float3x3(1, 1, 1,
160 | 0.3963377774, -0.1055613458, -0.0894841775,
161 | 0.2158037573, -0.0638541728, -1.2914855480));
162 | lms = lms * lms * lms;
163 | float3 rgb = mul(lms, float3x3(4.0767416621, -1.2684380046, -0.0041960863,
164 | -3.3077115913, 2.6097574011, -0.7034186147,
165 | 0.2309699292, -0.3413193965, 1.7076147010));
166 | return linear_to_srgb(rgb);
167 | }
168 |
169 | } //Namespace
170 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_fft.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | //#pragma once //allow including multiple times so we can create multiple instances of the same shader
19 |
20 | //make sure inputs are set
21 | #ifndef FFT_WORKING_SIZE
22 | #error "Define Size, bruv"
23 | #endif
24 | #ifndef FFT_RADIX
25 | #error "Define Radix, bruv"
26 | #endif
27 | #ifndef FFT_INSTANCE
28 | #error "Define instance, bruv"
29 | #endif
30 | #ifndef FFT_AXIS
31 | #error "Define axis, bruv"
32 | #endif
33 | #ifndef FFT_CHANNELS
34 | #error "Define channels, bruv"
35 | #endif
36 |
37 | namespace FFT_INSTANCE
38 | {
39 |
40 | float2 complex_conj(float2 z)
41 | {
42 | return float2(z.x, -z.y);
43 | }
44 |
45 | float2 complex_mul(float2 c1, float2 c2)
46 | {
47 | #if 0 //normal
48 | return float2(c1.x * c2.x - c1.y * c2.y,
49 | c1.y * c2.x + c1.x * c2.y);
50 | #else //gauss - maybe influences precision?
51 | float2 z = c1 * c2;
52 | return float2(z.x - z.y, dot(c1 * c2.yx, 1));
53 | #endif
54 | }
55 |
56 | float2 get_twiddle_factor(float n, float k)
57 | {
58 | float2 tw; sincos((TAU * k) / n, tw.y, tw.x); return tw;
59 | }
60 |
61 | uint reverse_index_bits(uint index, uint size)
62 | {
63 | return reversebits(index) >> (32u - size);
64 | }
65 |
66 | void fft_radix2(bool forward, inout float2 z0, inout float2 z1)
67 | {
68 | z0 += z1;
69 | z1 = z0 - z1 - z1;
70 | }
71 |
72 | void fft_radix4(bool forward, inout float2 z[4])
73 | {
74 | fft_radix2(forward, z[0], z[2]);
75 | fft_radix2(forward, z[1], z[3]);
76 |
77 | float2 zt0 = forward ? complex_conj(z[3]).yx : complex_conj(z[3].yx);
78 | float2 zt1 = z[1];
79 |
80 | z[0] = z[0] + zt1;
81 | z[1] = z[2] + zt0;
82 | z[3] = z[2] - zt0;
83 | z[2] = z[0] - zt1 - zt1;
84 | }
85 |
86 | void fft_radix8(bool forward, inout float2 z[8])
87 | {
88 | float2 A[4] = {z[0], z[2], z[4], z[6]};
89 | float2 B[4] = {z[1], z[3], z[5], z[7]};
90 |
91 | fft_radix4(forward, A);
92 | fft_radix4(forward, B);
93 |
94 | float2 tw = rsqrt(2.0);
95 | tw = forward ? tw : complex_conj(tw);
96 |
97 | float2 zt0 = complex_mul(tw, B[1]); //z[3]
98 |
99 | z[0] = A[0] + B[0];
100 | z[4] = A[0] - B[0];
101 |
102 | z[1] = A[1] + zt0;
103 | z[5] = A[1] - zt0;
104 |
105 | [flatten]
106 | if(forward)
107 | {
108 | z[2] = float2(A[2].x - B[2].y, A[2].y + B[2].x);// V4 + i V5
109 | z[6] = float2(A[2].x + B[2].y, A[2].y - B[2].x);// V4 - i V5
110 | }
111 | else
112 | {
113 | z[2] = float2(A[2].x + B[2].y, A[2].y - B[2].x);// V4 - iV5
114 | z[6] = float2(A[2].x - B[2].y, A[2].y + B[2].x);// V4 + iV5
115 | }
116 |
117 | tw.x = -tw.x;
118 | zt0 = complex_mul(tw, B[3]); //z[7]
119 |
120 | z[3] = A[3] + zt0;
121 | z[7] = A[3] - zt0;
122 | }
123 |
124 | void fft_radix(bool forward, inout float2 z[FFT_RADIX])
125 | {
126 | #if FFT_RADIX == 2
127 | fft_radix2(forward, z[0], z[1]);
128 | #elif FFT_RADIX == 4
129 | fft_radix4(forward, z);
130 | #else
131 | fft_radix8(forward, z);
132 | #endif
133 | }
134 |
135 | groupshared float2 tgsm[FFT_WORKING_SIZE];
136 |
137 | void FFTPass(uint2 dtid, uint threadid, sampler s_in, storage s_out, bool forward)
138 | {
139 | static const uint group_size = FFT_WORKING_SIZE / FFT_RADIX;
140 | float2 local[FFT_RADIX];
141 | #if FFT_CHANNELS == 4
142 | float2 local2[FFT_RADIX];
143 | #endif
144 | [loop]
145 | for(uint j = 0; j < FFT_RADIX; j++)
146 | {
147 | #if FFT_AXIS == 0
148 | uint2 p = uint2(threadid + j * group_size, dtid.y);
149 | #else
150 | uint2 p = uint2(dtid.x, threadid + j * group_size);
151 | #endif
152 | float4 rcrc = tex2Dfetch(s_in, p);
153 | local[j] = rcrc.xy;
154 | #if FFT_CHANNELS == 4
155 | local2[j] = rcrc.zw;
156 | #endif
157 | }
158 |
159 | uint k = 0;
160 | [unroll]
161 | for(uint n = 1; n < group_size;)
162 | {
163 | //transpose with shared mem and fetch next batch
164 | uint curr_lane = k + (threadid - k) * FFT_RADIX;
165 |
166 | fft_radix(forward, local);
167 | [loop]for(uint j = 0; j < FFT_RADIX; j++) tgsm[curr_lane + j * n] = local[j];
168 | barrier();
169 | [loop]for(uint j = 0; j < FFT_RADIX; j++) local[j] = tgsm[threadid + j * group_size];
170 | barrier();
171 | #if FFT_CHANNELS == 4
172 | fft_radix(forward, local2);
173 | [loop]for(uint j = 0; j < FFT_RADIX; j++) tgsm[curr_lane + j * n] = local2[j];
174 | barrier();
175 | [loop]for(uint j = 0; j < FFT_RADIX; j++) local2[j] = tgsm[threadid + j * group_size];
176 | barrier();
177 | #endif
178 |
179 | n *= FFT_RADIX;
180 | k = threadid % n;
181 |
182 | //twiddle it
183 | float2 tw = get_twiddle_factor(n * FFT_RADIX, k);
184 | tw = forward ? tw : complex_conj(tw);
185 | float2 tw_curr = tw;
186 |
187 | [unroll]for(uint j = 1; j < FFT_RADIX; j++)
188 | {
189 | local[j] = complex_mul(tw_curr, local[j]);
190 | #if FFT_CHANNELS == 4
191 | local2[j] = complex_mul(tw_curr, local2[j]);
192 | #endif
193 | tw_curr = complex_mul(tw_curr, tw);
194 | }
195 | }
196 |
197 | //last fft pass split off the main loop
198 | fft_radix(forward, local);
199 | #if FFT_CHANNELS == 4
200 | fft_radix(forward, local2);
201 | #endif
202 |
203 | [loop]for(uint j = 0; j < FFT_RADIX; j++)
204 | {
205 | #if FFT_CHANNELS == 4
206 | float4 result = float4(local[j], local2[j]);
207 | #else
208 | float4 result = local[j].xyyy;
209 | #endif
210 | #if FFT_AXIS == 0
211 | uint2 p = uint2(threadid + j * group_size, dtid.y);
212 | #else
213 | uint2 p = uint2(dtid.x, threadid + j * group_size);
214 | #endif
215 | tex2Dstore(s_out, p, result * rsqrt(FFT_WORKING_SIZE));
216 | }
217 | }
218 | }
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/Custom/AnamFlare.fx:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009-2015 Gilcher Pascal aka Marty McFly
2 |
3 | uniform bool bAnamFlareEnable <
4 | > = false;
5 | uniform float fAnamFlareThreshold <
6 | ui_type = "slider";
7 | ui_min = 0.1; ui_max = 1.0;
8 | ui_tooltip = "Every pixel brighter than this value gets a flare.";
9 | > = 0.9;
10 | uniform float fAnamFlareWideness <
11 | ui_type = "slider";
12 | ui_min = 1.0; ui_max = 2.5;
13 | ui_tooltip = "Horizontal wideness of flare. Don't set too high, otherwise the single samples are visible.";
14 | > = 2.4;
15 | uniform float fAnamFlareAmount <
16 | ui_type = "slider";
17 | ui_min = 1.0; ui_max = 20.0;
18 | ui_tooltip = "Intensity of anamorphic flare.";
19 | > = 14.5;
20 | uniform float fAnamFlareCurve <
21 | ui_type = "slider";
22 | ui_min = 1.0; ui_max = 2.0;
23 | ui_tooltip = "Intensity curve of flare with distance from source.";
24 | > = 1.2;
25 | uniform float3 fAnamFlareColor <
26 | ui_type = "color";
27 | ui_tooltip = "R, G and B components of anamorphic flare. Flare is always same color.";
28 | > = float3(0.012, 0.313, 0.588);
29 |
30 | // If 1, only pixels with depth = 1 get lens flares
31 | // This prevents white objects from getting lens flares sources, which would normally happen in LDR
32 | #ifndef FLARE_DEPTH_CHECK
33 | #define FLARE_DEPTH_CHECK 0
34 | #endif
35 |
36 | // texture texDirt2 < source = "LensDB.png"; > { Width = 1920; Height = 1080; Format = RGBA8; };
37 | // texture texSprite2 < source = ""; > { Width = 1920; Height = 1080; Format = RGBA8; };
38 |
39 | // sampler SamplerDirt2 { Texture = texDirt2; };
40 | // sampler SamplerSprite2 { Texture = texSprite2; };
41 |
42 | texture texBloom1
43 | {
44 | Width = BUFFER_WIDTH / 2;
45 | Height = BUFFER_HEIGHT / 2;
46 | Format = RGBA16F;
47 | };
48 | texture texBloom2
49 | {
50 | Width = BUFFER_WIDTH / 2;
51 | Height = BUFFER_HEIGHT / 2;
52 | Format = RGBA16F;
53 | };
54 | texture texBloom3
55 | {
56 | Width = BUFFER_WIDTH / 2;
57 | Height = BUFFER_HEIGHT / 2;
58 | Format = RGBA16F;
59 | };
60 | texture texBloom4
61 | {
62 | Width = BUFFER_WIDTH / 4;
63 | Height = BUFFER_HEIGHT / 4;
64 | Format = RGBA16F;
65 | };
66 | texture texBloom5
67 | {
68 | Width = BUFFER_WIDTH / 8;
69 | Height = BUFFER_HEIGHT / 8;
70 | Format = RGBA16F;
71 | };
72 |
73 | sampler SamplerBloom1 { Texture = texBloom1; };
74 | sampler SamplerBloom2 { Texture = texBloom2; };
75 | sampler SamplerBloom3 { Texture = texBloom3; };
76 | sampler SamplerBloom4 { Texture = texBloom4; };
77 | sampler SamplerBloom5 { Texture = texBloom5; };
78 |
79 | #include "ReShade.fxh"
80 |
81 | float4 GaussBlur22(float2 coord, sampler tex, float mult, float lodlevel, bool isBlurVert)
82 | {
83 | float4 sum = 0;
84 | float2 axis = isBlurVert ? float2(0, 1) : float2(1, 0);
85 |
86 | const float weight[11] = {
87 | 0.082607,
88 | 0.080977,
89 | 0.076276,
90 | 0.069041,
91 | 0.060049,
92 | 0.050187,
93 | 0.040306,
94 | 0.031105,
95 | 0.023066,
96 | 0.016436,
97 | 0.011254
98 | };
99 |
100 | for (int i = -10; i < 11; i++)
101 | {
102 | float currweight = weight[abs(i)];
103 | sum += tex2Dlod(tex, float4(coord.xy + axis.xy * (float)i * ReShade::PixelSize * mult, 0, lodlevel)) * currweight;
104 | }
105 |
106 | return sum;
107 | }
108 |
109 | void BloomPass0(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
110 | {
111 | bloom = 0.0;
112 |
113 | const float2 offset[4] = {
114 | float2(1.0, 1.0),
115 | float2(1.0, 1.0),
116 | float2(-1.0, 1.0),
117 | float2(-1.0, -1.0)
118 | };
119 |
120 | for (int i = 0; i < 4; i++)
121 | {
122 | float2 bloomuv = offset[i] * ReShade::PixelSize.xy * 2;
123 | bloomuv += texcoord;
124 | float4 tempbloom = tex2Dlod(ReShade::BackBuffer, float4(bloomuv.xy, 0, 0));
125 | tempbloom.w = max(0, dot(tempbloom.xyz, 0.333) - fAnamFlareThreshold);
126 | bloom += tempbloom;
127 | }
128 |
129 | bloom *= 0.25;
130 | }
131 | void BloomPass1(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
132 | {
133 | bloom = 0.0;
134 |
135 | const float2 offset[8] = {
136 | float2(1.0, 1.0),
137 | float2(0.0, -1.0),
138 | float2(-1.0, 1.0),
139 | float2(-1.0, -1.0),
140 | float2(0.0, 1.0),
141 | float2(0.0, -1.0),
142 | float2(1.0, 0.0),
143 | float2(-1.0, 0.0)
144 | };
145 |
146 | for (int i = 0; i < 8; i++)
147 | {
148 | float2 bloomuv = offset[i] * ReShade::PixelSize * 4;
149 | bloomuv += texcoord;
150 | bloom += tex2Dlod(SamplerBloom1, float4(bloomuv, 0, 0));
151 | }
152 |
153 | bloom *= 0.125;
154 | }
155 | void BloomPass2(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
156 | {
157 | bloom = 0.0;
158 |
159 | const float2 offset[8] = {
160 | float2(0.707, 0.707),
161 | float2(0.707, -0.707),
162 | float2(-0.707, 0.707),
163 | float2(-0.707, -0.707),
164 | float2(0.0, 1.0),
165 | float2(0.0, -1.0),
166 | float2(1.0, 0.0),
167 | float2(-1.0, 0.0)
168 | };
169 |
170 | for (int i = 0; i < 8; i++)
171 | {
172 | float2 bloomuv = offset[i] * ReShade::PixelSize * 8;
173 | bloomuv += texcoord;
174 | bloom += tex2Dlod(SamplerBloom2, float4(bloomuv, 0, 0));
175 | }
176 |
177 | bloom *= 0.5; // brighten up the sample, it will lose brightness in H/V Gaussian blur
178 | }
179 | void BloomPass3(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
180 | {
181 | bloom = GaussBlur22(texcoord.xy, SamplerBloom3, 16, 0, 0);
182 | bloom.w *= fAnamFlareAmount;
183 | }
184 | void BloomPass4(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
185 | {
186 | bloom.w = GaussBlur22(texcoord, SamplerBloom4, 32 * fAnamFlareWideness, 0, 0).w * 2.5; // to have anamflare texture (bloom.w) avoid vertical blur
187 | }
188 |
189 | void LightingCombine(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
190 | {
191 | color = tex2D(ReShade::BackBuffer, texcoord);
192 |
193 | // Anamorphic flare
194 | if (bAnamFlareEnable)
195 | {
196 | float3 anamflare = tex2D(SamplerBloom5, texcoord.xy).w * 2 * fAnamFlareColor;
197 | anamflare = max(anamflare, 0.0);
198 | color.rgb += pow(anamflare, 1.0 / fAnamFlareCurve);
199 | }
200 | }
201 |
202 | technique AnamorphicFlare
203 | {
204 | pass BloomPass0
205 | {
206 | VertexShader = PostProcessVS;
207 | PixelShader = BloomPass0;
208 | RenderTarget = texBloom1;
209 | }
210 | pass BloomPass1
211 | {
212 | VertexShader = PostProcessVS;
213 | PixelShader = BloomPass1;
214 | RenderTarget = texBloom2;
215 | }
216 | pass BloomPass2
217 | {
218 | VertexShader = PostProcessVS;
219 | PixelShader = BloomPass2;
220 | RenderTarget = texBloom3;
221 | }
222 | pass BloomPass3
223 | {
224 | VertexShader = PostProcessVS;
225 | PixelShader = BloomPass3;
226 | RenderTarget = texBloom4;
227 | }
228 | pass BloomPass4
229 | {
230 | VertexShader = PostProcessVS;
231 | PixelShader = BloomPass4;
232 | RenderTarget = texBloom5;
233 | }
234 |
235 | pass LightingCombine
236 | {
237 | VertexShader = PostProcessVS;
238 | PixelShader = LightingCombine;
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/Custom/AnamFlare.fx:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009-2015 Gilcher Pascal aka Marty McFly
2 |
3 | uniform bool bAnamFlareEnable <
4 | > = false;
5 | uniform float fAnamFlareThreshold <
6 | ui_type = "slider";
7 | ui_min = 0.1; ui_max = 1.0;
8 | ui_tooltip = "Every pixel brighter than this value gets a flare.";
9 | > = 0.9;
10 | uniform float fAnamFlareWideness <
11 | ui_type = "slider";
12 | ui_min = 1.0; ui_max = 2.5;
13 | ui_tooltip = "Horizontal wideness of flare. Don't set too high, otherwise the single samples are visible.";
14 | > = 2.4;
15 | uniform float fAnamFlareAmount <
16 | ui_type = "slider";
17 | ui_min = 1.0; ui_max = 20.0;
18 | ui_tooltip = "Intensity of anamorphic flare.";
19 | > = 14.5;
20 | uniform float fAnamFlareCurve <
21 | ui_type = "slider";
22 | ui_min = 1.0; ui_max = 2.0;
23 | ui_tooltip = "Intensity curve of flare with distance from source.";
24 | > = 1.2;
25 | uniform float3 fAnamFlareColor <
26 | ui_type = "color";
27 | ui_tooltip = "R, G and B components of anamorphic flare. Flare is always same color.";
28 | > = float3(0.012, 0.313, 0.588);
29 |
30 | // If 1, only pixels with depth = 1 get lens flares
31 | // This prevents white objects from getting lens flares sources, which would normally happen in LDR
32 | #ifndef FLARE_DEPTH_CHECK
33 | #define FLARE_DEPTH_CHECK 0
34 | #endif
35 |
36 | // texture texDirt2 < source = "LensDB.png"; > { Width = 1920; Height = 1080; Format = RGBA8; };
37 | // texture texSprite2 < source = ""; > { Width = 1920; Height = 1080; Format = RGBA8; };
38 |
39 | // sampler SamplerDirt2 { Texture = texDirt2; };
40 | // sampler SamplerSprite2 { Texture = texSprite2; };
41 |
42 | texture texBloom1
43 | {
44 | Width = BUFFER_WIDTH / 2;
45 | Height = BUFFER_HEIGHT / 2;
46 | Format = RGBA16F;
47 | };
48 | texture texBloom2
49 | {
50 | Width = BUFFER_WIDTH / 2;
51 | Height = BUFFER_HEIGHT / 2;
52 | Format = RGBA16F;
53 | };
54 | texture texBloom3
55 | {
56 | Width = BUFFER_WIDTH / 2;
57 | Height = BUFFER_HEIGHT / 2;
58 | Format = RGBA16F;
59 | };
60 | texture texBloom4
61 | {
62 | Width = BUFFER_WIDTH / 4;
63 | Height = BUFFER_HEIGHT / 4;
64 | Format = RGBA16F;
65 | };
66 | texture texBloom5
67 | {
68 | Width = BUFFER_WIDTH / 8;
69 | Height = BUFFER_HEIGHT / 8;
70 | Format = RGBA16F;
71 | };
72 |
73 | sampler SamplerBloom1 { Texture = texBloom1; };
74 | sampler SamplerBloom2 { Texture = texBloom2; };
75 | sampler SamplerBloom3 { Texture = texBloom3; };
76 | sampler SamplerBloom4 { Texture = texBloom4; };
77 | sampler SamplerBloom5 { Texture = texBloom5; };
78 |
79 | #include "ReShade.fxh"
80 |
81 | float4 GaussBlur22(float2 coord, sampler tex, float mult, float lodlevel, bool isBlurVert)
82 | {
83 | float4 sum = 0;
84 | float2 axis = isBlurVert ? float2(0, 1) : float2(1, 0);
85 |
86 | const float weight[11] = {
87 | 0.082607,
88 | 0.080977,
89 | 0.076276,
90 | 0.069041,
91 | 0.060049,
92 | 0.050187,
93 | 0.040306,
94 | 0.031105,
95 | 0.023066,
96 | 0.016436,
97 | 0.011254
98 | };
99 |
100 | for (int i = -10; i < 11; i++)
101 | {
102 | float currweight = weight[abs(i)];
103 | sum += tex2Dlod(tex, float4(coord.xy + axis.xy * (float)i * ReShade::PixelSize * mult, 0, lodlevel)) * currweight;
104 | }
105 |
106 | return sum;
107 | }
108 |
109 | void BloomPass0(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
110 | {
111 | bloom = 0.0;
112 |
113 | const float2 offset[4] = {
114 | float2(1.0, 1.0),
115 | float2(1.0, 1.0),
116 | float2(-1.0, 1.0),
117 | float2(-1.0, -1.0)
118 | };
119 |
120 | for (int i = 0; i < 4; i++)
121 | {
122 | float2 bloomuv = offset[i] * ReShade::PixelSize.xy * 2;
123 | bloomuv += texcoord;
124 | float4 tempbloom = tex2Dlod(ReShade::BackBuffer, float4(bloomuv.xy, 0, 0));
125 | tempbloom.w = max(0, dot(tempbloom.xyz, 0.333) - fAnamFlareThreshold);
126 | bloom += tempbloom;
127 | }
128 |
129 | bloom *= 0.25;
130 | }
131 | void BloomPass1(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
132 | {
133 | bloom = 0.0;
134 |
135 | const float2 offset[8] = {
136 | float2(1.0, 1.0),
137 | float2(0.0, -1.0),
138 | float2(-1.0, 1.0),
139 | float2(-1.0, -1.0),
140 | float2(0.0, 1.0),
141 | float2(0.0, -1.0),
142 | float2(1.0, 0.0),
143 | float2(-1.0, 0.0)
144 | };
145 |
146 | for (int i = 0; i < 8; i++)
147 | {
148 | float2 bloomuv = offset[i] * ReShade::PixelSize * 4;
149 | bloomuv += texcoord;
150 | bloom += tex2Dlod(SamplerBloom1, float4(bloomuv, 0, 0));
151 | }
152 |
153 | bloom *= 0.125;
154 | }
155 | void BloomPass2(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
156 | {
157 | bloom = 0.0;
158 |
159 | const float2 offset[8] = {
160 | float2(0.707, 0.707),
161 | float2(0.707, -0.707),
162 | float2(-0.707, 0.707),
163 | float2(-0.707, -0.707),
164 | float2(0.0, 1.0),
165 | float2(0.0, -1.0),
166 | float2(1.0, 0.0),
167 | float2(-1.0, 0.0)
168 | };
169 |
170 | for (int i = 0; i < 8; i++)
171 | {
172 | float2 bloomuv = offset[i] * ReShade::PixelSize * 8;
173 | bloomuv += texcoord;
174 | bloom += tex2Dlod(SamplerBloom2, float4(bloomuv, 0, 0));
175 | }
176 |
177 | bloom *= 0.5; // brighten up the sample, it will lose brightness in H/V Gaussian blur
178 | }
179 | void BloomPass3(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
180 | {
181 | bloom = GaussBlur22(texcoord.xy, SamplerBloom3, 16, 0, 0);
182 | bloom.w *= fAnamFlareAmount;
183 | }
184 | void BloomPass4(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 bloom : SV_Target)
185 | {
186 | bloom.w = GaussBlur22(texcoord, SamplerBloom4, 32 * fAnamFlareWideness, 0, 0).w * 2.5; // to have anamflare texture (bloom.w) avoid vertical blur
187 | }
188 |
189 | void LightingCombine(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
190 | {
191 | color = tex2D(ReShade::BackBuffer, texcoord);
192 |
193 | // Anamorphic flare
194 | if (bAnamFlareEnable)
195 | {
196 | float3 anamflare = tex2D(SamplerBloom5, texcoord.xy).w * 2 * fAnamFlareColor;
197 | anamflare = max(anamflare, 0.0);
198 | color.rgb += pow(anamflare, 1.0 / fAnamFlareCurve);
199 | }
200 | }
201 |
202 | technique AnamorphicFlare
203 | {
204 | pass BloomPass0
205 | {
206 | VertexShader = PostProcessVS;
207 | PixelShader = BloomPass0;
208 | RenderTarget = texBloom1;
209 | }
210 | pass BloomPass1
211 | {
212 | VertexShader = PostProcessVS;
213 | PixelShader = BloomPass1;
214 | RenderTarget = texBloom2;
215 | }
216 | pass BloomPass2
217 | {
218 | VertexShader = PostProcessVS;
219 | PixelShader = BloomPass2;
220 | RenderTarget = texBloom3;
221 | }
222 | pass BloomPass3
223 | {
224 | VertexShader = PostProcessVS;
225 | PixelShader = BloomPass3;
226 | RenderTarget = texBloom4;
227 | }
228 | pass BloomPass4
229 | {
230 | VertexShader = PostProcessVS;
231 | PixelShader = BloomPass4;
232 | RenderTarget = texBloom5;
233 | }
234 |
235 | pass LightingCombine
236 | {
237 | VertexShader = PostProcessVS;
238 | PixelShader = LightingCombine;
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_global.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | //Helpers for all sorts of device queries
21 |
22 | #define GPU_VENDOR_NVIDIA 0x10DE
23 | #define GPU_VENDOR_AMD 0x1002
24 | #define GPU_VENDOR_INTEL 0x8086
25 |
26 | #define RENDERER_D3D9 0x9000
27 | #define RENDERER_D3D10 0xA000 //>=
28 | #define RENDERER_D3D11 0xB000 //>=
29 | #define RENDERER_D3D12 0xC000 //>=
30 | #define RENDERER_OPENGL 0x10000 //>=
31 | #define RENDERER_VULKAN 0x20000 //>=
32 |
33 | #if __RENDERER__ >= RENDERER_D3D11
34 | #define _COMPUTE_SUPPORTED 1
35 | #else
36 | #define _COMPUTE_SUPPORTED 0
37 | #endif
38 |
39 | #if __RENDERER__ >= RENDERER_D3D10
40 | #define _BITWISE_SUPPORTED 1
41 | #else
42 | #define _BITWISE_SUPPORTED 0
43 | #endif
44 |
45 | //Frequently used things / ReShade FX extensions
46 |
47 | static const float2 BUFFER_PIXEL_SIZE = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
48 | static const uint2 BUFFER_SCREEN_SIZE = uint2(BUFFER_WIDTH, BUFFER_HEIGHT);
49 | static const float2 BUFFER_ASPECT_RATIO = float2(1.0, BUFFER_WIDTH * BUFFER_RCP_HEIGHT);
50 |
51 | //DLSS/FSR/XeSS/TAAU compatibility features
52 |
53 | #define DLSS_QUALITY 0.66666666 // 1 / 1.5
54 | #define DLSS_BALANCED 0.58000000 // 1 / 1.72
55 | #define DLSS_PERFORMANCE 0.50000000 // 1 / 2.0
56 | #define DLSS_ULTRA_PERFORMANCE 0.33333333 // 1 / 3.0
57 |
58 | #define FSR_ULTRA_QUALITY 0.77000000 // 1 / 1.3
59 | #define FSR_QUALITY 0.66666666 // 1 / 1.5
60 | #define FSR_BALANCED 0.58823529 // 1 / 1.7
61 | #define FSR_PERFORMANCE 0.50000000 // 1 / 2.0
62 |
63 | //if we write it this way instead of ifdef, ReShade won't add this to the GUI
64 | #ifdef _MARTYSMODS_TAAU_SCALE //this works with both the "enum" above and actual literals like 0.5
65 |
66 | //use the shit we have
67 | #define BUFFER_WIDTH_DLSS int(BUFFER_WIDTH * _MARTYSMODS_TAAU_SCALE + 0.5)
68 | #define BUFFER_HEIGHT_DLSS int(BUFFER_HEIGHT * _MARTYSMODS_TAAU_SCALE + 0.5)
69 | #define BUFFER_RCP_WIDTH_DLSS (1.0 / (BUFFER_WIDTH_DLSS))
70 | #define BUFFER_RCP_HEIGHT_DLSS (1.0 / (BUFFER_HEIGHT_DLSS))
71 |
72 | #else
73 |
74 | #define BUFFER_WIDTH_DLSS BUFFER_WIDTH
75 | #define BUFFER_HEIGHT_DLSS BUFFER_HEIGHT
76 | #define BUFFER_RCP_WIDTH_DLSS BUFFER_RCP_WIDTH
77 | #define BUFFER_RCP_HEIGHT_DLSS BUFFER_RCP_HEIGHT
78 |
79 | #endif
80 |
81 | static const float2 BUFFER_PIXEL_SIZE_DLSS = float2(BUFFER_RCP_WIDTH_DLSS, BUFFER_RCP_HEIGHT_DLSS);
82 | static const uint2 BUFFER_SCREEN_SIZE_DLSS = uint2(BUFFER_WIDTH_DLSS, BUFFER_HEIGHT_DLSS);
83 | static const float2 BUFFER_ASPECT_RATIO_DLSS = float2(1.0, BUFFER_WIDTH_DLSS * BUFFER_RCP_HEIGHT_DLSS);
84 |
85 | void FullscreenTriangleVS(in uint id : SV_VertexID, out float4 vpos : SV_Position, out float2 uv : TEXCOORD)
86 | {
87 | uv = id.xx == uint2(2, 1) ? 2.0.xx : 0.0.xx;
88 | vpos = float4(uv * float2(2, -2) + float2(-1, 1), 0, 1);
89 | }
90 |
91 | struct PSOUT1
92 | {
93 | float4 t0 : SV_Target0;
94 | };
95 | struct PSOUT2
96 | {
97 | float4 t0 : SV_Target0,
98 | t1 : SV_Target1;
99 | };
100 | struct PSOUT3
101 | {
102 | float4 t0 : SV_Target0,
103 | t1 : SV_Target1,
104 | t2 : SV_Target2;
105 | };
106 | struct PSOUT4
107 | {
108 | float4 t0 : SV_Target0,
109 | t1 : SV_Target1,
110 | t2 : SV_Target2,
111 | t3 : SV_Target3;
112 | };
113 |
114 | //why is smoothstep a thing but not this also...
115 | #define linearstep(_a, _b, _x) saturate(((_x) - (_a)) * rcp((_b) - (_a)))
116 | //why is log10 a thing but not this also...
117 | #define exp10(_x) pow(10.0, (_x))
118 | //why 1e-8? On some platforms the compiler truncates smaller constants? idfk, caused lots of trouble before...
119 | #define safenormalize(_x) ((_x) * rsqrt(max(1e-8, dot((_x), (_x)))))
120 | //condition true selects left in ternary but right in lerp, lerp is more intuitive but produces more instructions
121 | //this is (the?) solution for that
122 | #define select(_lhs, _rhs, _cond) (_cond)?(_rhs):(_lhs)
123 | //quite often I need to dot a vector with itself but don't necessarily want to create a new variable for it
124 | #define dot2(_x) dot((_x), (_x))
125 |
126 | #define MAX3(_type) _type max3(_type a, _type b, _type c){ return max(max(a, b), c);}
127 | #define MAX4(_type) _type max4(_type a, _type b, _type c, _type d){ return max(max(a, b), max(c, d));}
128 | #define MIN3(_type) _type min3(_type a, _type b, _type c){ return min(min(a, b), c);}
129 | #define MIN4(_type) _type min4(_type a, _type b, _type c, _type d){ return min(min(a, b), min(c, d));}
130 | #define MED3(_type) _type med3(_type a, _type b, _type c) { return clamp(a, min(b, c), max(b, c));}
131 |
132 | MAX3(float)MAX3(float2)MAX3(float3)MAX3(float4)MAX3(int)MAX3(int2)MAX3(int3)MAX3(int4)
133 | MAX4(float)MAX4(float2)MAX4(float3)MAX4(float4)MAX4(int)MAX4(int2)MAX4(int3)MAX4(int4)
134 | MIN3(float)MIN3(float2)MIN3(float3)MIN3(float4)MIN3(int)MIN3(int2)MIN3(int3)MIN3(int4)
135 | MIN4(float)MIN4(float2)MIN4(float3)MIN4(float4)MIN4(int)MIN4(int2)MIN4(int3)MIN4(int4)
136 | MED3(float)MED3(int)
137 |
138 | #undef MAX3
139 | #undef MAX4
140 | #undef MIN3
141 | #undef MIN4
142 | #undef MED3
143 |
144 | float maxc(float t) {return t;}
145 | float maxc(float2 t) {return max(t.x, t.y);}
146 | float maxc(float3 t) {return max3(t.x, t.y, t.z);}
147 | float maxc(float4 t) {return max4(t.x, t.y, t.z, t.w);}
148 | float minc(float t) {return t;}
149 | float minc(float2 t) {return min(t.x, t.y);}
150 | float minc(float3 t) {return min3(t.x, t.y, t.z);}
151 | float minc(float4 t) {return min4(t.x, t.y, t.z, t.w);}
152 | float medc(float3 t) {return med3(t.x, t.y, t.z);}
153 |
154 | float4 tex2Dlod(sampler s, float2 uv, float mip)
155 | {
156 | return tex2Dlod(s, float4(uv, 0, mip));
157 | }
158 |
159 | //log2 macro for uints up to 16 bit, inefficient in runtime but preprocessor doesn't care
160 | #define T1(x,n) ((uint(x)>>(n))>0)
161 | #define T2(x,n) (T1(x,n)+T1(x,n+1))
162 | #define T4(x,n) (T2(x,n)+T2(x,n+2))
163 | #define T8(x,n) (T4(x,n)+T4(x,n+4))
164 | #define LOG2(x) (T8(x,0)+T8(x,8))
165 |
166 | #define CEIL_DIV(num, denom) ((((num) - 1) / (denom)) + 1)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FFXIV Enhanced Game Play
2 |
3 | | **中文** | [English](README_EN.md) |
4 |
5 | 
6 |
7 | 一个相对温和的用于《最终幻想XIV》的ReShade预设,适合绝大多数日常游玩场景,包含了一些改进过的 Shaders。
8 |
9 | 与大多数用于摄影的预设的目的不同,这个预设的目的是优化日常游玩体验,所以将泛用性放在第一位,它几乎适用于任何游玩场景,接近于画面原始意图,并且不会造成视觉上的困扰(太亮/太黑/太鲜艳)。
10 | 本预设通过一些相对的克制改动来解决一些游戏常常被诟病的问题,并增加一些质感,同时针对剧情和轻量拍摄提供了一些快捷预设。
11 |
12 | > 本文档中所有图片均为该预设下的截图,无任何其它额外调整
13 |
14 | ## 针对7.0的更新
15 |
16 | 7.0的光照有了不小的改进,相比以往高光过饱与死亡打光缓解了一些,所以整体改动为降低一些颜色相关效果的强度,整体风格并没有什么变化。
17 | 另外还更新了 AO 和 GI 的 Shader。
18 |
19 | * 现在 Max 和 Balance 都使用更高效准确的 [MartysMods_MXAO](https://github.com/martymcmodding/iMMERSE/blob/main/Shaders/MartysMods_MXAO.fx),现在两者效果非常接近了。而 Lite 则继续使用 [Glamayre_Fast_Effects](https://github.com/rj200/Glamarye_Fast_Effects_for_ReShade/blob/main/Shaders/Glamayre_Fast_Effects.fx) 的快速 AO。
20 | * Max 新增了 [RadiantGI](https://github.com/BlueSkyDefender/AstrayFX/commits/master/Shaders/RadiantGI.fx) 作为 GI 补充,大部分地方并不会有非常明显的效果,但是开销非常大,建议在帧率不敏感的环境下使用。
21 | * 考虑到 7.0 新增的 DLSS 和 FSR,现在统一使用 CAS 锐化,轻微提高了锐化的强度。
22 |
23 | 另外现在 REST 的 UI 屏蔽方案没有开关切换的问题了,所以 FFKeepUIX 的使用也不再是必须的,默认不再启用 FFKeepUIX。
24 |
25 | 关于 REST,可以手动安装 [REST](https://github.com/4lex4nder/ReshadeEffectShaderToggler) 或者直接使用 [ReShade-CN2 整合包](https://github.com/liuxd17thu/reshade/)。
26 |
27 | 使用 REST 方案还可以解决 AO 盖住半透明物体(如眼镜、发梢等)的问题,如果有需要可以使用 [ReshadeEffectShaderToggler.ini](reshade-addons/ReshadeEffectShaderToggler.ini) 覆盖 REST 的配置文件。
28 |
29 | ## 这个预设解决了什么问题?
30 |
31 | 因为游戏本身的限制,没有任何预设可以面面俱到,而这个预设主要是针对以下几个问题进行了改进:
32 |
33 | 1. FFXIV 没有对高亮度的饱和度进行限制,所以会出现很多又亮又艳的颜色,比如标志性的水晶蓝色。这与常见的曝光表现不符,也是造成各种死亡打光的元凶之一。这个预设对高亮度的饱和度进行了限制,使得高亮度的颜色更加自然,同时还解决了各种荧光棒武器坐骑和画面格格不入的问题。
34 |
35 | 2. FFXIV 的整体画面偏黄绿,这是很多人都感觉“偏暖”的原因,尤其一些室内光会因为这种调色显得有些不真实和塑料感。这个预设对整体的颜色进行了微调,让整体颜色更偏中性。
36 |
37 | 3. FFXIV 缺乏 GI,这个预设使用了一个非常高效的 GI Shader,可以让物体轻微的染上环境的色调使整体观感更加一致,可以有效缓解一些场景中人物和物体像是P上去的感觉。例如沙滩上的物体会略微偏向沙子黄色的色调,草地上的物体会有一些绿色的色调,室内会根据环境呈现略微偏暖或偏冷的色调。
38 |
39 | 4. FFXIV 的 AO 表现比较的微妙,强弱两档比较生硬,HBAO的半径又过大,没有细节表现。这个预设添加了一些额外的AO,让人物和环境更具有立体感,表现更真实。
40 |
41 | 5. 使用了改进过的 FFKeepUI,可以解决部分职业量普遮罩的问题,并不会引入 REST 的解决方案的各种问题。
42 |
43 | 
44 |
45 | 除了上述改进,还进行了一些额外的调整使画面有些许“电影感”:
46 |
47 | 1. 略微压缩了黑白场,使得白色不会过亮(比如正午的海都地板,过场动画等),黑色对比度不会过高,中等亮度区域的整体对比度有所提升。
48 |
49 | 2. 轻微调整了红色与蓝色的平衡,类似常见影视作品,使得日出、黄昏等的偏场景更偏暖色,并使暗处、夜间略微偏向冷色调,从而增加些许氛围感。
50 |
51 | 3. 为过场剧情和轻度拍摄提供了自动和手动两个快捷的 DOF 预设,可以在不同场景下快速切换景深开关。
52 |
53 | > 该预设是在校色过的sRGB色域的显示器上建立和调整的,这也是用于游戏本身制作与渲染的色域。根据显示设备的不同可能会出现一些不同的结果,但整体趋向应该是相同的。
54 |
55 | 
56 |
57 | ## 预设详解
58 |
59 | 本预设使用了一些自定义的 Shaders,并按照一定的规则与顺序组合而成。如果你对这些细节感兴趣,可以参考[这个文档](Shaders&Effects.md)。
60 |
61 | ## 使用方法
62 |
63 | ### 安装
64 |
65 | 该预设基于原版 ReShade,单独提供了一些 ReShade 没有包含和来自或改进于 GShade 的 Shaders。
66 |
67 | 1. 安装原版 ReShade,为简单起见你需要在安装时选择下载所有 ReShade 安装包提供的 Shader。当然你也可以使用 [ReShade-CN2 整合包](https://github.com/liuxd17thu/reshade/)
68 |
69 | 2. 将本预设中的文件复制到游戏目录下,合并 / 覆盖对应目录,一般情况下是 `reshade-shaders` 和 `reshade-presets` 两个目录。因为整合包里的一些 Shader 版本比较旧,所以需要覆盖。
70 |
71 | 3. 开启游戏,在 ReShade 的设置页中将`.\reshade-shaders\Shaders\Custom`加入Effect路径,如果你设置了`\reshade-shaders\Shaders\**`这种递归搜索路径,可以忽略这一步
72 |

73 |
74 | 5. 在 ReShade 的设置页中将 `Load only enabled effects` 关闭,否则将无法在性能模式下快速切换功能,同时建议开启底下的 `Group effect files with tabs instead of a tree`,这样在调整效果时就不会所有东西都混在一起了。
75 |

76 |

77 |
78 | 7. 游戏画面设置:
79 | * `FXAA`:开启。用于解决UI遮罩的问题,由 ReShade 来提供锐化
80 | * `临边昏暗`:关闭。由 ReShade 在更恰当的时候插入
81 | * `辉光`:建议开启。所有的后期辉光类效果都无法准确区分游戏中真正发光的部分。对于注重日常游玩和泛用性来的预设来说,自带辉光是最自然舒适的。
82 | * `水下扭曲`:根据需要调整,水下扭曲主要会影响基于深度的 Shader 而造成伪影,但实际游玩中并不一定会非常明显
83 | * 其它设置根据电脑配置调整
84 |
85 | 8. 在 ReShade 的主页面中选择 `Enhanced_XIV_GamePlay` 作为预设,预设分为 `Max`,`Balance` 和 `Lite` 三种,分别对应不同的性能开销,具体见下文。
86 |
87 | 9. 如果你需要处理诗人、占星和武僧的职业量普遮罩问题,请参考[这个文档中 FFKeepUIX 部分的使用方法](Shaders&Effects.md)。
88 |
89 | 
90 |
91 | ### 预置快捷键
92 |
93 | 可以按实际需求右键调整
94 |
95 | 1. F10:开关手动 DOF,用于偶尔拍摄,会根据鼠标位置自动调整焦点
96 | 2. F11:开关自动 DOF,用于为过场剧情提供自动景深
97 | 3. Shift + F10:开关 21:9 的黑边,不会遮挡 UI
98 | 4. Shift + F11:开关锐化和 AO 之外的所有效果
99 |
100 | 
101 |
102 | ## 配置对比
103 |
104 | 考虑不同配置,提供了三种性能开销不同的预设,它们的主要区别在于 AO 和锐化的使用。
105 |
106 | ### Enhanced_XIV_GamePlay_0_Max:最高预设
107 |
108 | * 使用 MartysMods_MXAO 提供高质量的 AO
109 | * 使用 Glamayre_Fast_Effects 提供粗略的 GI
110 | * 使用 RadiantGI 提供一些精细 GI (性能开销较大)
111 |
112 | ### Enhanced_XIV_GamePlay_1_Balance:平衡预设 【推荐】
113 |
114 | 性能开销为 Max 的 60% 左右
115 |
116 | * 使用 MartysMods_MXAO 提供高质量的 AO
117 | * 使用 Glamayre_Fast_Effects 提供粗略的 GI
118 |
119 | ### Enhanced_XIV_GamePlay_2_Lite:轻量预设
120 |
121 | 性能开销为 Max 的 35% 左右
122 |
123 | * 使用 Glamayre_Fast_Effects 提供 AO,效果不如上面的精细(不凑近看也还行嘛!)
124 | * 使用 Glamayre_Fast_Effects 提供粗略的 GI
125 | * 不使用 AnamorphicFlare 提供的镜头炫光效果
126 |
127 | ## 一些对比
128 |
129 | 
130 | ▲ Before / After : 缓解特定关照下脸部奇怪的过渡色,高光部分的颜色更加自然。头发与衣服的 AO 增加了立体感。
131 |
132 | 
133 | ▲ Before / After : 改善了室内灯光的奇怪的过于偏黄的色调。脸部的阴影表现更加真实。
134 |
135 | 
136 | ▲ Before / After : 动画城的光照有种微妙的上世代游戏的廉价感,调整后整体色调更和谐,同时保留了整体画面倾向。优化了导随体验。
137 |
138 | ## 一些随手拍
139 |
140 | 得益于 FFXIV 本身相对优秀的美术和场景设计,很多日常游玩经过的地方都具备一定的观赏性。虽然本预设不用于拍照,但些许电影化的处理对整体观感还是有帮助的。
141 |
142 | 
143 | 
144 | 
145 | 
146 | 
147 | 
148 | 
149 | 
150 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/CAS.fx:
--------------------------------------------------------------------------------
1 | // LICENSE
2 | // =======
3 | // Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
4 | // -------
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
7 | // modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | // -------
10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11 | // Software.
12 | // -------
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14 | // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
16 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
17 |
18 | //Initial port to ReShade: SLSNe https://gist.github.com/SLSNe/bbaf2d77db0b2a2a0755df581b3cf00c
19 |
20 | //Optimizations by Marty McFly:
21 | // vectorized math, even with scalar gcn hardware this should work
22 | // out the same, order of operations has not changed
23 | // For some reason, it went from 64 to 48 instructions, a lot of MOV gone
24 | // Also modified the way the final window is calculated
25 | //
26 | // reordered min() and max() operations, from 11 down to 9 registers
27 | //
28 | // restructured final weighting, 49 -> 48 instructions
29 | //
30 | // delayed RCP to replace SQRT with RSQRT
31 | //
32 | // removed the saturate() from the control var as it is clamped
33 | // by UI manager already, 48 -> 47 instructions
34 | //
35 | // replaced tex2D with tex2Doffset intrinsic (address offset by immediate integer)
36 | // 47 -> 43 instructions
37 | // 9 -> 8 registers
38 |
39 | //Further modified by OopyDoopy and Lord of Lunacy:
40 | // Changed wording in the UI for the existing variable and added a new variable and relevant code to adjust sharpening strength.
41 |
42 | //Fix by Lord of Lunacy:
43 | // Made the shader use a linear colorspace rather than sRGB, as recommended by the original AMD documentation from FidelityFX.
44 |
45 | //Modified by CeeJay.dk:
46 | // Included a label and tooltip description. I followed AMDs official naming guidelines for FidelityFX.
47 | //
48 | // Used gather trick to reduce the number of texture operations by one (9 -> 8). It's now 42 -> 51 instructions but still faster
49 | // because of the texture operation that was optimized away.
50 |
51 | //Fix by CeeJay.dk
52 | // Fixed precision issues with the gather at super high resolutions
53 | // Also tried to refactor the samples so more work can be done while they are being sampled, but it's not so easy and the gains
54 | // I'm seeing are so small they might be statistical noise. So it MIGHT be faster - no promises.
55 |
56 | //Fix by CeeJay.dk
57 | // Gather optimization is only faster on DX11 and up - Not DX10 and up. Correcting this so DX10 does not use the Gather codepath
58 |
59 | uniform float Contrast <
60 | ui_type = "drag";
61 | ui_label = "Contrast Adaptation";
62 | ui_tooltip = "Adjusts the range the shader adapts to high contrast (0 is not all the way off). Higher values = more high contrast sharpening.";
63 | ui_min = 0.0; ui_max = 1.0;
64 | > = 0.0;
65 |
66 | uniform float Sharpening <
67 | ui_type = "drag";
68 | ui_label = "Sharpening intensity";
69 | ui_tooltip = "Adjusts sharpening intensity by averaging the original pixels to the sharpened result. 1.0 is the unmodified default.";
70 | ui_min = 0.0; ui_max = 1.0;
71 | > = 1.0;
72 |
73 | #include "ReShade.fxh"
74 | #define pixel float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
75 |
76 | texture TexColor : COLOR;
77 | sampler sTexColor {Texture = TexColor; SRGBTexture = true;};
78 |
79 | float3 CASPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
80 | {
81 | // fetch a 3x3 neighborhood around the pixel 'e',
82 | // a b c
83 | // d(e)f
84 | // g h i
85 |
86 |
87 | float3 b = tex2Doffset(sTexColor, texcoord, int2(0, -1)).rgb;
88 | float3 d = tex2Doffset(sTexColor, texcoord, int2(-1, 0)).rgb;
89 |
90 |
91 | #if __RENDERER__ >= 0xb000 // If DX11 or higher
92 | float4 red_efhi = tex2DgatherR(sTexColor, texcoord + 0.5 * pixel);
93 |
94 | float3 e = float3( red_efhi.w, red_efhi.w, red_efhi.w);
95 | float3 f = float3( red_efhi.z, red_efhi.z, red_efhi.z);
96 | float3 h = float3( red_efhi.x, red_efhi.x, red_efhi.x);
97 | float3 i = float3( red_efhi.y, red_efhi.y, red_efhi.y);
98 |
99 | float4 green_efhi = tex2DgatherG(sTexColor, texcoord + 0.5 * pixel);
100 |
101 | e.g = green_efhi.w;
102 | f.g = green_efhi.z;
103 | h.g = green_efhi.x;
104 | i.g = green_efhi.y;
105 |
106 | float4 blue_efhi = tex2DgatherB(sTexColor, texcoord + 0.5 * pixel);
107 |
108 | e.b = blue_efhi.w;
109 | f.b = blue_efhi.z;
110 | h.b = blue_efhi.x;
111 | i.b = blue_efhi.y;
112 |
113 |
114 | #else // If DX9
115 | float3 e = tex2D(sTexColor, texcoord).rgb;
116 | float3 f = tex2Doffset(sTexColor, texcoord, int2(1, 0)).rgb;
117 |
118 | float3 h = tex2Doffset(sTexColor, texcoord, int2(0, 1)).rgb;
119 | float3 i = tex2Doffset(sTexColor, texcoord, int2(1, 1)).rgb;
120 |
121 | #endif
122 |
123 | float3 g = tex2Doffset(sTexColor, texcoord, int2(-1, 1)).rgb;
124 | float3 a = tex2Doffset(sTexColor, texcoord, int2(-1, -1)).rgb;
125 | float3 c = tex2Doffset(sTexColor, texcoord, int2(1, -1)).rgb;
126 |
127 |
128 | // Soft min and max.
129 | // a b c b
130 | // d e f * 0.5 + d e f * 0.5
131 | // g h i h
132 | // These are 2.0x bigger (factored out the extra multiply).
133 | float3 mnRGB = min(min(min(d, e), min(f, b)), h);
134 | float3 mnRGB2 = min(mnRGB, min(min(a, c), min(g, i)));
135 | mnRGB += mnRGB2;
136 |
137 | float3 mxRGB = max(max(max(d, e), max(f, b)), h);
138 | float3 mxRGB2 = max(mxRGB, max(max(a, c), max(g, i)));
139 | mxRGB += mxRGB2;
140 |
141 | // Smooth minimum distance to signal limit divided by smooth max.
142 | float3 rcpMRGB = rcp(mxRGB);
143 | float3 ampRGB = saturate(min(mnRGB, 2.0 - mxRGB) * rcpMRGB);
144 |
145 | // Shaping amount of sharpening.
146 | ampRGB = rsqrt(ampRGB);
147 |
148 | float peak = -3.0 * Contrast + 8.0;
149 | float3 wRGB = -rcp(ampRGB * peak);
150 |
151 | float3 rcpWeightRGB = rcp(4.0 * wRGB + 1.0);
152 |
153 | // 0 w 0
154 | // Filter shape: w 1 w
155 | // 0 w 0
156 | float3 window = (b + d) + (f + h);
157 | float3 outColor = saturate((window * wRGB + e) * rcpWeightRGB);
158 |
159 | return lerp(e, outColor, Sharpening);
160 | }
161 |
162 | technique ContrastAdaptiveSharpen
163 | <
164 | ui_label = "AMD FidelityFX Contrast Adaptive Sharpening";
165 | ui_tooltip =
166 | "CAS is a low overhead adaptive sharpening algorithm that AMD includes with their drivers.\n"
167 | "This port to Reshade works with all cards from all vendors,\n"
168 | "but cannot do the optional scaling that CAS is normally also capable of when activated in the AMD drivers.\n"
169 | "\n"
170 | "The algorithm adjusts the amount of sharpening per pixel to target an even level of sharpness across the image.\n"
171 | "Areas of the input image that are already sharp are sharpened less, while areas that lack detail are sharpened more.\n"
172 | "This allows for higher overall natural visual sharpness with fewer artifacts.";
173 | >
174 | {
175 | pass
176 | {
177 | VertexShader = PostProcessVS;
178 | PixelShader = CASPass;
179 | SRGBWriteEnable = true;
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/AstrayFX/OneShot/Limbo_Mod.fx:
--------------------------------------------------------------------------------
1 | ////-------------//
2 | ///**Limbo Mod**///
3 | //-------------////
4 |
5 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 | //* Super Simple Limbo Like Shader implementation:
7 | //* For ReShade 3.0+
8 | //* ---------------------------------
9 | //* Limbo Mod
10 | //* Due Diligence
11 | //* https://reshade.me
12 | //* https://github.com/crosire/reshade-shaders/blob/a9ab2880eebf5b1b29cad0a16a5f0910fad52492/Shaders/DisplayDepth.fx
13 | //*
14 | //*
15 | //* LICENSE
16 | //* ============
17 | //* Limbo Mod is licenses under: Attribution 2.0 Generic (CC BY 2.0)l
18 | //*
19 | //* You are free to:
20 | //* Share - copy and redistribute the material in any medium or format.
21 | //* Adapt - remix, transform, and build upon the material for any purpose, even commercially.
22 | //*
23 | //* The licensor cannot revoke these freedoms as long as you follow the license terms.
24 | //*
25 | //* Under the following terms:
26 | //* Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made.
27 | //* You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
28 | //*
29 | //* No additional restrictions - You may not apply legal terms or technological measures that legally restrict others
30 | //* from doing anything the license permits.
31 | //*
32 | //* https://creativecommons.org/licenses/by/2.0/
33 | //*
34 | //* Have fun,
35 | //* Jose Negrete AKA BlueSkyDefender
36 | //*
37 | //* https://github.com/BlueSkyDefender/Depth3D
38 | //* April 1 2021
39 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
40 |
41 | #include "ReShade.fxh"
42 |
43 | uniform float G_Radius<
44 | ui_type = "slider";
45 | ui_min = 0.0; ui_max = 1.00;
46 | ui_label = "Subtle Blur Radius";
47 | ui_tooltip = "Increase persistence of the frames this is really the Temporal Part.\n"
48 | "Default is 0.625. But, a value around 0.625 is recommended.";
49 | ui_category = "Limbo Lighting";
50 | > = 0.5;
51 |
52 | uniform float Target_Lighting <
53 | ui_type = "slider";
54 | ui_min = 0.0; ui_max = 1.00;
55 | ui_label = "Target Lighting";
56 | ui_tooltip = "Use this to target the brighter areas of the game.\n"
57 | "Default is 0.5. But, any value around 0 - 2 can be used.";
58 | ui_category = "Limbo Lighting";
59 | > = 0.5;
60 |
61 | uniform float2 Depth_Map_Adjust <
62 | ui_type = "slider";
63 | ui_min = 0.0; ui_max = 1.0;
64 | ui_label = "Depth Near and Far";
65 | ui_tooltip = "Adjust the depth map precision near and far.";
66 | ui_category = "Depth Buffer";
67 | > = float2(0.075,0.750);
68 |
69 | uniform float Dither_Bit <
70 | ui_type = "drag";
71 | ui_min = 1; ui_max = 15;
72 | ui_label = "Dither Bit";
73 | ui_tooltip = "Dither is an intentionally applied form of noise used to randomize quantization error, preventing banding in images.";
74 | ui_category = "Depth Buffer";
75 | > = 8;
76 |
77 |
78 | /////////////////////////////////////////////D3D Starts Here/////////////////////////////////////////////////////////////////
79 | #define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
80 |
81 | texture DepthBufferTex : DEPTH;
82 |
83 | sampler DepthBuffer
84 | {
85 | Texture = DepthBufferTex;
86 | };
87 |
88 | texture BackBufferTex : COLOR;
89 |
90 | sampler BackBuffer
91 | {
92 | Texture = BackBufferTex;
93 | };
94 |
95 | texture Mips_Buffer_A { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;MipLevels = 4;};
96 |
97 | sampler MipMaps_A
98 | {
99 | Texture = Mips_Buffer_A;
100 | };
101 |
102 | texture Mips_Buffer_B { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;MipLevels = 4;};
103 |
104 | sampler MipMaps_B
105 | {
106 | Texture = Mips_Buffer_B;
107 | };
108 | uniform float frametime < source = "frametime"; >;
109 | float DepthM(float2 texcoord)
110 | {
111 | float zBuffer = ReShade::GetLinearizedDepth(texcoord).x;
112 |
113 | zBuffer = (zBuffer - Depth_Map_Adjust.x)/(Depth_Map_Adjust.y - Depth_Map_Adjust.x);
114 | // Dither for DepthBuffer adapted from gedosato ramdom dither https://github.com/PeterTh/gedosato/blob/master/pack/assets/dx9/deband.fx
115 | // I noticed in some games the depth buffer started to have banding so this is used to remove that.
116 |
117 | float DB = Dither_Bit;
118 | float noise = frac(sin(dot(texcoord * frametime, float2(12.9898, 78.233))) * 43758.5453);
119 | float dither_shift = (1.0 / (pow(2,DB) - 1.0));
120 | float dither_shift_half = (dither_shift * 0.5);
121 | dither_shift = dither_shift * noise - dither_shift_half;
122 |
123 | zBuffer += -dither_shift;
124 | zBuffer += dither_shift;
125 | zBuffer += -dither_shift;
126 |
127 | // Dither End
128 |
129 | return zBuffer;
130 | }
131 |
132 | float4 BB_M(float2 TC)
133 | {
134 | return tex2D(BackBuffer, TC );
135 | }
136 |
137 |
138 | float4 DirectLighting(float2 texcoords )
139 | {
140 | float4 BC = BB_M(texcoords);
141 |
142 | float GS = dot(BC.rgb,0.333), Boost = 1;
143 |
144 | BC.rgb /= GS;
145 | BC.rgb *= saturate(GS - lerp(0.0,0.5,saturate(Target_Lighting)));
146 | Boost = lerp(1,2.5,saturate(Target_Lighting));
147 |
148 | return float4(BC.rgb * Boost,BC.a);
149 | }
150 |
151 | float4 GussBlur(sampler image, float2 TC, int dir, float Mips)
152 | {
153 | //direction
154 | float W0 = G_Radius > 0 ? 0.1964825501511404 : 1, W1 = 0.2969069646728344, W2 = 0.09447039785044732, W3 = 0.010381362401148057;
155 | float2 off0 = pix * lerp(0,5,G_Radius);
156 | float2 off1 = dir ? float2( 0, 1.411764705882353) * off0 : float2(1.411764705882353, 0) * off0;
157 | float2 off2 = dir ? float2( 0, 3.294117647058823) * off0 : float2(3.294117647058823, 0) * off0;
158 | float2 off3 = dir ? float2( 0, 5.176470588235294) * off0 : float2(5.176470588235294, 0) * off0;
159 | float4 color = tex2Dlod(image, float4(TC,0,Mips)) * W0;
160 | if(G_Radius > 0)
161 | {
162 | color += tex2Dlod(image, float4(TC + off1,0,Mips) ) * W1;
163 | color += tex2Dlod(image, float4(TC - off1,0,Mips) ) * W1;
164 | color += tex2Dlod(image, float4(TC + off2,0,Mips) ) * W2;
165 | color += tex2Dlod(image, float4(TC - off2,0,Mips) ) * W2;
166 | color += tex2Dlod(image, float4(TC + off2,0,Mips) ) * W3;
167 | color += tex2Dlod(image, float4(TC - off2,0,Mips) ) * W3;
168 | }
169 |
170 | return color;
171 | }
172 |
173 | void Buffers_Mip_A(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 MipMapper_A : SV_Target0)
174 | {
175 |
176 | MipMapper_A = DirectLighting( texcoord );
177 | }
178 |
179 | void Buffers_Mip_B(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 MipMapper_B : SV_Target0)
180 | {
181 |
182 | MipMapper_B = GussBlur(MipMaps_A, texcoord, 0, lerp(0,4,G_Radius));
183 | }
184 |
185 |
186 | float4 Out(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
187 | {
188 | float4 BWorColor = dot(GussBlur(MipMaps_B, texcoord, 1, lerp(0,4,G_Radius)),0.333);
189 | return DepthM(texcoord) + (dot(tex2Dlod(MipMaps_A,float4(texcoord,0,0)),0.333) * BWorColor );
190 | }
191 |
192 | technique Limbo_Mod
193 | {
194 | pass Mips_A
195 | {
196 | VertexShader = PostProcessVS;
197 | PixelShader = Buffers_Mip_A;
198 | RenderTarget0 = Mips_Buffer_A;
199 | }
200 | pass Mips_B
201 | {
202 | VertexShader = PostProcessVS;
203 | PixelShader = Buffers_Mip_B;
204 | RenderTarget0 = Mips_Buffer_B;
205 | }
206 | pass Out
207 | {
208 | VertexShader = PostProcessVS;
209 | PixelShader = Out;
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/AstrayFX/OneShot/Limbo_Mod.fx:
--------------------------------------------------------------------------------
1 | ////-------------//
2 | ///**Limbo Mod**///
3 | //-------------////
4 |
5 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 | //* Super Simple Limbo Like Shader implementation:
7 | //* For ReShade 3.0+
8 | //* ---------------------------------
9 | //* Limbo Mod
10 | //* Due Diligence
11 | //* https://reshade.me
12 | //* https://github.com/crosire/reshade-shaders/blob/a9ab2880eebf5b1b29cad0a16a5f0910fad52492/Shaders/DisplayDepth.fx
13 | //*
14 | //*
15 | //* LICENSE
16 | //* ============
17 | //* Limbo Mod is licenses under: Attribution 2.0 Generic (CC BY 2.0)l
18 | //*
19 | //* You are free to:
20 | //* Share - copy and redistribute the material in any medium or format.
21 | //* Adapt - remix, transform, and build upon the material for any purpose, even commercially.
22 | //*
23 | //* The licensor cannot revoke these freedoms as long as you follow the license terms.
24 | //*
25 | //* Under the following terms:
26 | //* Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made.
27 | //* You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
28 | //*
29 | //* No additional restrictions - You may not apply legal terms or technological measures that legally restrict others
30 | //* from doing anything the license permits.
31 | //*
32 | //* https://creativecommons.org/licenses/by/2.0/
33 | //*
34 | //* Have fun,
35 | //* Jose Negrete AKA BlueSkyDefender
36 | //*
37 | //* https://github.com/BlueSkyDefender/Depth3D
38 | //* April 1 2021
39 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
40 |
41 | #include "ReShade.fxh"
42 |
43 | uniform float G_Radius<
44 | ui_type = "slider";
45 | ui_min = 0.0; ui_max = 1.00;
46 | ui_label = "Subtle Blur Radius";
47 | ui_tooltip = "Increase persistence of the frames this is really the Temporal Part.\n"
48 | "Default is 0.625. But, a value around 0.625 is recommended.";
49 | ui_category = "Limbo Lighting";
50 | > = 0.5;
51 |
52 | uniform float Target_Lighting <
53 | ui_type = "slider";
54 | ui_min = 0.0; ui_max = 1.00;
55 | ui_label = "Target Lighting";
56 | ui_tooltip = "Use this to target the brighter areas of the game.\n"
57 | "Default is 0.5. But, any value around 0 - 2 can be used.";
58 | ui_category = "Limbo Lighting";
59 | > = 0.5;
60 |
61 | uniform float2 Depth_Map_Adjust <
62 | ui_type = "slider";
63 | ui_min = 0.0; ui_max = 1.0;
64 | ui_label = "Depth Near and Far";
65 | ui_tooltip = "Adjust the depth map precision near and far.";
66 | ui_category = "Depth Buffer";
67 | > = float2(0.075,0.750);
68 |
69 | uniform float Dither_Bit <
70 | ui_type = "drag";
71 | ui_min = 1; ui_max = 15;
72 | ui_label = "Dither Bit";
73 | ui_tooltip = "Dither is an intentionally applied form of noise used to randomize quantization error, preventing banding in images.";
74 | ui_category = "Depth Buffer";
75 | > = 8;
76 |
77 |
78 | /////////////////////////////////////////////D3D Starts Here/////////////////////////////////////////////////////////////////
79 | #define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
80 |
81 | texture DepthBufferTex : DEPTH;
82 |
83 | sampler DepthBuffer
84 | {
85 | Texture = DepthBufferTex;
86 | };
87 |
88 | texture BackBufferTex : COLOR;
89 |
90 | sampler BackBuffer
91 | {
92 | Texture = BackBufferTex;
93 | };
94 |
95 | texture Mips_Buffer_A { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;MipLevels = 4;};
96 |
97 | sampler MipMaps_A
98 | {
99 | Texture = Mips_Buffer_A;
100 | };
101 |
102 | texture Mips_Buffer_B { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;MipLevels = 4;};
103 |
104 | sampler MipMaps_B
105 | {
106 | Texture = Mips_Buffer_B;
107 | };
108 | uniform float frametime < source = "frametime"; >;
109 | float DepthM(float2 texcoord)
110 | {
111 | float zBuffer = ReShade::GetLinearizedDepth(texcoord).x;
112 |
113 | zBuffer = (zBuffer - Depth_Map_Adjust.x)/(Depth_Map_Adjust.y - Depth_Map_Adjust.x);
114 | // Dither for DepthBuffer adapted from gedosato ramdom dither https://github.com/PeterTh/gedosato/blob/master/pack/assets/dx9/deband.fx
115 | // I noticed in some games the depth buffer started to have banding so this is used to remove that.
116 |
117 | float DB = Dither_Bit;
118 | float noise = frac(sin(dot(texcoord * frametime, float2(12.9898, 78.233))) * 43758.5453);
119 | float dither_shift = (1.0 / (pow(2,DB) - 1.0));
120 | float dither_shift_half = (dither_shift * 0.5);
121 | dither_shift = dither_shift * noise - dither_shift_half;
122 |
123 | zBuffer += -dither_shift;
124 | zBuffer += dither_shift;
125 | zBuffer += -dither_shift;
126 |
127 | // Dither End
128 |
129 | return zBuffer;
130 | }
131 |
132 | float4 BB_M(float2 TC)
133 | {
134 | return tex2D(BackBuffer, TC );
135 | }
136 |
137 |
138 | float4 DirectLighting(float2 texcoords )
139 | {
140 | float4 BC = BB_M(texcoords);
141 |
142 | float GS = dot(BC.rgb,0.333), Boost = 1;
143 |
144 | BC.rgb /= GS;
145 | BC.rgb *= saturate(GS - lerp(0.0,0.5,saturate(Target_Lighting)));
146 | Boost = lerp(1,2.5,saturate(Target_Lighting));
147 |
148 | return float4(BC.rgb * Boost,BC.a);
149 | }
150 |
151 | float4 GussBlur(sampler image, float2 TC, int dir, float Mips)
152 | {
153 | //direction
154 | float W0 = G_Radius > 0 ? 0.1964825501511404 : 1, W1 = 0.2969069646728344, W2 = 0.09447039785044732, W3 = 0.010381362401148057;
155 | float2 off0 = pix * lerp(0,5,G_Radius);
156 | float2 off1 = dir ? float2( 0, 1.411764705882353) * off0 : float2(1.411764705882353, 0) * off0;
157 | float2 off2 = dir ? float2( 0, 3.294117647058823) * off0 : float2(3.294117647058823, 0) * off0;
158 | float2 off3 = dir ? float2( 0, 5.176470588235294) * off0 : float2(5.176470588235294, 0) * off0;
159 | float4 color = tex2Dlod(image, float4(TC,0,Mips)) * W0;
160 | if(G_Radius > 0)
161 | {
162 | color += tex2Dlod(image, float4(TC + off1,0,Mips) ) * W1;
163 | color += tex2Dlod(image, float4(TC - off1,0,Mips) ) * W1;
164 | color += tex2Dlod(image, float4(TC + off2,0,Mips) ) * W2;
165 | color += tex2Dlod(image, float4(TC - off2,0,Mips) ) * W2;
166 | color += tex2Dlod(image, float4(TC + off2,0,Mips) ) * W3;
167 | color += tex2Dlod(image, float4(TC - off2,0,Mips) ) * W3;
168 | }
169 |
170 | return color;
171 | }
172 |
173 | void Buffers_Mip_A(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 MipMapper_A : SV_Target0)
174 | {
175 |
176 | MipMapper_A = DirectLighting( texcoord );
177 | }
178 |
179 | void Buffers_Mip_B(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 MipMapper_B : SV_Target0)
180 | {
181 |
182 | MipMapper_B = GussBlur(MipMaps_A, texcoord, 0, lerp(0,4,G_Radius));
183 | }
184 |
185 |
186 | float4 Out(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
187 | {
188 | float4 BWorColor = dot(GussBlur(MipMaps_B, texcoord, 1, lerp(0,4,G_Radius)),0.333);
189 | return DepthM(texcoord) + (dot(tex2Dlod(MipMaps_A,float4(texcoord,0,0)),0.333) * BWorColor );
190 | }
191 |
192 | technique Limbo_Mod
193 | {
194 | pass Mips_A
195 | {
196 | VertexShader = PostProcessVS;
197 | PixelShader = Buffers_Mip_A;
198 | RenderTarget0 = Mips_Buffer_A;
199 | }
200 | pass Mips_B
201 | {
202 | VertexShader = PostProcessVS;
203 | PixelShader = Buffers_Mip_B;
204 | RenderTarget0 = Mips_Buffer_B;
205 | }
206 | pass Out
207 | {
208 | VertexShader = PostProcessVS;
209 | PixelShader = Out;
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/brussell/EyeAdaption.fx:
--------------------------------------------------------------------------------
1 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 | // EyeAdaption by brussell
3 | // v. 2.32
4 | // License: CC BY 4.0
5 | //
6 | // Credits:
7 | // luluco250 - luminance get/store code from Magic Bloom
8 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 |
10 | //effect parameters
11 | uniform float fAdp_Delay <
12 | ui_label = "Adaption Delay";
13 | ui_tooltip = "How fast the image adapts to brightness changes.\n"
14 | "0 = instantanous adaption\n"
15 | "2 = very slow adaption";
16 | ui_category = "General settings";
17 | ui_type = "slider";
18 | ui_min = 0.0;
19 | ui_max = 2.0;
20 | > = 1.6;
21 |
22 | uniform float fAdp_TriggerRadius <
23 | ui_label = "Adaption TriggerRadius";
24 | ui_tooltip = "Screen area, whose average brightness triggers adaption.\n"
25 | "1 = only the center of the image is used\n"
26 | "7 = the whole image is used";
27 | ui_category = "General settings";
28 | ui_type = "slider";
29 | ui_min = 1.0;
30 | ui_max = 7.0;
31 | ui_step = 0.1;
32 | > = 6.0;
33 |
34 | uniform float fAdp_YAxisFocalPoint <
35 | ui_label = "Y Axis Focal Point";
36 | ui_tooltip = "Where along the Y Axis the Adaption TriggerRadius applies.\n"
37 | "0 = Top of the screen\n"
38 | "1 = Bottom of the screen";
39 | ui_category = "General settings";
40 | ui_type = "slider";
41 | ui_min = 0.0;
42 | ui_max = 1.0;
43 | > = 0.5;
44 |
45 | uniform float fAdp_Equilibrium <
46 | ui_label = "Adaption Equilibrium";
47 | ui_tooltip = "The value of image brightness for which there is no brightness adaption.\n"
48 | "0 = early brightening, late darkening\n"
49 | "1 = late brightening, early darkening";
50 | ui_category = "General settings";
51 | ui_type = "slider";
52 | ui_min = 0.0;
53 | ui_max = 1.0;
54 | > = 0.5;
55 |
56 | uniform float fAdp_Strength <
57 | ui_label = "Adaption Strength";
58 | ui_tooltip = "Base strength of brightness adaption.\n";
59 | ui_category = "General settings";
60 | ui_type = "slider";
61 | ui_min = 0.0;
62 | ui_max = 2.0;
63 | > = 1.0;
64 |
65 | uniform float fAdp_BrightenHighlights <
66 | ui_label = "Brighten Highlights";
67 | ui_tooltip = "Brightening strength for highlights.";
68 | ui_category = "Brightening";
69 | ui_type = "slider";
70 | ui_min = 0.0;
71 | ui_max = 1.0;
72 | > = 0.1;
73 |
74 | uniform float fAdp_BrightenMidtones <
75 | ui_label = "Brighten Midtones";
76 | ui_tooltip = "Brightening strength for midtones.";
77 | ui_category = "Brightening";
78 | ui_type = "slider";
79 | ui_min = 0.0;
80 | ui_max = 1.0;
81 | > = 0.2;
82 |
83 | uniform float fAdp_BrightenShadows <
84 | ui_label = "Brighten Shadows";
85 | ui_tooltip = "Brightening strength for shadows.\n"
86 | "Set this to 0 to preserve pure black.";
87 | ui_category = "Brightening";
88 | ui_type = "slider";
89 | ui_min = 0.0;
90 | ui_max = 1.0;
91 | > = 0.1;
92 |
93 | uniform float fAdp_DarkenHighlights <
94 | ui_label = "Darken Highlights";
95 | ui_tooltip = "Darkening strength for highlights.\n"
96 | "Set this to 0 to preserve pure white.";
97 | ui_category = "Darkening";
98 | ui_type = "slider";
99 | ui_min = 0.0;
100 | ui_max = 1.0;
101 | > = 0.1;
102 |
103 | uniform float fAdp_DarkenMidtones <
104 | ui_label = "Darken Midtones";
105 | ui_tooltip = "Darkening strength for midtones.";
106 | ui_category = "Darkening";
107 | ui_type = "slider";
108 | ui_min = 0.0;
109 | ui_max = 1.0;
110 | > = 0.2;
111 |
112 | uniform float fAdp_DarkenShadows <
113 | ui_label = "Darken Shadows";
114 | ui_tooltip = "Darkening strength for shadows.";
115 | ui_category = "Darkening";
116 | ui_type = "slider";
117 | ui_min = 0.0;
118 | ui_max = 1.0;
119 | > = 0.1;
120 |
121 | #include "ReShade.fxh"
122 |
123 | //global vars
124 | #define LumCoeff float3(0.212656, 0.715158, 0.072186)
125 | uniform float Frametime < source = "frametime"; >;
126 |
127 | //textures and samplers
128 | texture2D TexLuma { Width = 256; Height = 256; Format = R8; MipLevels = 7; };
129 | texture2D TexAvgLuma { Format = R16F; };
130 | texture2D TexAvgLumaLast { Format = R16F; };
131 |
132 | sampler SamplerLuma { Texture = TexLuma; };
133 | sampler SamplerAvgLuma { Texture = TexAvgLuma; };
134 | sampler SamplerAvgLumaLast { Texture = TexAvgLumaLast; };
135 |
136 | //pixel shaders
137 | float PS_Luma(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
138 | {
139 | float4 color = tex2Dlod(ReShade::BackBuffer, float4(texcoord, 0, 0));
140 | float luma = dot(color.xyz, LumCoeff);
141 | return luma;
142 | }
143 |
144 | float PS_AvgLuma(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
145 | {
146 | float avgLumaCurrFrame = tex2Dlod(SamplerLuma, float4(fAdp_YAxisFocalPoint.xx, 0, fAdp_TriggerRadius)).x;
147 | float avgLumaLastFrame = tex2Dlod(SamplerAvgLumaLast, float4(0.0.xx, 0, 0)).x;
148 | float delay = sign(fAdp_Delay) * saturate(0.815 + fAdp_Delay / 10.0 - Frametime / 1000.0);
149 | float avgLuma = lerp(avgLumaCurrFrame, avgLumaLastFrame, delay);
150 | return avgLuma;
151 | }
152 |
153 | float AdaptionDelta(float luma, float strengthMidtones, float strengthShadows, float strengthHighlights)
154 | {
155 | float midtones = (4.0 * strengthMidtones - strengthHighlights - strengthShadows) * luma * (1.0 - luma);
156 | float shadows = strengthShadows * (1.0 - luma);
157 | float highlights = strengthHighlights * luma;
158 | float delta = midtones + shadows + highlights;
159 | return delta;
160 | }
161 |
162 | float4 PS_Adaption(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
163 | {
164 | float4 color = tex2Dlod(ReShade::BackBuffer, float4(texcoord, 0, 0));
165 | float avgLuma = tex2Dlod(SamplerAvgLuma, float4(0.0.xx, 0, 0)).x;
166 |
167 | color.xyz = pow(saturate(color.xyz), 1.0/2.2);
168 | float luma = dot(color.xyz, LumCoeff);
169 | float3 chroma = color.xyz - luma;
170 |
171 | float avgLumaAdjusted = lerp (avgLuma, 1.4 * avgLuma / (0.4 + avgLuma), fAdp_Equilibrium);
172 | float delta = 0;
173 |
174 | float curve = fAdp_Strength * 10.0 * pow(abs(avgLumaAdjusted - 0.5), 4.0);
175 | if (avgLumaAdjusted < 0.5) {
176 | delta = AdaptionDelta(luma, fAdp_BrightenMidtones, fAdp_BrightenShadows, fAdp_BrightenHighlights);
177 | } else {
178 | delta = -AdaptionDelta(luma, fAdp_DarkenMidtones, fAdp_DarkenShadows, fAdp_DarkenHighlights);
179 | }
180 | delta *= curve;
181 |
182 | luma += delta;
183 | color.xyz = saturate(luma + chroma);
184 | color.xyz = pow(color.xyz, 2.2);
185 |
186 | return color;
187 | }
188 |
189 | float PS_StoreAvgLuma(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
190 | {
191 | float avgLuma = tex2Dlod(SamplerAvgLuma, float4(0.0.xx, 0, 0)).x;
192 | return avgLuma;
193 | }
194 |
195 | //techniques
196 | technique EyeAdaption <
197 | ui_tooltip = "EyeAdaption tries to mimic the capability of the eyes to accommodate to different light\n"
198 | "conditions by the brightening of dark and the darkening of bright regions of the image."
199 | ; >
200 | {
201 | pass Luma
202 | {
203 | VertexShader = PostProcessVS;
204 | PixelShader = PS_Luma;
205 | RenderTarget = TexLuma;
206 | }
207 |
208 | pass AvgLuma
209 | {
210 | VertexShader = PostProcessVS;
211 | PixelShader = PS_AvgLuma;
212 | RenderTarget = TexAvgLuma;
213 | }
214 |
215 | pass Adaption
216 | {
217 | VertexShader = PostProcessVS;
218 | PixelShader = PS_Adaption;
219 | }
220 |
221 | pass StoreAvgLuma
222 | {
223 | VertexShader = PostProcessVS;
224 | PixelShader = PS_StoreAvgLuma;
225 | RenderTarget = TexAvgLumaLast;
226 | }
227 | }
228 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods_SHARPEN.fx:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | d8b 888b d888 888b d888 8888888888 8888888b. .d8888b. 8888888888
4 | Y8P 8888b d8888 8888b d8888 888 888 Y88b d88P Y88b 888
5 | 88888b.d88888 88888b.d88888 888 888 888 Y88b. 888
6 | 888 888Y88888P888 888Y88888P888 8888888 888 d88P "Y888b. 8888888
7 | 888 888 Y888P 888 888 Y888P 888 888 8888888P" "Y88b. 888
8 | 888 888 Y8P 888 888 Y8P 888 888 888 T88b "888 888
9 | 888 888 " 888 888 " 888 888 888 T88b Y88b d88P 888
10 | 888 888 888 888 888 8888888888 888 T88b "Y8888P" 8888888888
11 |
12 | Copyright (c) Pascal Gilcher. All rights reserved.
13 |
14 | * Unauthorized copying of this file, via any medium is strictly prohibited
15 | * Proprietary and confidential
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
24 |
25 | ===============================================================================
26 |
27 | Depth Enhanced Local Contrast Sharpen v1.0
28 |
29 | Author: Pascal Gilcher
30 |
31 | More info: https://martysmods.com
32 | https://patreon.com/mcflypg
33 | https://github.com/martymcmodding
34 |
35 | =============================================================================*/
36 |
37 | /*=============================================================================
38 | Preprocessor settings
39 | =============================================================================*/
40 |
41 | /*=============================================================================
42 | UI Uniforms
43 | =============================================================================*/
44 |
45 | uniform float SHARP_AMT <
46 | ui_type = "drag";
47 | ui_label = "Sharpen Intensity";
48 | ui_min = 0.0;
49 | ui_max = 1.0;
50 | > = 1.0;
51 |
52 | uniform int QUALITY <
53 | ui_type = "combo";
54 | ui_label = "Sharpen Preset";
55 | ui_items = "Simple\0Advanced\0";
56 | ui_min = 0;
57 | ui_max = 1;
58 | > = 1;
59 |
60 | /*=============================================================================
61 | Textures, Samplers, Globals, Structs
62 | =============================================================================*/
63 |
64 | //do NOT change anything here. "hurr durr I changed this and now it works"
65 | //you ARE breaking things down the line, if the shader does not work without changes
66 | //here, it's by design.
67 |
68 | texture ColorInputTex : COLOR;
69 | texture DepthInputTex : DEPTH;
70 | sampler ColorInput { Texture = ColorInputTex; SRGBTexture = true; };
71 | sampler DepthInput { Texture = DepthInputTex; };
72 |
73 | #include ".\MartysMods\mmx_global.fxh"
74 | #include ".\MartysMods\mmx_depth.fxh"
75 |
76 | struct VSOUT
77 | {
78 | float4 vpos : SV_Position;
79 | float2 uv : TEXCOORD0;
80 | };
81 |
82 | /*=============================================================================
83 | Functions
84 | =============================================================================*/
85 |
86 | float4 fetch_tap(VSOUT i, int2 offs)
87 | {
88 | return float4(tex2Dlod(ColorInput, i.uv + offs * BUFFER_PIXEL_SIZE, 0).rgb, 1);
89 | }
90 |
91 | float4 fetch_tap_w_depth(VSOUT i, int2 offs)
92 | {
93 | return float4(tex2Dlod(ColorInput, i.uv + offs * BUFFER_PIXEL_SIZE, 0).rgb, Depth::get_linear_depth(i.uv + offs * BUFFER_PIXEL_SIZE));
94 | }
95 |
96 | float3 soft_min(float3 a, float3 b)
97 | {
98 | const float k = 1.0;
99 | float3 h = max(0, k - abs(a - b)) / k;
100 | return min(a, b) - h*h*h*k*(1.0/6.0);
101 | }
102 |
103 | /*=============================================================================
104 | Shader Entry Points
105 | =============================================================================*/
106 |
107 | VSOUT MainVS(in uint id : SV_VertexID)
108 | {
109 | VSOUT o;
110 | FullscreenTriangleVS(id, o.vpos, o.uv); //use original fullscreen triangle VS
111 | return o;
112 | }
113 |
114 | void MainPS(in VSOUT i, out float3 o : SV_Target0)
115 | {
116 | const int2 offsets[4] =
117 | {
118 | int2(1,0), int2(0,1), //primary
119 | int2(1,1), int2(1,-1) //aux
120 | };
121 |
122 | float4 c = 0;
123 | float4 kernel = 0;
124 | float3 tv = 0;
125 | float3 prev;
126 |
127 | [branch]
128 | if(QUALITY > 0)
129 | {
130 | c = fetch_tap_w_depth(i, int2(0, 0));
131 | kernel += float4(c.rgb, 1.0);
132 | prev = c.rgb;
133 |
134 | [unroll]
135 | for(int j = 0; j < 2; j++)
136 | {
137 | float4 t0 = fetch_tap_w_depth(i, offsets[j]);
138 | float4 t1 = fetch_tap_w_depth(i, -offsets[j]);
139 | float2 w = saturate(1 - 1000.0 * abs(c.w - float2(t0.w, t1.w)));
140 | kernel += float4(t0.rgb, 1) * w.x + float4(t1.rgb, 1) * w.y;
141 |
142 | tv += (t0.rgb - prev) * (t0.rgb - prev);
143 | prev = t0.rgb;
144 | tv += (t1.rgb - prev) * (t1.rgb - prev);
145 | prev = t1.rgb;
146 |
147 | t0 = fetch_tap_w_depth(i, offsets[j + 2]);
148 | t1 = fetch_tap_w_depth(i, -offsets[j + 2]);
149 | w = saturate(1 - 1000.0 * abs(c.w - float2(t0.w, t1.w))) * 0.5; //aux * 0.5
150 | kernel += float4(t0.rgb, 1) * w.x + float4(t1.rgb, 1) * w.y;
151 |
152 | tv += (t0.rgb - prev) * (t0.rgb - prev);
153 | prev = t0.rgb;
154 | tv += (t1.rgb - prev) * (t1.rgb - prev);
155 | prev = t1.rgb;
156 | }
157 |
158 | tv /= 8.0;
159 | }
160 | else
161 | {
162 | c = fetch_tap(i, int2(0, 0));
163 | kernel += float4(c.rgb, 1.0);
164 | prev = c.rgb;
165 |
166 | [unroll]
167 | for(int j = 0; j < 2; j++)
168 | {
169 | float4 t0 = fetch_tap(i, offsets[j]);
170 | float4 t1 = fetch_tap(i, -offsets[j]);
171 | kernel += float4(t0.rgb, 1) + float4(t1.rgb, 1);
172 |
173 | tv += (t0.rgb - prev) * (t0.rgb - prev);
174 | prev = t0.rgb;
175 | tv += (t1.rgb - prev) * (t1.rgb - prev);
176 | prev = t1.rgb;
177 | }
178 |
179 | tv /= 3.0;
180 | }
181 |
182 | kernel.rgb /= kernel.w;
183 | tv = sqrt(tv);
184 |
185 | float3 v_sat = c.rgb - kernel.rgb;
186 | float3 k = v_sat < 0.0.xxx ? c.rgb : 1 - c.rgb;
187 | k /= abs(v_sat) + 1e-6;
188 | float min_k = min(min(k.x, k.y), k.z);
189 |
190 | float sharp_amt = 2 * saturate(SHARP_AMT);
191 |
192 | float3 sharpen = soft_min(k, sharp_amt);
193 | sharpen /= 1 + tv * 64.0;
194 |
195 | float3 sharpened = c.rgb + v_sat * sharpen * sharp_amt;
196 |
197 | const float3 lumc = float3(0.2126729, 0.7151522, 0.072175);
198 | float sharplum = dot(sharpened, lumc);
199 | float origlum = dot(c.rgb, lumc) + 1e-6;
200 |
201 | o = lerp(c.rgb / origlum * sharplum, sharpened, 0.5); //a little bit of chroma sharpen
202 | }
203 |
204 | /*=============================================================================
205 | Techniques
206 | =============================================================================*/
207 |
208 | technique MartyMods_Sharpen
209 | <
210 | ui_label = "iMMERSE: Sharpen";
211 | ui_tooltip =
212 | " MartysMods - Sharpen \n"
213 | " MartysMods Epic ReShade Effects (iMMERSE) \n"
214 | "______________________________________________________________________________\n"
215 | "\n"
216 |
217 | "The Depth Enhanced Local Contrast Sharpen is a high quality sharpen effect for\n"
218 | "ReShade, which can enhance texture detail and reduce TAA blur. \n"
219 | "\n"
220 | "\n"
221 | "Visit https://martysmods.com for more information. \n"
222 | "\n"
223 | "______________________________________________________________________________";
224 | >
225 | {
226 | pass
227 | {
228 | VertexShader = MainVS;
229 | PixelShader = MainPS;
230 | SRGBWriteEnable = true;
231 | }
232 | }
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_bxdf.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_global.fxh"
21 | #include "mmx_math.fxh"
22 |
23 | namespace BXDF
24 | {
25 |
26 | /*=============================================================================
27 | Basics
28 | =============================================================================*/
29 |
30 | float2 sample_disc(float2 u)
31 | {
32 | float2 dir;
33 | sincos(u.x * TAU, dir.y, dir.x);
34 | dir *= sqrt(u.y);
35 | return dir;
36 | }
37 |
38 | float3 sample_sphere(float2 u)
39 | {
40 | float3 dir;
41 | sincos(u.x * TAU, dir.y, dir.x);
42 | dir.z = u.y * 2.0 - 1.0;
43 | dir.xy *= sqrt(1.0 - dir.z * dir.z);
44 | return dir;
45 | }
46 |
47 | float3 ray_cosine(float2 u, float3 n)
48 | {
49 | return normalize(sample_sphere(u) + n);
50 | }
51 |
52 | float3 ray_uniform(float2 u, float3 n)
53 | {
54 | float3 dir = sample_sphere(u);
55 | dir = dot(dir, n) < 0 ? -dir : dir;
56 | return normalize(dir + n * 0.01);
57 | }
58 |
59 | //phase functions
60 | float3 sample_phase_henyey_greenstein(float3 wo, float g, float2 u)
61 | {
62 | float3 wi; sincos(TAU * u.y, wi.x, wi.y);
63 | float sqr = (1 - g * g) / (1 - g + 2 * g * u.x);
64 | wi.z = (1 + g * g - sqr * sqr) / (2 * g); //cos(theta)
65 | wi.xy *= sqrt(saturate(1 - wi.z * wi.z)); //sin(theta)
66 | return mul(wi, Math::base_from_vector(wo));
67 | }
68 |
69 | /*=============================================================================
70 | PBR
71 | =============================================================================*/
72 |
73 | float fresnel_schlick(float cos_theta, float F0)
74 | {
75 | float f = saturate(1 - cos_theta);
76 | float f2 = f * f;
77 | return mad(f2 * f2 * f, 1 - F0, F0);
78 | }
79 |
80 | /*=============================================================================
81 | GGX / Trowbridge-Reitz
82 | =============================================================================*/
83 |
84 | namespace GGX
85 | {
86 |
87 | float smith_G1(float ndotx, float alpha)
88 | {
89 | float ndotx2 = ndotx * ndotx;
90 | float tantheta2 = (1 - ndotx2) / ndotx2;
91 | return 2 / (sqrt(mad(alpha*alpha, tantheta2, 1)) + 1);
92 | }
93 |
94 | float smith_G2_heightcorrelated(float ndotl, float ndotv, float alpha)
95 | {
96 | float a2 = alpha * alpha;
97 | float termv = ndotl * sqrt((-ndotv * a2 + ndotv) * ndotv + a2);
98 | float terml = ndotv * sqrt((-ndotl * a2 + ndotl) * ndotl + a2);
99 | return (2 * ndotv * ndotl) / (termv + terml);
100 | }
101 |
102 | float smith_G2_over_G1_heightcorrelated(float alpha, float ndotwi, float ndotwo)
103 | {
104 | float G1wi = smith_G1(ndotwi, alpha);
105 | float G1wo = smith_G1(ndotwo, alpha);
106 | return G1wi / (G1wi + G1wo - G1wi * G1wo);
107 | }
108 |
109 | float spec_half_angle_from_alpha(float alpha)
110 | {
111 | return PI * alpha / (1 + alpha);
112 | }
113 |
114 | //Dupuy et al. VNDF sampling with spherical caps
115 | //Same PDF as Heitz' GGX, thus can be used with F * G2 / G1
116 | //no reason to keep Heitz' VNDF around, this is just better
117 | float3 sample_vndf(float3 wi, float2 alpha, float2 u, float coverage)
118 | {
119 | //warp to the hemisphere configuration
120 | float3 wi_std = normalize(float3(wi.xy * alpha, wi.z));
121 | //construct spherical cap
122 | float3 c;
123 | c.z = mad((1 - u.y * coverage), (1 + wi_std.z), -wi_std.z);
124 | sincos(u.x * TAU, c.x, c.y);
125 | c.xy *= sqrt(saturate(1 - c.z * c.z));
126 | //compute halfway direction as standard normal
127 | float3 wm_std = wi_std + c;
128 | //warp back to the ellipsoid configuration
129 | return normalize(float3(wm_std.xy * alpha, wm_std.z));
130 | }
131 |
132 | //"Bounded VNDF Sampling for the Smith–GGX BRDF" Yusuke Tokuyoshi and Kenta Eto 2024
133 | //Modified by Pascal Gilcher to add sample coverage and calculate ratio of bounded and unbounded vndf
134 | //Multiply G2/G1 * F with pdf_ratio and it behave like regular VNDF sampling
135 | float3 sample_vndf_bounded(float3 wi, float2 alpha, float2 u, float coverage, out float pdf_ratio)
136 | {
137 | //preliminary variables
138 | float z2 = wi.z * wi.z;
139 | float a = saturate(min(alpha.x, alpha.y)); // Eq. 6
140 | float a2 = a * a;
141 | //warp to the hemisphere configuration
142 | float3 wi_std = float3(wi.xy * alpha, wi.z);
143 | float t = sqrt((1 - z2) * a2 + z2);
144 | wi_std /= t;
145 | //compute lower bound for scaling
146 | float s = 1 + sqrt(saturate(1 - z2)); // Omit sgn for a <=1
147 | float s2 = s * s;
148 | float k = (1 - a2) * s2 / (s2 + a2 * z2);
149 | //calculate ratio of bounded and unbounded vndf
150 | pdf_ratio = (k * wi.z + t) / (wi.z + t);
151 | //construct spherical cap
152 | float b = wi_std.z;
153 | b = wi.z > 0 ? k * b : b;
154 | float3 c;
155 | c.z = mad((1 - u.y * coverage), (1 + b), -b);
156 | sincos(u.x * TAU, c.x, c.y);
157 | c.xy *= sqrt(saturate(1 - c.z * c.z));
158 | //compute halfway direction as standard normal
159 | float3 wm_std = c + wi_std;
160 | //warp back to the ellipsoid configuration
161 | return normalize(float3(wm_std.xy * alpha, wm_std.z));
162 | }
163 |
164 | //Same as above but isotropic and combined with Dupuy's TBN-less method of sampling
165 | float3 sample_vndf_bounded_iso(float3 wi, float3 n, float alpha, float2 u, float coverage, out float pdf_ratio)
166 | {
167 | //decompose into tangential and orthogonal
168 | float wi_z = dot(wi, n);
169 | float3 wi_xy = wi - wi_z * n;
170 | //preliminary variables
171 | float a = saturate(alpha);
172 | float a2 = a * a;
173 | float z2 = wi_z * wi_z;
174 | //warp to the hemisphere configuration
175 | float3 wiStd = lerp(wi, wi_z * n, 1 + alpha);
176 | float t = sqrt((1 - z2) * a2 + z2);
177 | wiStd /= t;
178 | //compute lower bound for scaling
179 | float s = 1 + sqrt(1 - z2);
180 | float s2 = s * s;
181 | float k = (s2 - a2 * s2) / (s2 + a2 * z2);
182 | //calculate ratio of bounded and unbounded vndf
183 | pdf_ratio = (k * wi_z + t) / (wi_z + t);
184 | //construct spherical cap
185 | float3 c_std;
186 | float b = dot(wiStd, n); //z axis
187 | b = wi_z > 0 ? k * b : b;
188 | c_std.z = mad((1 - u.y * coverage), (1 + b), -b);
189 | sincos(u.x * TAU, c_std.x, c_std.y);
190 | c_std.xy *= sqrt(saturate(1.0 - c_std.z * c_std.z));
191 | //reflect sample to align with normal
192 | float3 wr = float3(n.xy, n.z + 1);
193 | float3 c = (dot(wr, c_std) / wr.z) * wr - c_std;
194 | //compute halfway direction as standard normal
195 | float3 wm_std = c + wiStd;
196 | float3 wm_std_z = n * dot(n, wm_std);
197 | float3 wm_std_xy = wm_std_z - wm_std;
198 | //warp back to the ellipsoid configuration
199 | return normalize(wm_std_z + alpha * wm_std_xy);
200 | }
201 |
202 | //D term for GGX
203 | float ndf(float ndoth, float alpha)
204 | {
205 | float a2 = alpha * alpha;
206 | float d = ((ndoth * a2 - ndoth) * ndoth + 1);
207 | return a2 / (d * d * PI);
208 | }
209 |
210 | float pdf_vndf_bounded_iso(float3 wi, float3 wo, float3 n, float alpha)
211 | {
212 | float3 m = normalize(wi + wo);
213 | float ndoth = saturate(dot(m, n));
214 | float ndf = ndf(ndoth, alpha);
215 |
216 | float wi_z = dot(n, wi);
217 | float z2 = wi_z * wi_z;
218 | float a = saturate(alpha);
219 | float a2 = a * a;
220 | float len2 = (1 - z2) * a2;
221 | float t = sqrt(len2 + z2);
222 |
223 | if(wi_z > 0.0)
224 | {
225 | float s = 1 + sqrt(saturate(1 - z2));
226 | float s2 = s * s;
227 | float k = (1 - a2) * s2 / (s2 + a2 * z2);
228 | return ndf / (2 * (k * wi_z + t)) ;
229 | }
230 | //Numerically stable form of the previous PDF for i.z < 0
231 | return ndf * (t - wi_z) / (2 * len2);
232 | }
233 |
234 | float3 dominant_direction(float3 n, float3 v, float alpha)
235 | {
236 | float roughness = sqrt(alpha);
237 | float f = (1 - roughness) * (sqrt(1 - roughness) + roughness);
238 | float3 r = reflect(-v, n);
239 | return normalize(lerp(n, r, f));
240 | }
241 |
242 | } //namespace GGX
243 |
244 | } //namespace
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/Custom/KeepUIX.fx:
--------------------------------------------------------------------------------
1 | // KeepUI for FFXIV, Phantasy Star Online, and other games with a UI depth of 0.
2 | // Author: seri14
3 | //
4 | // This is free and unencumbered software released into the public domain.
5 | //
6 | // Anyone is free to copy, modify, publish, use, compile, sell, or
7 | // distribute this software, either in source code form or as a compiled
8 | // binary, for any purpose, commercial or non-commercial, and by any
9 | // means.
10 | //
11 | // In jurisdictions that recognize copyright laws, the author or authors
12 | // of this software dedicate any and all copyright interest in the
13 | // software to the public domain. We make this dedication for the benefit
14 | // of the public at large and to the detriment of our heirs and
15 | // successors. We intend this dedication to be an overt act of
16 | // relinquishment in perpetuity of all present and future rights to this
17 | // software under copyright law.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 | // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 | // OTHER DEALINGS IN THE SOFTWARE.
26 | //
27 | // Lightly optimized by Marot Satil for the GShade project.
28 | // Special thanks to Sleeps_Hungry for the addition of the FFOccludeUI technique.
29 |
30 | #ifndef KeepUIDebug
31 | #define KeepUIDebug 0 // Set to 1 if you need to use KeepUI's debug features.
32 | #endif
33 |
34 | #ifndef KeepUIExclude
35 | #define KeepUIExclude 1
36 | #endif
37 |
38 | #if KeepUIExclude
39 | uniform bool bKeepUIExclude <
40 | ui_category = "Exclude area";
41 | ui_label = "Exclude";
42 | > = true;
43 |
44 | uniform bool bKeepUIExcludeEdit <
45 | ui_category = "Exclude area";
46 | ui_label = "Edit mode";
47 | ui_tooltip = "Turn off after you are done editing the exclude area.\n"
48 | "You can turn on KeepUIDebug to help you edit area.\n";
49 | > = true;
50 |
51 | uniform float2 fKeepUIExcludeH <
52 | ui_type = "slider";
53 | ui_category = "Exclude area";
54 | ui_label = "Top / Bottom";
55 | ui_min = 0.0; ui_max = 1.0;
56 | > = float2(0.4,0.6);
57 |
58 | uniform float2 fKeepUIExcludeV <
59 | ui_type = "slider";
60 | ui_category = "Exclude area";
61 | ui_label = "Left / Right";
62 | ui_min = 0.0; ui_max = 1.0;
63 | > = float2(0.4,0.6);
64 |
65 | uniform int fKeepUIExcludeTheme <
66 | ui_type = "combo";
67 | ui_category = "Exclude area";
68 | ui_label = "UI Theme";
69 | ui_tooltip = "Select the UI theme you are using. This will help with occlusion assistance.";
70 | ui_items = "Dark\0Light\0Classic FF\0Clear Blue\0";
71 | > = 0;
72 | #endif
73 |
74 | #ifndef KeepUIOccludeAssist
75 | #define KeepUIOccludeAssist 1
76 | #endif
77 |
78 | #if KeepUIOccludeAssist
79 | uniform bool bKeepUIOcclude <
80 | ui_category = "Occlude UI";
81 | ui_label = "Occlusion Assistance";
82 | ui_tooltip = "Set to 1 if you notice odd graphical issues with Bloom or similar shaders. May cause problems with SSDO when enabled.";
83 | ui_bind = "KeepUIOccludeAssist";
84 | > = true;
85 | uniform float fKeepUIOccludeMinAlpha <
86 | ui_type = "slider";
87 | ui_category = "Occlude UI";
88 | ui_label = "Occlusion Assistance Alpha blending";
89 | ui_min = 0; ui_max = 1;
90 | > = 0.8;
91 | #endif
92 |
93 | #if KeepUIDebug
94 | uniform bool bTroubleshootOpacityIssue <
95 | ui_category = "Troubleshooting";
96 | ui_label = "Enable UI Highlighting";
97 | ui_tooltip = "If you notice invalid colors on objects, enable FXAA in Final Fantasy XIV's Graphics Settings.\n"
98 | "Open [System Configuration]\n"
99 | " -> [Graphics Settings]\n"
100 | " -> [General]\n"
101 | " Set [Edge Smoothing (Anti-aliasing)] from \"Off\" to \"FXAA\"";
102 | > = true;
103 |
104 | uniform int iBlendSource <
105 | ui_category = "Troubleshooting (Do not use)";
106 | ui_label = "Blend Type"; ui_type = "combo";
107 | ui_items = "Checkerboard\0Negative\0";
108 | > = 0;
109 | #endif
110 |
111 | #include "ReShade.fxh"
112 |
113 | texture KeepUIX_Tex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
114 | sampler KeepUIX_Sampler { Texture = KeepUIX_Tex; };
115 | static const float3 LightTheme = float3(247.0 / 255.0, 218.0 / 255.0, 181.0 / 255.0);
116 | static const float3 BlueTheme = float3(37.0 / 255.0, 0.0 / 255.0, 158.0 / 255.0);
117 |
118 | void PS_KeepUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
119 | {
120 | color = tex2D(ReShade::BackBuffer, texcoord);
121 | }
122 |
123 | #if KeepUIExclude
124 | void PS_KeepUIExclude(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
125 | {
126 | if (!bKeepUIExclude) discard;
127 |
128 | const color = tex2D(ReShade::BackBuffer, texcoord);
129 |
130 | const float alphaTL = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.x, fKeepUIExcludeH.x)).a;
131 | const float alphaTR = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.y, fKeepUIExcludeH.x)).a;
132 | const float alphaBL = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.x, fKeepUIExcludeH.y)).a;
133 | const float alphaBR = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.y, fKeepUIExcludeH.y)).a;
134 |
135 | const bool isCovered = alphaTL >= 0.1 && alphaTR >= 0.1 && alphaBL >= 0.1 && alphaBR >= 0.1;
136 |
137 | if (!bKeepUIExcludeEdit && isCovered)
138 | {
139 | return;
140 | }
141 | else if (texcoord.y >= fKeepUIExcludeH.x && texcoord.y <= fKeepUIExcludeH.y && texcoord.x >= fKeepUIExcludeV.x && texcoord.x <= fKeepUIExcludeV.y)
142 | {
143 | const float alpha = color.a;
144 | color.a = 0;
145 |
146 | if (bKeepUIExcludeEdit)
147 | {
148 | color.b = isCovered ? 1 : 0;
149 | color.g = 1;
150 | color.a = 0.5;
151 | }
152 | else if ((color.r > 0.1 && color.r < 0.8 || color.r == 0 ) && abs(color.r - color.g) < 0.015 && abs(color.r - color.b) < 0.015)
153 | color.a = alpha;
154 | else if(fKeepUIExcludeTheme == 1 && abs(color.r - LightTheme.r) < 0.04 && abs(color.g - LightTheme.g) < 0.04 && abs(color.b - LightTheme.b) < 0.04)
155 | color.a = alpha;
156 | else if(fKeepUIExcludeTheme == 2 && abs(color.r - BlueTheme.r) < 0.01 && abs(color.g - BlueTheme.g) < 0.01 && abs(color.b - BlueTheme.b) < 0.01)
157 | color.a = alpha;
158 | }
159 | }
160 | #endif
161 |
162 | #if KeepUIOccludeAssist
163 | void PS_OccludeUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
164 | {
165 | if (!bKeepUIOcclude) discard;
166 |
167 | color = tex2D(ReShade::BackBuffer, texcoord);
168 | float4 keep = tex2D(KeepUIX_Sampler, texcoord);
169 | if(keep.a > 0)
170 | {
171 | color = lerp(color, keep * fKeepUIOccludeMinAlpha, keep.a);
172 | }
173 | }
174 | #endif
175 |
176 | void PS_RestoreUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
177 | {
178 | const float4 keep = tex2D(KeepUIX_Sampler, texcoord);
179 |
180 | #if KeepUIDebug
181 | if (bTroubleshootOpacityIssue)
182 | {
183 | if (0 == iBlendSource)
184 | {
185 | if (step(1, pos.x / 32 % 2) == step(1, pos.y / 32 % 2))
186 | color = lerp(0.45, keep, keep.a);
187 | else
188 | color = lerp(0.55, keep, keep.a);
189 | color.a *= keep.a;
190 | }
191 | else
192 | {
193 | if (step(1.19209e-07, keep.a))
194 | color = lerp(1 - keep, keep, 1-keep.a);
195 | else
196 | color = lerp(keep, keep, 1 - keep.a);
197 | color.a = keep.a;
198 | }
199 |
200 | return;
201 | }
202 | #endif
203 |
204 | color = tex2D(ReShade::BackBuffer, texcoord);
205 | color.rgb = lerp(color.rgb, keep.rgb, keep.a).rgb;
206 | }
207 |
208 | technique FFKeepUIX <
209 | ui_label = "== [ FFXIV Keep UI ] KEEP =========================================";
210 | ui_tooltip = "Place this at the top of your Technique list to save the UI into a texture for restoration with FFRestoreUI.\n"
211 | "To use this Technique, you must also enable \"FFRestoreUI\".\n";
212 | >
213 | {
214 | pass
215 | {
216 | VertexShader = PostProcessVS;
217 | PixelShader = PS_KeepUI;
218 | RenderTarget = KeepUIX_Tex;
219 | }
220 |
221 | #if KeepUIExclude
222 | pass
223 | {
224 | VertexShader = PostProcessVS;
225 | PixelShader = PS_KeepUIExclude;
226 | RenderTarget = KeepUIX_Tex;
227 | }
228 | #endif
229 |
230 | #if KeepUIOccludeAssist
231 | pass
232 | {
233 | VertexShader = PostProcessVS;
234 | PixelShader = PS_OccludeUI;
235 | }
236 | #endif
237 | }
238 |
239 | technique FFRestoreUIX <
240 | ui_label = "== [ FFXIV Keep UI ] RESTORE ======================================";
241 | ui_tooltip = "Place this at the bottom of your Technique list to restore the UI texture saved by FFKeepUI.\n"
242 | "To use this Technique, you must also enable \"FFKeepUIX\".\n";
243 | >
244 | {
245 | pass
246 | {
247 | VertexShader = PostProcessVS;
248 | PixelShader = PS_RestoreUI;
249 | }
250 | }
251 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/Custom/KeepUIX.fx:
--------------------------------------------------------------------------------
1 | // KeepUI for FFXIV, Phantasy Star Online, and other games with a UI depth of 0.
2 | // Author: seri14
3 | //
4 | // This is free and unencumbered software released into the public domain.
5 | //
6 | // Anyone is free to copy, modify, publish, use, compile, sell, or
7 | // distribute this software, either in source code form or as a compiled
8 | // binary, for any purpose, commercial or non-commercial, and by any
9 | // means.
10 | //
11 | // In jurisdictions that recognize copyright laws, the author or authors
12 | // of this software dedicate any and all copyright interest in the
13 | // software to the public domain. We make this dedication for the benefit
14 | // of the public at large and to the detriment of our heirs and
15 | // successors. We intend this dedication to be an overt act of
16 | // relinquishment in perpetuity of all present and future rights to this
17 | // software under copyright law.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 | // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 | // OTHER DEALINGS IN THE SOFTWARE.
26 | //
27 | // Lightly optimized by Marot Satil for the GShade project.
28 | // Special thanks to Sleeps_Hungry for the addition of the FFOccludeUI technique.
29 |
30 | #ifndef KeepUIDebug
31 | #define KeepUIDebug 0 // Set to 1 if you need to use KeepUI's debug features.
32 | #endif
33 |
34 | #ifndef KeepUIExclude
35 | #define KeepUIExclude 1
36 | #endif
37 |
38 | #if KeepUIExclude
39 | uniform bool bKeepUIExclude <
40 | ui_category = "Exclude area";
41 | ui_label = "Exclude";
42 | > = true;
43 |
44 | uniform bool bKeepUIExcludeEdit <
45 | ui_category = "Exclude area";
46 | ui_label = "Edit mode";
47 | ui_tooltip = "Turn off after you are done editing the exclude area.\n"
48 | "You can turn on KeepUIDebug to help you edit area.\n";
49 | > = true;
50 |
51 | uniform float2 fKeepUIExcludeH <
52 | ui_type = "slider";
53 | ui_category = "Exclude area";
54 | ui_label = "Top / Bottom";
55 | ui_min = 0.0; ui_max = 1.0;
56 | > = float2(0.4,0.6);
57 |
58 | uniform float2 fKeepUIExcludeV <
59 | ui_type = "slider";
60 | ui_category = "Exclude area";
61 | ui_label = "Left / Right";
62 | ui_min = 0.0; ui_max = 1.0;
63 | > = float2(0.4,0.6);
64 |
65 | uniform int fKeepUIExcludeTheme <
66 | ui_type = "combo";
67 | ui_category = "Exclude area";
68 | ui_label = "UI Theme";
69 | ui_tooltip = "Select the UI theme you are using. This will help with occlusion assistance.";
70 | ui_items = "Dark\0Light\0Classic FF\0Clear Blue\0";
71 | > = 0;
72 | #endif
73 |
74 | #ifndef KeepUIOccludeAssist
75 | #define KeepUIOccludeAssist 1
76 | #endif
77 |
78 | #if KeepUIOccludeAssist
79 | uniform bool bKeepUIOcclude <
80 | ui_category = "Occlude UI";
81 | ui_label = "Occlusion Assistance";
82 | ui_tooltip = "Set to 1 if you notice odd graphical issues with Bloom or similar shaders. May cause problems with SSDO when enabled.";
83 | ui_bind = "KeepUIOccludeAssist";
84 | > = true;
85 | uniform float fKeepUIOccludeMinAlpha <
86 | ui_type = "slider";
87 | ui_category = "Occlude UI";
88 | ui_label = "Occlusion Assistance Alpha blending";
89 | ui_min = 0; ui_max = 1;
90 | > = 0.8;
91 | #endif
92 |
93 | #if KeepUIDebug
94 | uniform bool bTroubleshootOpacityIssue <
95 | ui_category = "Troubleshooting";
96 | ui_label = "Enable UI Highlighting";
97 | ui_tooltip = "If you notice invalid colors on objects, enable FXAA in Final Fantasy XIV's Graphics Settings.\n"
98 | "Open [System Configuration]\n"
99 | " -> [Graphics Settings]\n"
100 | " -> [General]\n"
101 | " Set [Edge Smoothing (Anti-aliasing)] from \"Off\" to \"FXAA\"";
102 | > = true;
103 |
104 | uniform int iBlendSource <
105 | ui_category = "Troubleshooting (Do not use)";
106 | ui_label = "Blend Type"; ui_type = "combo";
107 | ui_items = "Checkerboard\0Negative\0";
108 | > = 0;
109 | #endif
110 |
111 | #include "ReShade.fxh"
112 |
113 | texture KeepUIX_Tex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
114 | sampler KeepUIX_Sampler { Texture = KeepUIX_Tex; };
115 | static const float3 LightTheme = float3(247.0 / 255.0, 218.0 / 255.0, 181.0 / 255.0);
116 | static const float3 BlueTheme = float3(37.0 / 255.0, 0.0 / 255.0, 158.0 / 255.0);
117 |
118 | void PS_KeepUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
119 | {
120 | color = tex2D(ReShade::BackBuffer, texcoord);
121 | }
122 |
123 | #if KeepUIExclude
124 | void PS_KeepUIExclude(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
125 | {
126 | if (!bKeepUIExclude) discard;
127 |
128 | const color = tex2D(ReShade::BackBuffer, texcoord);
129 |
130 | const float alphaTL = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.x, fKeepUIExcludeH.x)).a;
131 | const float alphaTR = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.y, fKeepUIExcludeH.x)).a;
132 | const float alphaBL = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.x, fKeepUIExcludeH.y)).a;
133 | const float alphaBR = tex2D(ReShade::BackBuffer, float2(fKeepUIExcludeV.y, fKeepUIExcludeH.y)).a;
134 |
135 | const bool isCovered = alphaTL >= 0.1 && alphaTR >= 0.1 && alphaBL >= 0.1 && alphaBR >= 0.1;
136 |
137 | if (!bKeepUIExcludeEdit && isCovered)
138 | {
139 | return;
140 | }
141 | else if (texcoord.y >= fKeepUIExcludeH.x && texcoord.y <= fKeepUIExcludeH.y && texcoord.x >= fKeepUIExcludeV.x && texcoord.x <= fKeepUIExcludeV.y)
142 | {
143 | const float alpha = color.a;
144 | color.a = 0;
145 |
146 | if (bKeepUIExcludeEdit)
147 | {
148 | color.b = isCovered ? 1 : 0;
149 | color.g = 1;
150 | color.a = 0.5;
151 | }
152 | else if ((color.r > 0.1 && color.r < 0.8 || color.r == 0 ) && abs(color.r - color.g) < 0.015 && abs(color.r - color.b) < 0.015)
153 | color.a = alpha;
154 | else if(fKeepUIExcludeTheme == 1 && abs(color.r - LightTheme.r) < 0.04 && abs(color.g - LightTheme.g) < 0.04 && abs(color.b - LightTheme.b) < 0.04)
155 | color.a = alpha;
156 | else if(fKeepUIExcludeTheme == 2 && abs(color.r - BlueTheme.r) < 0.01 && abs(color.g - BlueTheme.g) < 0.01 && abs(color.b - BlueTheme.b) < 0.01)
157 | color.a = alpha;
158 | }
159 | }
160 | #endif
161 |
162 | #if KeepUIOccludeAssist
163 | void PS_OccludeUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
164 | {
165 | if (!bKeepUIOcclude) discard;
166 |
167 | color = tex2D(ReShade::BackBuffer, texcoord);
168 | float4 keep = tex2D(KeepUIX_Sampler, texcoord);
169 | if(keep.a > 0)
170 | {
171 | color = lerp(color, keep * fKeepUIOccludeMinAlpha, keep.a);
172 | }
173 | }
174 | #endif
175 |
176 | void PS_RestoreUI(float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
177 | {
178 | const float4 keep = tex2D(KeepUIX_Sampler, texcoord);
179 |
180 | #if KeepUIDebug
181 | if (bTroubleshootOpacityIssue)
182 | {
183 | if (0 == iBlendSource)
184 | {
185 | if (step(1, pos.x / 32 % 2) == step(1, pos.y / 32 % 2))
186 | color = lerp(0.45, keep, keep.a);
187 | else
188 | color = lerp(0.55, keep, keep.a);
189 | color.a *= keep.a;
190 | }
191 | else
192 | {
193 | if (step(1.19209e-07, keep.a))
194 | color = lerp(1 - keep, keep, 1-keep.a);
195 | else
196 | color = lerp(keep, keep, 1 - keep.a);
197 | color.a = keep.a;
198 | }
199 |
200 | return;
201 | }
202 | #endif
203 |
204 | color = tex2D(ReShade::BackBuffer, texcoord);
205 | color.rgb = lerp(color.rgb, keep.rgb, keep.a).rgb;
206 | }
207 |
208 | technique FFKeepUIX <
209 | ui_label = "== [ FFXIV Keep UI ] KEEP =========================================";
210 | ui_tooltip = "Place this at the top of your Technique list to save the UI into a texture for restoration with FFRestoreUI.\n"
211 | "To use this Technique, you must also enable \"FFRestoreUI\".\n";
212 | >
213 | {
214 | pass
215 | {
216 | VertexShader = PostProcessVS;
217 | PixelShader = PS_KeepUI;
218 | RenderTarget = KeepUIX_Tex;
219 | }
220 |
221 | #if KeepUIExclude
222 | pass
223 | {
224 | VertexShader = PostProcessVS;
225 | PixelShader = PS_KeepUIExclude;
226 | RenderTarget = KeepUIX_Tex;
227 | }
228 | #endif
229 |
230 | #if KeepUIOccludeAssist
231 | pass
232 | {
233 | VertexShader = PostProcessVS;
234 | PixelShader = PS_OccludeUI;
235 | }
236 | #endif
237 | }
238 |
239 | technique FFRestoreUIX <
240 | ui_label = "== [ FFXIV Keep UI ] RESTORE ======================================";
241 | ui_tooltip = "Place this at the bottom of your Technique list to restore the UI texture saved by FFKeepUI.\n"
242 | "To use this Technique, you must also enable \"FFKeepUIX\".\n";
243 | >
244 | {
245 | pass
246 | {
247 | VertexShader = PostProcessVS;
248 | PixelShader = PS_RestoreUI;
249 | }
250 | }
251 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/AstrayFX/Trails.fx:
--------------------------------------------------------------------------------
1 | ////----------//
2 | ///**Trails**///
3 | //----------////
4 |
5 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 | //* Trails
7 | //* For Reshade 3.0
8 | //* --------------------------
9 | //* This work is licensed under a Creative Commons Attribution 3.0 Unported License.
10 | //* So you are free to share, modify and adapt it for your needs, and even use it for commercial use.
11 | //* I would also love to hear about a project you are using it with.
12 | //* https://creativecommons.org/licenses/by/3.0/us/
13 | //*
14 | //* Have fun,
15 | //* Jose Negrete AKA BlueSkyDefender
16 | //*
17 | //* https://github.com/BlueSkyDefender/Depth3D
18 | //* ---------------------------------
19 | //*
20 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
21 |
22 | #define Per_Color_Channel 0 // Lets you adjust per Color Channel.Default 0 off
23 | #define Add_Depth_Effects 0 // Lets this effect be affected by Depth..Default 0 off
24 |
25 | #if !Per_Color_Channel
26 | uniform float Persistence <
27 | ui_type = "drag";
28 | ui_min = 0.0; ui_max = 1.00;
29 | ui_label = "Persistence";
30 | ui_tooltip = "Increase persistence longer the trail or afterimage.\n"
31 | "If pushed out the effect is alot like long exposure.\n"
32 | "This can be used for light painting in games.\n"
33 | "1000/1 is 1.0, so 1/2 is 0.5 and so forth.\n"
34 | "Default is 0.25, 0 is infinity.";
35 | > = 0.25;
36 | #else
37 | uniform float3 Persistence <
38 | ui_type = "drag";
39 | ui_min = 0.0; ui_max = 1.00;
40 | ui_label = "Persistence";
41 | ui_tooltip = "Increase persistence longer the trail or afterimage RGB.\n"
42 | "If pushed out the effect is alot like long exposure.\n"
43 | "This can be used for light painting in games.\n"
44 | "1000/1 is 1.0, so 1/2 is 0.5 and so forth.\n"
45 | "Default is 0.25, 0 is infinity.";
46 | > = float3(0.25,0.25,0.25);
47 | #endif
48 |
49 | uniform float TQ <
50 | ui_type = "drag";
51 | ui_min = 0.0; ui_max = 1.0;
52 | ui_label = "Trail Blur Quality";
53 | ui_tooltip = "Adjust Trail Blur Quality.\n"
54 | "Default is Zero.";
55 | > = 0.0;
56 |
57 | //uniform bool TrailsX2 <
58 | // ui_label = "Trails X2";
59 | // ui_tooltip = "Two times the samples.\n"
60 | // "This disables Trail Quality.";
61 | //> = false;
62 |
63 | uniform bool PS2 <
64 | ui_label = "PS2 Style Echo";
65 | ui_tooltip = "This enables PS2 Style Echo in your game.\n"
66 | "This disables Trail Quality.";
67 | > = false;
68 | #if Add_Depth_Effects
69 | uniform bool Allow_Depth <
70 | ui_label = "Depth Map Toggle";
71 | ui_tooltip = "This Alows Depth to be used in Trails.";
72 | ui_category = "Depth Buffer";
73 | > = 0;
74 |
75 | uniform int Depth_Map <
76 | ui_type = "combo";
77 | ui_items = "Normal\0Reverse\0";
78 | ui_label = "Custom Depth Map";
79 | ui_tooltip = "Pick your Depth Map.";
80 | ui_category = "Depth Buffer";
81 | > = 0;
82 |
83 | uniform float Depth_Map_Adjust <
84 | ui_type = "slider";
85 | ui_min = 0.0; ui_max = 1.0;
86 | ui_label = "Depth Map Adjustment";
87 | ui_tooltip = "Adjust the depth map and sharpness distance.";
88 | ui_category = "Depth Buffer";
89 | > = 0.0;
90 |
91 | uniform bool Hard_CutOff <
92 | ui_label = "Hard CutOff";
93 | ui_tooltip = "Depth Cutoff toggle this give a hard cutoff for depth isolation.";
94 | ui_category = "Depth Buffer";
95 | > = 0;
96 |
97 | uniform bool Depth_Map_Flip <
98 | ui_label = "Depth Map Flip";
99 | ui_tooltip = "Flip the depth map if it is upside down.";
100 | ui_category = "Depth Buffer";
101 | > = 0;
102 |
103 | uniform bool Invert_Depth <
104 | ui_label = "Depth Map Inverte";
105 | ui_tooltip = "Inverts Depth so you can target only your weapon or what's near you.";
106 | ui_category = "Depth Buffer";
107 | > = 0;
108 |
109 | uniform bool Depth_View <
110 | ui_label = "Depth Map View";
111 | ui_tooltip = "Lets you see Depth so you can Debug.";
112 | ui_category = "Depth Buffer";
113 | > = 0;
114 | #else
115 | static const int Allow_Depth = 0;
116 | static const int Depth_Map = 0;
117 | static const float Depth_Map_Adjust = 250.0;
118 | static const int Depth_Map_Flip = 0;
119 | static const int Invert_Depth = 0;
120 | static const int Depth_View = 0;
121 | static const int Hard_CutOff = 0;
122 | #endif
123 | /////////////////////////////////////////////D3D Starts Here/////////////////////////////////////////////////////////////////
124 | texture DepthBufferTex : DEPTH;
125 |
126 | sampler DepthBuffer
127 | {
128 | Texture = DepthBufferTex;
129 | };
130 |
131 | texture BackBufferTex : COLOR;
132 |
133 | sampler BackBuffer
134 | {
135 | Texture = BackBufferTex;
136 | };
137 |
138 | texture CurrentBackBufferT { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
139 |
140 | sampler CBackBuffer
141 | {
142 | Texture = CurrentBackBufferT;
143 | };
144 |
145 |
146 | texture PBB { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; MipLevels = 2;};
147 |
148 | sampler PBackBuffer
149 | {
150 | Texture = PBB;
151 | };
152 |
153 | texture PSBB { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
154 |
155 | sampler PSBackBuffer
156 | {
157 | Texture = PSBB;
158 | };
159 |
160 | ///////////////////////////////////////////////////////////TAA/////////////////////////////////////////////////////////////////////
161 | #define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
162 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
163 | float Depth(in float2 texcoord : TEXCOORD0)
164 | {
165 | if (Depth_Map_Flip)
166 | texcoord.y = 1 - texcoord.y;
167 |
168 | float zBuffer = tex2D(DepthBuffer, texcoord).x; //Depth Buffer
169 |
170 | //Conversions to linear space.....
171 | //Near & Far Adjustment
172 | float Far = 1.0, Near = 0.125/250.0; //Division Depth Map Adjust - Near
173 |
174 | float2 Z = float2( zBuffer, 1-zBuffer );
175 |
176 | if (Depth_Map == 0)//DM0. Normal
177 | zBuffer = Far * Near / (Far + Z.x * (Near - Far));
178 | else if (Depth_Map == 1)//DM1. Reverse
179 | zBuffer = Far * Near / (Far + Z.y * (Near - Far));
180 |
181 | return saturate(zBuffer);
182 | }
183 |
184 | float3 T_Out(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
185 | {
186 | float TQA = TQ, D = Depth(texcoord);
187 | if(PS2)
188 | TQA = 0;
189 |
190 | float3 C = tex2D(BackBuffer, texcoord).rgb;
191 | //float3 PS = tex2D(PSBackBuffer, texcoord).rgb;
192 |
193 | float3 P = tex2Dlod(PBackBuffer, float4(texcoord,0,TQA)).rgb;
194 |
195 | #if !PerColor
196 | float Per = 1-Persistence;
197 | #else
198 | float3 Per = 1-Persistence;
199 | #endif
200 |
201 | D = smoothstep(0,Depth_Map_Adjust,D);
202 |
203 | if(Hard_CutOff)
204 | D = step(0.5,D);
205 |
206 | if(Invert_Depth)
207 | D = 1-D;
208 |
209 | if(!PS2)
210 | {
211 | P *= Per;
212 | C = max( tex2D(BackBuffer, texcoord).rgb, P);
213 | //PS = max( tex2D(BackBuffer, texcoord).rgb, P);
214 | }
215 | else
216 | {
217 | C = (1-Per) * C + Per * P;
218 | //PS = (1-Per) * PS + Per * P;
219 | }
220 |
221 | //if(TrailsX2)
222 | //{
223 | // C = lerp(PS,C,0.5);
224 | //}
225 |
226 | if(Allow_Depth)
227 | C = lerp(C,tex2D(BackBuffer, texcoord).rgb,saturate(D));
228 |
229 | if(Depth_View)
230 | C = D;
231 |
232 | return C;
233 | }
234 |
235 | void Current_BackBuffer_T(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target0)
236 | {
237 | color = tex2D(BackBuffer,texcoord);
238 | }
239 |
240 | void Past_BB(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 Past : SV_Target0, out float4 PastSingle : SV_Target1)
241 | { float2 samples[12] = {
242 | float2(-0.326212, -0.405805),
243 | float2(-0.840144, -0.073580),
244 | float2(-0.695914, 0.457137),
245 | float2(-0.203345, 0.620716),
246 | float2(0.962340, -0.194983),
247 | float2(0.473434, -0.480026),
248 | float2(0.519456, 0.767022),
249 | float2(0.185461, -0.893124),
250 | float2(0.507431, 0.064425),
251 | float2(0.896420, 0.412458),
252 | float2(-0.321940, -0.932615),
253 | float2(-0.791559, -0.597705)
254 | };
255 |
256 | float4 sum_A = tex2D(BackBuffer,texcoord), sum_B = 0;//tex2D(CBackBuffer,texcoord);
257 |
258 | if(!PS2)
259 | {
260 | float Adjust = TQ*pix.x;
261 | [loop]
262 | for (int i = 0; i < 12; i++)
263 | {
264 | sum_A += tex2Dlod(BackBuffer, float4(texcoord + Adjust * samples[i],0,0));
265 | //sum_B += tex2Dlod(CBackBuffer, float4(texcoord + Adjust * samples[i],0,0));
266 | }
267 | Past = sum_A * 0.07692307;
268 | PastSingle = 0;//sum_B * 0.07692307;
269 | }
270 | else
271 | {
272 | Past = sum_A;
273 | PastSingle = 0;//sum_B * 0.07692307;
274 | }
275 | }
276 |
277 | ///////////////////////////////////////////////////////////ReShade.fxh/////////////////////////////////////////////////////////////
278 | // Vertex shader generating a triangle covering the entire screen
279 | void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
280 | {
281 | texcoord.x = (id == 2) ? 2.0 : 0.0;
282 | texcoord.y = (id == 1) ? 2.0 : 0.0;
283 | position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
284 | }
285 | technique Trails
286 | {
287 | pass CBB
288 | {
289 | VertexShader = PostProcessVS;
290 | PixelShader = Current_BackBuffer_T;
291 | RenderTarget = CurrentBackBufferT;
292 | }
293 | pass Trails
294 | {
295 | VertexShader = PostProcessVS;
296 | PixelShader = T_Out;
297 | }
298 | pass PBB
299 | {
300 | VertexShader = PostProcessVS;
301 | PixelShader = Past_BB;
302 | RenderTarget0 = PBB;
303 | RenderTarget1 = PSBB;
304 |
305 | }
306 | }
307 |
--------------------------------------------------------------------------------
/AuroraShade/reshade-shaders/Shaders/AstrayFX/Trails.fx:
--------------------------------------------------------------------------------
1 | ////----------//
2 | ///**Trails**///
3 | //----------////
4 |
5 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 | //* Trails
7 | //* For Reshade 3.0
8 | //* --------------------------
9 | //* This work is licensed under a Creative Commons Attribution 3.0 Unported License.
10 | //* So you are free to share, modify and adapt it for your needs, and even use it for commercial use.
11 | //* I would also love to hear about a project you are using it with.
12 | //* https://creativecommons.org/licenses/by/3.0/us/
13 | //*
14 | //* Have fun,
15 | //* Jose Negrete AKA BlueSkyDefender
16 | //*
17 | //* https://github.com/BlueSkyDefender/Depth3D
18 | //* ---------------------------------
19 | //*
20 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
21 |
22 | #define Per_Color_Channel 0 // Lets you adjust per Color Channel.Default 0 off
23 | #define Add_Depth_Effects 0 // Lets this effect be affected by Depth..Default 0 off
24 |
25 | #if !Per_Color_Channel
26 | uniform float Persistence <
27 | ui_type = "drag";
28 | ui_min = 0.0; ui_max = 1.00;
29 | ui_label = "Persistence";
30 | ui_tooltip = "Increase persistence longer the trail or afterimage.\n"
31 | "If pushed out the effect is alot like long exposure.\n"
32 | "This can be used for light painting in games.\n"
33 | "1000/1 is 1.0, so 1/2 is 0.5 and so forth.\n"
34 | "Default is 0.25, 0 is infinity.";
35 | > = 0.25;
36 | #else
37 | uniform float3 Persistence <
38 | ui_type = "drag";
39 | ui_min = 0.0; ui_max = 1.00;
40 | ui_label = "Persistence";
41 | ui_tooltip = "Increase persistence longer the trail or afterimage RGB.\n"
42 | "If pushed out the effect is alot like long exposure.\n"
43 | "This can be used for light painting in games.\n"
44 | "1000/1 is 1.0, so 1/2 is 0.5 and so forth.\n"
45 | "Default is 0.25, 0 is infinity.";
46 | > = float3(0.25,0.25,0.25);
47 | #endif
48 |
49 | uniform float TQ <
50 | ui_type = "drag";
51 | ui_min = 0.0; ui_max = 1.0;
52 | ui_label = "Trail Blur Quality";
53 | ui_tooltip = "Adjust Trail Blur Quality.\n"
54 | "Default is Zero.";
55 | > = 0.0;
56 |
57 | //uniform bool TrailsX2 <
58 | // ui_label = "Trails X2";
59 | // ui_tooltip = "Two times the samples.\n"
60 | // "This disables Trail Quality.";
61 | //> = false;
62 |
63 | uniform bool PS2 <
64 | ui_label = "PS2 Style Echo";
65 | ui_tooltip = "This enables PS2 Style Echo in your game.\n"
66 | "This disables Trail Quality.";
67 | > = false;
68 | #if Add_Depth_Effects
69 | uniform bool Allow_Depth <
70 | ui_label = "Depth Map Toggle";
71 | ui_tooltip = "This Alows Depth to be used in Trails.";
72 | ui_category = "Depth Buffer";
73 | > = 0;
74 |
75 | uniform int Depth_Map <
76 | ui_type = "combo";
77 | ui_items = "Normal\0Reverse\0";
78 | ui_label = "Custom Depth Map";
79 | ui_tooltip = "Pick your Depth Map.";
80 | ui_category = "Depth Buffer";
81 | > = 0;
82 |
83 | uniform float Depth_Map_Adjust <
84 | ui_type = "slider";
85 | ui_min = 0.0; ui_max = 1.0;
86 | ui_label = "Depth Map Adjustment";
87 | ui_tooltip = "Adjust the depth map and sharpness distance.";
88 | ui_category = "Depth Buffer";
89 | > = 0.0;
90 |
91 | uniform bool Hard_CutOff <
92 | ui_label = "Hard CutOff";
93 | ui_tooltip = "Depth Cutoff toggle this give a hard cutoff for depth isolation.";
94 | ui_category = "Depth Buffer";
95 | > = 0;
96 |
97 | uniform bool Depth_Map_Flip <
98 | ui_label = "Depth Map Flip";
99 | ui_tooltip = "Flip the depth map if it is upside down.";
100 | ui_category = "Depth Buffer";
101 | > = 0;
102 |
103 | uniform bool Invert_Depth <
104 | ui_label = "Depth Map Inverte";
105 | ui_tooltip = "Inverts Depth so you can target only your weapon or what's near you.";
106 | ui_category = "Depth Buffer";
107 | > = 0;
108 |
109 | uniform bool Depth_View <
110 | ui_label = "Depth Map View";
111 | ui_tooltip = "Lets you see Depth so you can Debug.";
112 | ui_category = "Depth Buffer";
113 | > = 0;
114 | #else
115 | static const int Allow_Depth = 0;
116 | static const int Depth_Map = 0;
117 | static const float Depth_Map_Adjust = 250.0;
118 | static const int Depth_Map_Flip = 0;
119 | static const int Invert_Depth = 0;
120 | static const int Depth_View = 0;
121 | static const int Hard_CutOff = 0;
122 | #endif
123 | /////////////////////////////////////////////D3D Starts Here/////////////////////////////////////////////////////////////////
124 | texture DepthBufferTex : DEPTH;
125 |
126 | sampler DepthBuffer
127 | {
128 | Texture = DepthBufferTex;
129 | };
130 |
131 | texture BackBufferTex : COLOR;
132 |
133 | sampler BackBuffer
134 | {
135 | Texture = BackBufferTex;
136 | };
137 |
138 | texture CurrentBackBufferT { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
139 |
140 | sampler CBackBuffer
141 | {
142 | Texture = CurrentBackBufferT;
143 | };
144 |
145 |
146 | texture PBB { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; MipLevels = 2;};
147 |
148 | sampler PBackBuffer
149 | {
150 | Texture = PBB;
151 | };
152 |
153 | texture PSBB { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
154 |
155 | sampler PSBackBuffer
156 | {
157 | Texture = PSBB;
158 | };
159 |
160 | ///////////////////////////////////////////////////////////TAA/////////////////////////////////////////////////////////////////////
161 | #define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
162 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
163 | float Depth(in float2 texcoord : TEXCOORD0)
164 | {
165 | if (Depth_Map_Flip)
166 | texcoord.y = 1 - texcoord.y;
167 |
168 | float zBuffer = tex2D(DepthBuffer, texcoord).x; //Depth Buffer
169 |
170 | //Conversions to linear space.....
171 | //Near & Far Adjustment
172 | float Far = 1.0, Near = 0.125/250.0; //Division Depth Map Adjust - Near
173 |
174 | float2 Z = float2( zBuffer, 1-zBuffer );
175 |
176 | if (Depth_Map == 0)//DM0. Normal
177 | zBuffer = Far * Near / (Far + Z.x * (Near - Far));
178 | else if (Depth_Map == 1)//DM1. Reverse
179 | zBuffer = Far * Near / (Far + Z.y * (Near - Far));
180 |
181 | return saturate(zBuffer);
182 | }
183 |
184 | float3 T_Out(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
185 | {
186 | float TQA = TQ, D = Depth(texcoord);
187 | if(PS2)
188 | TQA = 0;
189 |
190 | float3 C = tex2D(BackBuffer, texcoord).rgb;
191 | //float3 PS = tex2D(PSBackBuffer, texcoord).rgb;
192 |
193 | float3 P = tex2Dlod(PBackBuffer, float4(texcoord,0,TQA)).rgb;
194 |
195 | #if !PerColor
196 | float Per = 1-Persistence;
197 | #else
198 | float3 Per = 1-Persistence;
199 | #endif
200 |
201 | D = smoothstep(0,Depth_Map_Adjust,D);
202 |
203 | if(Hard_CutOff)
204 | D = step(0.5,D);
205 |
206 | if(Invert_Depth)
207 | D = 1-D;
208 |
209 | if(!PS2)
210 | {
211 | P *= Per;
212 | C = max( tex2D(BackBuffer, texcoord).rgb, P);
213 | //PS = max( tex2D(BackBuffer, texcoord).rgb, P);
214 | }
215 | else
216 | {
217 | C = (1-Per) * C + Per * P;
218 | //PS = (1-Per) * PS + Per * P;
219 | }
220 |
221 | //if(TrailsX2)
222 | //{
223 | // C = lerp(PS,C,0.5);
224 | //}
225 |
226 | if(Allow_Depth)
227 | C = lerp(C,tex2D(BackBuffer, texcoord).rgb,saturate(D));
228 |
229 | if(Depth_View)
230 | C = D;
231 |
232 | return C;
233 | }
234 |
235 | void Current_BackBuffer_T(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target0)
236 | {
237 | color = tex2D(BackBuffer,texcoord);
238 | }
239 |
240 | void Past_BB(float4 position : SV_Position, float2 texcoord : TEXCOORD, out float4 Past : SV_Target0, out float4 PastSingle : SV_Target1)
241 | { float2 samples[12] = {
242 | float2(-0.326212, -0.405805),
243 | float2(-0.840144, -0.073580),
244 | float2(-0.695914, 0.457137),
245 | float2(-0.203345, 0.620716),
246 | float2(0.962340, -0.194983),
247 | float2(0.473434, -0.480026),
248 | float2(0.519456, 0.767022),
249 | float2(0.185461, -0.893124),
250 | float2(0.507431, 0.064425),
251 | float2(0.896420, 0.412458),
252 | float2(-0.321940, -0.932615),
253 | float2(-0.791559, -0.597705)
254 | };
255 |
256 | float4 sum_A = tex2D(BackBuffer,texcoord), sum_B = 0;//tex2D(CBackBuffer,texcoord);
257 |
258 | if(!PS2)
259 | {
260 | float Adjust = TQ*pix.x;
261 | [loop]
262 | for (int i = 0; i < 12; i++)
263 | {
264 | sum_A += tex2Dlod(BackBuffer, float4(texcoord + Adjust * samples[i],0,0));
265 | //sum_B += tex2Dlod(CBackBuffer, float4(texcoord + Adjust * samples[i],0,0));
266 | }
267 | Past = sum_A * 0.07692307;
268 | PastSingle = 0;//sum_B * 0.07692307;
269 | }
270 | else
271 | {
272 | Past = sum_A;
273 | PastSingle = 0;//sum_B * 0.07692307;
274 | }
275 | }
276 |
277 | ///////////////////////////////////////////////////////////ReShade.fxh/////////////////////////////////////////////////////////////
278 | // Vertex shader generating a triangle covering the entire screen
279 | void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
280 | {
281 | texcoord.x = (id == 2) ? 2.0 : 0.0;
282 | texcoord.y = (id == 1) ? 2.0 : 0.0;
283 | position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
284 | }
285 | technique Trails
286 | {
287 | pass CBB
288 | {
289 | VertexShader = PostProcessVS;
290 | PixelShader = Current_BackBuffer_T;
291 | RenderTarget = CurrentBackBufferT;
292 | }
293 | pass Trails
294 | {
295 | VertexShader = PostProcessVS;
296 | PixelShader = T_Out;
297 | }
298 | pass PBB
299 | {
300 | VertexShader = PostProcessVS;
301 | PixelShader = Past_BB;
302 | RenderTarget0 = PBB;
303 | RenderTarget1 = PSBB;
304 |
305 | }
306 | }
307 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/iMMERSE/MartysMods/mmx_math.fxh:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Copyright (c) Pascal Gilcher. All rights reserved.
4 |
5 | * Unauthorized copying of this file, via any medium is strictly prohibited
6 | * Proprietary and confidential
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
11 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14 | DEALINGS IN THE SOFTWARE.
15 |
16 | =============================================================================*/
17 |
18 | #pragma once
19 |
20 | #include "mmx_global.fxh"
21 |
22 | static const float PI = 3.1415926535;
23 | static const float HALF_PI = 1.5707963268;
24 | static const float TAU = 6.2831853072;
25 |
26 | static const float FLOAT32MAX = 3.402823466e+38f;
27 | static const float FLOAT16MAX = 65504.0;
28 |
29 | //Useful math functions
30 |
31 | namespace Math
32 | {
33 |
34 | /*=============================================================================
35 | Fast Math
36 | =============================================================================*/
37 |
38 | float fast_sign(float x){return x >= 0.0 ? 1.0 : -1.0;}
39 | float2 fast_sign(float2 x){return x >= 0.0.xx ? 1.0.xx : -1.0.xx;}
40 | float3 fast_sign(float3 x){return x >= 0.0.xxx ? 1.0.xxx : -1.0.xxx;}
41 | float4 fast_sign(float4 x){return x >= 0.0.xxxx ? 1.0.xxxx : -1.0.xxxx;}
42 |
43 | #if COMPUTE_SUPPORTED != 0
44 | #define fast_sqrt(_x) asfloat(0x1FBD1DF5 + (asint(_x) >> 1))
45 | #else
46 | #define fast_sqrt(_x) sqrt(_x) //not bitwise shenanigans :(
47 | #endif
48 |
49 | float fast_acos(float x)
50 | {
51 | float o = -0.156583 * abs(x) + HALF_PI;
52 | o *= fast_sqrt(1.0 - abs(x));
53 | return x >= 0.0 ? o : PI - o;
54 | }
55 |
56 | float2 fast_acos(float2 x)
57 | {
58 | float2 o = -0.156583 * abs(x) + HALF_PI;
59 | o *= fast_sqrt(1.0 - abs(x));
60 | return x >= 0.0.xx ? o : PI - o;
61 | }
62 |
63 | /*=============================================================================
64 | Geometry
65 | =============================================================================*/
66 |
67 | float4 get_rotator(float phi)
68 | {
69 | float2 t;
70 | sincos(phi, t.x, t.y);
71 | return float4(t.yx, -t.x, t.y);
72 | }
73 |
74 | float4 merge_rotators(float4 ra, float4 rb)
75 | {
76 | return ra.xyxy * rb.xxzz + ra.zwzw * rb.yyww;
77 | }
78 |
79 | float2 rotate_2D(float2 v, float4 r)
80 | {
81 | return float2(dot(v, r.xy), dot(v, r.zw));
82 | }
83 |
84 | float3x3 get_rotation_matrix(float3 axis, float angle)
85 | {
86 | //http://www.songho.ca/opengl/gl_rotate.html
87 | float s, c; sincos(angle, s, c);
88 | float3x3 m = float3x3((1 - c) * axis.xxx * axis.xyz + float3(c, -s * axis.z, s * axis.y),
89 | (1 - c) * axis.xyy * axis.yyz + float3(s * axis.z, c, -s * axis.x),
90 | (1 - c) * axis.xyz * axis.zzz + float3(-s * axis.y, s * axis.x, c));
91 | return m;
92 | }
93 |
94 | float3x3 base_from_vector(float3 n)
95 | {
96 | //pixar's method, optimized for ALU
97 | float2 nz = -n.xy / (1.0 + abs(n.z));//add_abs, rcp, mul
98 | float3 t = float3(1.0 + n.x*nz.x, n.x*nz.y, -n.x);//mad, mul, mov
99 | float3 b = float3(1.0 + n.y*nz.y, n.x*nz.y, -n.y);//mad, mul, mov
100 | //moving the crossover boundary back such that it doesn't flipflop on flat surfaces
101 | t.z = n.z >= 0.5 ? t.z : -t.z;//cmov
102 | b.xy = n.z >= 0.5 ? b.yx : -b.yx;//cmov
103 | return float3x3(t, b, n);
104 | }
105 |
106 | float3 aabb_clip(float3 p, float3 mincorner, float3 maxcorner)
107 | {
108 | float3 center = 0.5 * (maxcorner + mincorner);
109 | float3 range = 0.5 * (maxcorner - mincorner);
110 | float3 delta = p - center;
111 |
112 | float3 t = abs(range / (delta + 1e-7));
113 | float mint = saturate(min(min(t.x, t.y), t.z));
114 |
115 | return center + delta * mint;
116 | }
117 |
118 | float2 aabb_hit_01(float2 origin, float2 dir)
119 | {
120 | float2 hit_t = abs((dir < 0.0.xx ? origin : 1.0.xx - origin) / dir);
121 | return origin + dir * min(hit_t.x, hit_t.y);
122 | }
123 |
124 | float3 aabb_hit_01(float3 origin, float3 dir)
125 | {
126 | float3 hit_t = abs((dir < 0.0.xxx ? origin : 1.0.xxx - origin) / dir);
127 | return origin + dir * min(min(hit_t.x, hit_t.y), hit_t.z);
128 | }
129 |
130 | bool inside_screen(float2 uv)
131 | {
132 | return all(saturate(uv - uv * uv));
133 | }
134 |
135 | //TODO move to a packing header
136 |
137 | //normalized 3D in, [0, 1] 2D out
138 | float2 octahedral_enc(in float3 v)
139 | {
140 | float2 result = v.xy * rcp(dot(abs(v), 1));
141 | float2 sgn = fast_sign(v.xy);
142 | result = v.z < 0 ? sgn - abs(result.yx) * sgn : result;
143 | return result * 0.5 + 0.5;
144 | }
145 |
146 | //[0, 1] 2D in, normalized 3D out
147 | float3 octahedral_dec(float2 o)
148 | {
149 | o = o * 2.0 - 1.0;
150 | float3 v = float3(o.xy, 1.0 - abs(o.x) - abs(o.y));
151 | //v.xy = v.z < 0 ? (1.0 - abs(v.yx)) * fast_sign(v.xy) : v.xy;
152 | float t = saturate(-v.z);
153 | v.xy += v.xy >= 0.0.xx ? -t.xx : t.xx;
154 | return normalize(v);
155 | }
156 |
157 | float3x3 invert(float3x3 m)
158 | {
159 | float3x3 adj;
160 | adj[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]);
161 | adj[0][1] = -(m[0][1] * m[2][2] - m[0][2] * m[2][1]);
162 | adj[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]);
163 | adj[1][0] = -(m[1][0] * m[2][2] - m[1][2] * m[2][0]);
164 | adj[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]);
165 | adj[1][2] = -(m[0][0] * m[1][2] - m[0][2] * m[1][0]);
166 | adj[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
167 | adj[2][1] = -(m[0][0] * m[2][1] - m[0][1] * m[2][0]);
168 | adj[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]);
169 |
170 | float det = dot(float3(adj[0][0], adj[0][1], adj[0][2]), float3(m[0][0], m[1][0], m[2][0]));
171 | return adj * rcp(det + (abs(det) < 1e-8));
172 | }
173 |
174 | float4x4 invert(float4x4 m)
175 | {
176 | float4x4 adj;
177 | adj[0][0] = m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3];
178 | adj[0][1] = m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3];
179 | adj[0][2] = m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3];
180 | adj[0][3] = m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3];
181 |
182 | adj[1][0] = m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3];
183 | adj[1][1] = m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3];
184 | adj[1][2] = m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3];
185 | adj[1][3] = m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3];
186 |
187 | adj[2][0] = m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3];
188 | adj[2][1] = m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3];
189 | adj[2][2] = m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3];
190 | adj[2][3] = m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3];
191 |
192 | adj[3][0] = m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2];
193 | adj[3][1] = m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2];
194 | adj[3][2] = m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2];
195 | adj[3][3] = m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2];
196 |
197 | float det = dot(float4(adj[0][0], adj[1][0], adj[2][0], adj[3][0]), float4(m[0][0], m[0][1], m[0][2], m[0][3]));
198 | return adj * rcp(det + (abs(det) < 1e-8));
199 | }
200 |
201 | float2 anisotropy_map(float2 kernel, float3 n, float limit)
202 | {
203 | n.xy *= limit;
204 | float2 distorted = kernel - n.xy * dot(n.xy, kernel);
205 | return distorted;
206 | }
207 |
208 | //with elongation
209 | float2 anisotropy_map2(float2 kernel, float3 n, float limit)
210 | {
211 | n.xy *= limit;
212 | float cosine = rsqrt(1 - dot(n.xy, n.xy));
213 | float2 distorted = kernel - n.xy * dot(n.xy, kernel) * cosine;
214 | return distorted * cosine;
215 | }
216 |
217 | float chebyshev_weight(float mean, float variance, float xi)
218 | {
219 | return saturate(variance * rcp(max(1e-7, variance + (xi - mean) * (xi - mean))));
220 | }
221 |
222 | //DX9 safe float emulated bitfields... needed this for something that didn't work out
223 | //so I dumped it here in case I need it again. Works up to 24 (25?) digits and must be init with 0!
224 | bool bitfield_get(float bitfield, int bit)
225 | {
226 | float state = floor(bitfield / exp2(bit)); //"right shift"
227 | return frac(state * 0.5) > 0.25; //"& 1"
228 | }
229 |
230 | void bitfield_set(inout float bitfield, int bit, bool value)
231 | {
232 | bool is_set = bitfield_get(bitfield, bit);
233 | //bitfield += exp2(bit) * (is_set != value) * (value ? 1 : -1);
234 | bitfield += exp2(bit) * (value - is_set);
235 | }
236 |
237 | }
--------------------------------------------------------------------------------
/README_EN.md:
--------------------------------------------------------------------------------
1 | # FFXIV Enhanced Game Play
2 |
3 | | [中文](README.md) | **English** |
4 |
5 | > Translated by copilot, may contain errors
6 |
7 | 
8 |
9 | A relatively mild ReShade preset for Final Fantasy XIV, suitable for most daily gameplay scenarios, including some improved shaders.
10 |
11 | Unlike most presets designed for photography, this preset aims to optimize the daily gameplay experience, prioritizing versatility. It is suitable for almost any gameplay scenario, close to the original visual intent, and does not cause visual discomfort (too bright/too dark/too vivid). This preset addresses some commonly criticized issues in the game through relatively restrained modifications and adds some texture, while also providing some quick presets for cutscenes and light photography.
12 |
13 | > All images in this document are screenshots taken with this preset, without any additional adjustments.
14 |
15 | ## Update for Dawntrail
16 |
17 | The lighting in Dawntrail has seen significant improvements, alleviating some of the previous issues with over-saturation and harsh lighting. Therefore, the overall changes involve reducing the intensity of some color-related effects, without changing the overall style. Additionally, the AO and GI shaders have been updated.
18 |
19 | * Both Max and Balance now use the more efficient and accurate [MartysMods_MXAO](https://github.com/martymcmodding/iMMERSE/blob/main/Shaders/MartysMods_MXAO.fx), making their effects very similar. Lite continues to use the fast AO from [Glamayre_Fast_Effects](https://github.com/rj200/Glamarye_Fast_Effects_for_ReShade/blob/main/Shaders/Glamayre_Fast_Effects.fx).
20 | * Max has added [RadiantGI](https://github.com/BlueSkyDefender/AstrayFX/commits/master/Shaders/RadiantGI.fx) as a GI supplement, which may not have very noticeable effects in most places but is very resource-intensive, recommended for use in environments where frame rate is not a concern.
21 | * Considering the new DLSS and FSR in 7.0, CAS sharpening is now used uniformly, with a slight increase in sharpening intensity.
22 |
23 | Additionally, the UI masking solution in REST no longer has switch issues, so using FFKeepUIX is no longer necessary by default.
24 |
25 | For REST, you can manually install [REST](https://github.com/4lex4nder/ReshadeEffectShaderToggler) or use the [ReShade-CN2 integration package](https://github.com/liuxd17thu/reshade/).
26 |
27 | Using the REST solution can also solve the issue of AO covering semi-transparent objects (such as glasses, hair tips, etc.). If needed, you can use [ReshadeEffectShaderToggler.ini](reshade-addons/ReshadeEffectShaderToggler.ini) to overwrite the REST configuration file.
28 |
29 | ## What issues does this preset solve?
30 |
31 | Due to the limitations of the game itself, no preset can cover everything, but this preset mainly addresses the following issues:
32 |
33 | 1. FFXIV does not limit the saturation of high brightness, resulting in many bright and vivid colors, such as the iconic crystal blue. This does not match common exposure performance and is one of the main causes of various harsh lighting effects. This preset limits the saturation of high brightness, making high brightness colors more natural, and also solves the issue of fluorescent weapons and mounts clashing with the overall picture.
34 |
35 | 2. FFXIV's overall picture tends to be yellow-green, which is why many people feel it is "warm," especially some indoor lighting that appears somewhat unrealistic and plastic-like due to this color grading. This preset slightly adjusts the overall color to make it more neutral.
36 |
37 | 3. FFXIV lacks GI, and this preset uses a very efficient GI shader that allows objects to slightly take on the color of their environment, making the overall visual experience more consistent. This can effectively alleviate the feeling that characters and objects are pasted into the scene. For example, objects on the beach will have a slight yellow tint from the sand, objects on the grass will have a slight green tint, and indoor environments will have a slightly warm or cool tint depending on the environment.
38 |
39 | 4. FFXIV's AO performance is quite subtle, with strong and weak settings being rather rigid, and the HBAO radius being too large, lacking detailed performance. This preset adds some extra AO, making characters and environments more three-dimensional and realistic.
40 |
41 | 5. Using an improved FFKeepUI can solve some job gauge masking issues without introducing the various problems of the REST solution.
42 |
43 | 
44 |
45 | In addition to the above improvements, some additional adjustments have been made to give the picture a slight "cinematic feel":
46 |
47 | 1. Slightly compressed the black and white levels, so that white is not too bright (e.g., the floor of Limsa Lominsa at noon, cutscenes, etc.), and black contrast is not too high, with overall contrast in the mid-brightness range slightly increased.
48 |
49 | 2. Slightly adjusted the balance of red and blue, similar to common film works, making sunrise, sunset, and other scenes warmer, and making dark and nighttime scenes slightly cooler, adding a bit of atmosphere.
50 |
51 | 3. Provided automatic and manual quick DOF presets for cutscenes and light photography, allowing quick switching of depth of field in different scenes.
52 |
53 | > This preset was created and adjusted on a calibrated sRGB display, which is also the color space used for the game's production and rendering. Different display devices may produce slightly different results, but the overall tendency should be the same.
54 |
55 | 
56 |
57 | ## Preset Details
58 |
59 | This preset uses some custom shaders, combined in a specific order and rules. If you are interested in these details, you can refer to [this document](Shaders&Effects.md).
60 |
61 | ## Usage
62 |
63 | ### Installation
64 |
65 | This preset is based on the original ReShade and provides some shaders not included in ReShade or improved from GShade.
66 |
67 | 1. Install the original ReShade. For simplicity, you need to select to download all shaders provided by the ReShade installation package during installation. You can also use the [ReShade-CN2 integration package](https://github.com/liuxd17thu/reshade/).
68 |
69 | 2. Copy the files from this preset to the game directory, merging/overwriting the corresponding directories, usually `reshade-shaders` and `reshade-presets`. Since some shader versions in the integration package are relatively old, they need to be overwritten.
70 |
71 | 3. In the ReShade settings page, add `.\reshade-shaders\Shaders\Custom` to the Effect path. If you have set `\reshade-shaders\Shaders\**` for recursive search, you can skip this step.
72 |

73 |
74 | 5. In the ReShade settings page, turn off `Load only enabled effects`, otherwise, you will not be able to quickly switch functions in performance mode. It is also recommended to enable `Group effect files with tabs instead of a tree` below, so that all effects are not mixed together when adjusting.
75 |

76 |

77 |
78 | 7. Game graphics settings:
79 | * `FXAA`: On. Used to solve UI masking issues, with sharpening provided by ReShade.
80 | * `Ambient Occlusion`: Off. Inserted more appropriately by ReShade.
81 | * `Glare`: Recommended to be on. All post-processing glare effects cannot accurately distinguish the truly glowing parts of the game. For presets focusing on daily gameplay and versatility, the built-in glare is the most natural and comfortable.
82 | * `Underwater Distortion`: Adjust as needed. Underwater distortion mainly affects depth-based shaders, causing artifacts, but may not be very noticeable during actual gameplay.
83 | * Other settings adjusted according to computer configuration.
84 |
85 | 8. In the ReShade main page, select `Enhanced_XIV_GamePlay` as the preset. The preset is divided into `Max`, `Balance`, and `Lite`, corresponding to different performance costs, as detailed below.
86 |
87 | 9. If you need to address job gauge masking issues for Bard, Astrologian, and Monk, please refer to the usage method of the FFKeepUIX section in [this document](Shaders&Effects.md).
88 |
89 | 
90 |
91 | ### Preset Hotkeys
92 |
93 | Can be adjusted as needed by right-clicking.
94 |
95 | 1. F10: Toggle manual DOF, used for occasional photography, automatically adjusting focus based on mouse position.
96 | 2. F11: Toggle automatic DOF, providing automatic depth of field for cutscenes.
97 | 3. Shift + F10: Toggle 21:9 black bars, without covering the UI.
98 | 4. Shift + F11: Toggle all effects except sharpening and AO.
99 |
100 | 
101 |
102 | ## Configuration Comparison
103 |
104 | To accommodate different configurations, three presets with different performance costs are provided, mainly differing in the use of AO and sharpening.
105 |
106 | ### Enhanced_XIV_GamePlay_0_Max: Highest Preset
107 |
108 | * Uses MartysMods_MXAO for high-quality AO.
109 | * Uses Glamayre_Fast_Effects for rough GI.
110 | * Uses RadiantGI for some fine GI (high performance cost).
111 |
112 | ### Enhanced_XIV_GamePlay_1_Balance: Balanced Preset [Recommended]
113 |
114 | Performance cost is about 60% of Max.
115 |
116 | * Uses MartysMods_MXAO for high-quality AO.
117 | * Uses Glamayre_Fast_Effects for rough GI.
118 |
119 | ### Enhanced_XIV_GamePlay_2_Lite: Lightweight Preset
120 |
121 | Performance cost is about 35% of Max.
122 |
123 | * Uses Glamayre_Fast_Effects for AO, less detailed than the above (still acceptable if not viewed closely!).
124 | * Uses Glamayre_Fast_Effects for rough GI.
125 | * Does not use AnamorphicFlare for lens flare effects.
126 |
127 | ## Some Comparisons
128 |
129 | 
130 | ▲ Before / After: Alleviates the strange transition colors on the face under specific lighting, making the colors in the highlights more natural. The AO on the hair and clothes adds a three-dimensional effect.
131 |
132 | 
133 | ▲ Before / After: Improves the strange overly yellow tint of indoor lighting. The shadow performance on the face is more realistic.
134 |
135 | 
136 | ▲ Before / After: The lighting in Ul'dah has a subtle last-gen game cheapness. After adjustment, the overall color tone is more harmonious while retaining the overall visual tendency.
137 |
138 | ## Some Casual Shots
139 |
140 | Thanks to FFXIV's relatively excellent art and scene design, many places you pass by during daily gameplay are quite scenic. Although this preset is not intended for photography, some cinematic processing still helps the overall visual experience.
141 |
142 | 
143 | 
144 | 
145 | 
146 | 
147 | 
148 | 
149 | 
150 |
--------------------------------------------------------------------------------
/Reshade/reshade-shaders/Shaders/AstrayFX/DLAA_Plus.fx:
--------------------------------------------------------------------------------
1 | ////-------------//
2 | ///**DLAA**///
3 | //-------------////
4 |
5 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 | //* Directionally Localized Antialiasing Plus.
7 | //* For ReShade 3.0+
8 | //* ---------------------------------
9 | //* DLAA+
10 | //* Due Diligence
11 | //* Directionally Localized Anti-Aliasing (DLAA)
12 | //* Original method by Dmitry Andreev
13 | //* http://and.intercon.ru/releases/talks/dlaagdc2011/
14 | //*
15 | //* LICENSE
16 | //* ============
17 | //* Directionally Localized Anti-Aliasing Plus is licenses under: Attribution-NoDerivatives 4.0 International
18 | //*
19 | //* You are free to:
20 | //* Share - copy and redistribute the material in any medium or format
21 | //* for any purpose, even commercially.
22 | //* The licensor cannot revoke these freedoms as long as you follow the license terms.
23 | //* Under the following terms:
24 | //* Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made.
25 | //* You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
26 | //*
27 | //* NoDerivatives - If you remix, transform, or build upon the material, you may not distribute the modified material.
28 | //*
29 | //* No additional restrictions - You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
30 | //*
31 | //* https://creativecommons.org/licenses/by-nd/4.0/
32 | //*
33 | //* Have fun,
34 | //* Jose Negrete AKA BlueSkyDefender
35 | //*
36 | //* https://github.com/BlueSkyDefender/Depth3D
37 | //*
38 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
39 |
40 | uniform float Short_Edge_Mask <
41 | ui_type = "drag";
42 | ui_min = 0.0; ui_max = 1.0;
43 | ui_label = "Short Edge AA";
44 | ui_tooltip = "Use this to adjust the Short Edge AA.\n"
45 | "Default is 0.5";
46 | ui_category = "DLAA";
47 | > = 0.5;
48 |
49 | uniform float Long_Edge_Mask <
50 | ui_type = "drag";
51 | ui_min = 0.0; ui_max = 1.0;
52 | ui_label = "Long Edge AA";
53 | ui_tooltip = "Use this to adjust the Long Edge AA.\n"
54 | "Default is 0.5";
55 | ui_category = "DLAA";
56 | > = 0.5;
57 |
58 | uniform float Text_Preservation <
59 | ui_type = "drag";
60 | ui_min = 0.0; ui_max = 1.0;
61 | ui_label = "Text Preservation";
62 | ui_tooltip = "Use this to adjust Text Preservation Power.\n"
63 | "Default is 0.5";
64 | ui_category = "DLAA Debuging";
65 | > = 0.5;
66 | //static const float Black_Preservation = 0.7;
67 | ///*
68 | uniform float Black_Preservation <
69 | ui_type = "drag";
70 | ui_min = 0.0; ui_max = 1.0;
71 | ui_label = "Black Preservation";
72 | ui_tooltip = "Use this to prevent Black Shades from getting AA Since most times this is not needed.\n"
73 | "Default is 0.25";
74 | ui_category = "DLAA Debuging";
75 | > = 0.25;
76 | //*/
77 | uniform int View_Mode <
78 | ui_type = "combo";
79 | ui_items = "DLAA\0Red H & Green V Short Edge Mask\0Red H & Green V Long Edge Mask\0Text Preservation Mask\0";
80 | ui_label = "View Mode";
81 | ui_tooltip = "This is used to select the normal view output or debug view.";
82 | ui_category = "DLAA Debuging";
83 | > = 0;
84 | /*
85 | uniform float TEST <
86 | ui_type = "drag";
87 | ui_min = 0.0; ui_max = 1.0;
88 | > = 0.5;
89 | */
90 | //Total amount of frames since the game started.
91 | uniform uint framecount < source = "framecount"; >;
92 | ////////////////////////////////////////////////////////////DLAA////////////////////////////////////////////////////////////////////
93 | uniform float Delta < source = "timer"; >;
94 | #define Alternate framecount % 2 == 0
95 | #define pix float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
96 | #define lambda lerp(0,5,Short_Edge_Mask)
97 | #define epsilon 0.1 //lerp(0,0.5,Error_Clamping)
98 | #define HoizVert lerp(0.0,2.5,Long_Edge_Mask)
99 | #define Text_Total 25000
100 |
101 | float fmod(float a, float b)
102 | {
103 | float c = frac(abs(a / b)) * abs(b);
104 | return a < 0 ? -c : c;
105 | }
106 |
107 | texture BackBufferTex : COLOR;
108 |
109 | sampler BackBuffer
110 | {
111 | Texture = BackBufferTex;
112 | };
113 |
114 | texture SLPtex {Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; MipLevels = 1; };
115 |
116 | sampler SamplerLoadedPixel
117 | {
118 | Texture = SLPtex;
119 | };
120 |
121 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
122 | float CB_Pattern(float2 TC)
123 | {
124 | float2 gridxy = floor(float2(TC.x * BUFFER_WIDTH, TC.y * BUFFER_HEIGHT));
125 | return fmod(gridxy.x+gridxy.y,2);
126 | }
127 |
128 | //Luminosity Intensity
129 | float LI(in float3 value)
130 | {
131 | return max(value.r, max(value.g, value.b));
132 | }
133 |
134 | float4 LP(float2 tc,float dx, float dy) //Load Pixel
135 | {
136 | float4 BB = tex2D(BackBuffer, tc + float2(dx, dy) * pix.xy);
137 | return BB;
138 | }
139 |
140 | float3 SetInfo()
141 | {
142 | return float3(Delta == 0 ? 0 : Delta,Text_Total == 0 ? 1 : Text_Total, Delta == 0 || Text_Total == 0 ? -1 : 0);
143 | }
144 |
145 | float4 PreFilter(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target //Loaded Pixel
146 | {
147 | //5 bi-linear samples cross
148 | float4 Center = LP(texcoord, 0 , 0);
149 | float4 Left = LP(texcoord,-1.0 , 0.0);
150 | float4 Right = LP(texcoord, 1.0 , 0.0);
151 | float4 Up = LP(texcoord, 0.0 ,-1.0);
152 | float4 Down = LP(texcoord, 0.0 , 1.0);
153 |
154 |
155 | float4 edges = 4.0 * abs((Left + Right + Up + Down) - 4.0 * Center);
156 | float edgesLum = LI(edges.rgb);
157 |
158 | return float4(Center.rgb, edgesLum);
159 | }
160 |
161 | float4 SLP(float2 tc,float dx, float dy, float MIPS) //Load Pixel
162 | {
163 | return tex2Dlod(SamplerLoadedPixel, float4(tc + float2(dx, dy) * pix.xy,0,MIPS));
164 | }
165 |
166 | float Text_Detection(float2 texcoord)
167 | {
168 | float4 BC = SLP( texcoord, 0.0 , 0.0 , 1.0 );
169 | // Luma Threshold Thank you Adyss
170 | BC.a = LI(BC.rgb);//Luma
171 | BC.rgb /= max(BC.a, 0.001);
172 | BC.a = max(0.0, BC.a ) > 0.994;
173 | //BC.rgb *= BC.a;
174 | //1-BC.a;//dot(BC.rgb,BC.rgb);//
175 | return 1-lerp(1,1-BC.a,Text_Preservation);
176 | }
177 |
178 | float Blacks_Detection(float2 texcoord)
179 | {
180 | float4 BC = SLP( texcoord, 0.0 , 0.0 , 1.0 );
181 | // Luma Threshold Thank you Adyss
182 | BC.a = LI(BC.rgb);//Luma
183 | BC.rgb /= max(BC.a, 0.001);
184 | BC.a = max(0.0, BC.a );
185 |
186 | return 1-lerp(1,BC.a,Black_Preservation);
187 | }
188 |
189 |
190 | //Information on Slide 44 says to run the edge processing jointly short and Large.
191 | float4 DLAA(float2 texcoord)
192 | { //Short Edge Filter http://and.intercon.ru/releases/talks/dlaagdc2011/slides/#slide43
193 | float4 DLAA, H, V, UDLR; //DLAA is the completed AA Result.
194 | float2 CBxy = floor( float2(texcoord.x * BUFFER_WIDTH, texcoord.y * BUFFER_HEIGHT));
195 |
196 | //5 bi-linear samples cross
197 | float4 Center = LP(texcoord, 0 , 0);
198 | float4 Left = LP(texcoord,-1.0 , 0.0);
199 | float4 Right = LP(texcoord, 1.0 , 0.0);
200 | float4 Up = LP(texcoord, 0.0 ,-1.0);
201 | float4 Down = LP(texcoord, 0.0 , 1.0);
202 |
203 | //Combine horizontal and vertical blurs together
204 | float4 combH = 2.0 * ( Up + Down );
205 | float4 combV = 2.0 * ( Left + Right );
206 |
207 | //Bi-directional anti-aliasing using HORIZONTAL & VERTICAL blur and horizontal edge detection
208 | //Slide information triped me up here. Read slide 43.
209 | //Edge detection
210 | float4 CenterDiffH = abs( combH - 4.0 * Center ) / 4.0;
211 | float4 CenterDiffV = abs( combV - 4.0 * Center ) / 4.0;
212 |
213 | //Blur
214 | float4 blurredH = (combH + 2.0 * Center) / 6.0;
215 | float4 blurredV = (combV + 2.0 * Center) / 6.0;
216 |
217 | //Edge detection
218 | float LumH = LI( CenterDiffH.rgb );
219 | float LumV = LI( CenterDiffV.rgb );
220 |
221 | float LumHB = LI(blurredH.xyz);
222 | float LumVB = LI(blurredV.xyz);
223 |
224 | //t
225 | float satAmountH = saturate( ( lambda * LumH - epsilon ) / LumVB ) > 0.5;
226 | float satAmountV = saturate( ( lambda * LumV - epsilon ) / LumHB ) > 0.5;
227 |
228 | //color = lerp(color,blur,sat(Edge/blur)
229 | //Re-blend Short Edge Done
230 | DLAA = lerp( Center, blurredH, satAmountV );
231 | DLAA = lerp( DLAA, blurredV, satAmountH );
232 |
233 | DLAA = lerp(DLAA, Center, Text_Detection(texcoord) );
234 | DLAA = lerp(DLAA, Center, Blacks_Detection(texcoord) );
235 |
236 | float4 HNeg, HNegA, HNegB, HNegC, HNegD, HNegE,
237 | HPos, HPosA, HPosB, HPosC, HPosD, HPosE,
238 | VNeg, VNegA, VNegB, VNegC,
239 | VPos, VPosA, VPosB, VPosC;
240 |
241 | // Long Edges
242 | //16 bi-linear samples cross, added extra bi-linear samples in each direction.
243 | HNeg = SLP( texcoord,-1.5 , 0.0 , 0.0 );
244 | HNegA = SLP( texcoord,-3.5 , 0.0 , 0.0 );
245 | HNegB = SLP( texcoord,-5.5 , 0.0 , 0.0 );
246 | HNegC = SLP( texcoord,-7.5 , 0.0 , 0.0 );
247 |
248 | HPos = SLP( texcoord, 1.5 , 0.0 , 0.0 );
249 | HPosA = SLP( texcoord, 3.5 , 0.0 , 0.0 );
250 | HPosB = SLP( texcoord, 5.5 , 0.0 , 0.0 );
251 | HPosC = SLP( texcoord, 7.5 , 0.0 , 0.0 );
252 |
253 | VNeg = SLP( texcoord, 0.0 ,-1.5 , 0.0 );
254 | VNegA = SLP( texcoord, 0.0 ,-3.5 , 0.0 );
255 | VNegB = SLP( texcoord, 0.0 ,-5.5 , 0.0 );
256 | VNegC = SLP( texcoord, 0.0 ,-7.5 , 0.0 );
257 |
258 | VPos = SLP( texcoord, 0.0 , 1.5 , 0.0 );
259 | VPosA = SLP( texcoord, 0.0 , 3.5 , 0.0 );
260 | VPosB = SLP( texcoord, 0.0 , 5.5 , 0.0 );
261 | VPosC = SLP( texcoord, 0.0 , 7.5 , 0.0 );
262 |
263 | //Long Edge detection H & V
264 | float4 AvgBlurH = ( HNeg + HNegA + HNegB + HNegC + HPos + HPosA + HPosB + HPosC ) / 8;
265 | float4 AvgBlurV = ( VNeg + VNegA + VNegB + VNegC + VPos + VPosA + VPosB + VPosC ) / 8;
266 | float EAH = saturate( AvgBlurH.w * HoizVert - 1 );
267 | float EAV = saturate( AvgBlurV.w * HoizVert - 1 );
268 |
269 | float longEdge = abs( EAH - EAV ) > 0.25;//abs( EAH - EAV ) > Edge_Trim ;
270 |
271 | if ( longEdge )
272 | {
273 | //Merge for BlurSamples.
274 | //Long Blur H
275 | float LongBlurLumH = LI( AvgBlurH.rgb );//8 samples
276 | //Long Blur V
277 | float LongBlurLumV = LI( AvgBlurV.rgb );//8 samples
278 |
279 | float centerLI = LI( Center.rgb);
280 | float upLI = LI( Up.rgb );
281 | float downLI = LI( Down.rgb );
282 | float leftLI = LI( Left.rgb );
283 | float rightLI = LI( Right.rgb );
284 |
285 | float blurUp = saturate( 0.0 + ( LongBlurLumH - upLI ) / (centerLI - upLI ) );
286 | float blurDown = saturate( 1.0 + ( LongBlurLumH - centerLI ) / (centerLI - downLI ) );
287 | float blurLeft = saturate( 0.0 + ( LongBlurLumV - leftLI ) / (centerLI - leftLI ) );
288 | float blurRight= saturate( 1.0 + ( LongBlurLumV - centerLI ) / (centerLI - rightLI) );
289 |
290 | UDLR = float4( blurLeft, blurRight, blurUp, blurDown );
291 |
292 | UDLR = UDLR == 0.0 ? 1.0 : UDLR;
293 |
294 | V = lerp( Left , Center, UDLR.x );
295 | V = lerp( Right, V , UDLR.y );
296 | H = lerp( Up , Center, UDLR.z );
297 | H = lerp( Down , H , UDLR.w );
298 | float4 StoreDLAA = DLAA;
299 | DLAA = lerp( DLAA , V , EAV);
300 | DLAA = lerp( DLAA , H , EAH);
301 |
302 | DLAA = lerp(DLAA, StoreDLAA, Text_Detection(texcoord) );
303 | DLAA = lerp(DLAA, StoreDLAA, Blacks_Detection(texcoord));
304 | }
305 |
306 | EAV = lerp(0,EAV,longEdge); EAH = lerp(0,EAH,longEdge);
307 |
308 | return float4(DLAA.rgb,CB_Pattern(texcoord) ? View_Mode == 1 ? satAmountV : EAV : View_Mode == 1 ? satAmountH : EAH);
309 |
310 | }
311 |
312 | float4 AA_Out(float2 texcoord)
313 | {
314 | float4 DLAA = DLAA(texcoord);
315 |
316 | if (View_Mode == 1 || View_Mode == 2)
317 | DLAA = lerp(DLAA,1,float4(CB_Pattern(texcoord) ? 0 : DLAA.w, CB_Pattern(texcoord) ? DLAA.w : 0,0,1));
318 |
319 | if (View_Mode == 3)
320 | DLAA = lerp(DLAA,float4(1,1,0,1),Text_Detection(texcoord));
321 |
322 | return DLAA;
323 | }
324 |
325 | // Text rendering code Modded from https://www.shadertoy.com/view/4dtGD2 by Hamneggs
326 | ////////////////////////////////////////////////////////Logo/////////////////////////////////////////////////////////////////////////
327 | static const float CH_D = 0x79997, CH_E = 0xf171f, CH_F = 0xf1711, CH_H = 0x99f99, CH_I = 0xf444f, CH_N = 0x9bd99,
328 | CH_O = 0x69996, CH_P = 0x79971, CH_T = 0xf4444, CH_3 = 0x69496, CH_FSTP = 0x00002;
329 |
330 | #define MAP_SIZE float2(4,5)
331 | //returns the status of a bit in a bitmap. This is done value-wise, so the exact representation of the float doesn't really matter.
332 | float getBit( float map, float index )
333 | { // Ooh -index takes out that divide :)
334 | return fmod( floor( map * exp2(-index) ), 2.0 );
335 | }
336 |
337 | float drawChar( float Char, float2 pos, float2 size, float2 TC )
338 | { // Subtract our position from the current TC so that we can know if we're inside the bounding box or not.
339 | TC -= pos;
340 | // Divide the screen space by the size, so our bounding box is 1x1.
341 | TC /= size;
342 | // Create a place to store the result & Branchless bounding box check.
343 | float res = step(0.0,min(TC.x,TC.y)) - step(1.0,max(TC.x,TC.y));
344 | // Go ahead and multiply the TC by the bitmap size so we can work in bitmap space coordinates.
345 | TC *= MAP_SIZE;
346 | // Get the appropriate bit and return it.
347 | res*=getBit( Char, 4.0*floor(TC.y) + floor(TC.x) );
348 | return saturate(res);
349 | }
350 |
351 | float Information(float2 TC)
352 | { //Size
353 | float D3D_Size_A = 1.375,D3D_Size_B = 0.75, Out;
354 | float2 charSize_A = float2(.00875, .0125) * D3D_Size_A, charSize_B = float2(.00875, .0125) * D3D_Size_B, WebCharPos = float2( 0.862, 0.018);
355 | [branch] if(SetInfo().x <= SetInfo().y)
356 | { Out += drawChar( CH_D, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
357 | Out += drawChar( CH_E, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
358 | Out += drawChar( CH_P, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
359 | Out += drawChar( CH_T, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
360 | Out += drawChar( CH_H, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
361 | Out += drawChar( CH_3, WebCharPos, charSize_A, TC); WebCharPos.x += .01 * D3D_Size_A;
362 | Out += drawChar( CH_D, WebCharPos, charSize_A, TC); WebCharPos.x += 0.008 * D3D_Size_A;
363 | Out += drawChar( CH_FSTP, WebCharPos, charSize_A, TC); WebCharPos.x += 0.01 * D3D_Size_A;
364 | WebCharPos = float2( 0.963, 0.018);
365 | Out += drawChar( CH_I, WebCharPos, charSize_B, TC); WebCharPos.x += .01 * D3D_Size_B;
366 | Out += drawChar( CH_N, WebCharPos, charSize_B, TC); WebCharPos.x += .01 * D3D_Size_B;
367 | Out += drawChar( CH_F, WebCharPos, charSize_B, TC); WebCharPos.x += .01 * D3D_Size_B;
368 | Out += drawChar( CH_O, WebCharPos, charSize_B, TC);
369 | }
370 |
371 | return Out;
372 | }
373 |
374 | float4 Out(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
375 | {
376 | float PosX = 0.9525f*BUFFER_WIDTH*pix.x,PosY = 0.975f*BUFFER_HEIGHT*pix.y,DBlending = (1-texcoord.y*50.0+48.85)*texcoord.y-0.500;
377 | float2 TC = float2(texcoord.x,1-texcoord.y);
378 | float3 Color = AA_Out(texcoord).rgb;
379 |
380 | return float4(Information(TC) > SetInfo().z ? DBlending : Color,1.0f);
381 | }
382 |
383 | ///////////////ReShade.fxh/////////////////////////////////////////////////////////////
384 |
385 | // Vertex shader generating a triangle covering the entire screen
386 | void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
387 | {
388 | texcoord.x = (id == 2) ? 2.0 : 0.0;
389 | texcoord.y = (id == 1) ? 2.0 : 0.0;
390 | position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
391 | }
392 |
393 | //*Rendering passes*//
394 | technique Directionally_Localized_Anti_Aliasing
395 | {
396 | pass Pre_Filter
397 | {
398 | VertexShader = PostProcessVS;
399 | PixelShader = PreFilter;
400 | RenderTarget = SLPtex;
401 | }
402 | pass DLAA_Plus
403 | {
404 | VertexShader = PostProcessVS;
405 | PixelShader = Out;
406 | }
407 | }
408 |
--------------------------------------------------------------------------------