ProjectArcade

Форк
0
73 строки · 2.3 Кб
1
/**
2
 * Border version 1.4.1
3
 *
4
 * -- Version 1.0 by Oomek --
5
 * Fixes light, one pixel thick border in some games when forcing MSAA like i.e. Dishonored
6
 * -- Version 1.1 by CeeJay.dk --
7
 * Optimized the shader. It still does the same but now it runs faster.
8
 * -- Version 1.2 by CeeJay.dk --
9
 * Added border_width and border_color features
10
 * -- Version 1.3 by CeeJay.dk --
11
 * Optimized the performance further
12
 * -- Version 1.4 by CeeJay.dk --
13
 * Added the border_ratio feature
14
 * -- Version 1.4.1 by CeeJay.dk --
15
 * Cleaned up setting for Reshade 3.x
16
 */
17

18
#include "ReShade.fxh"
19
#include "ReShadeUI.fxh"
20

21
/*
22
uniform float2 border_width <
23
	ui_type = "input";
24
	ui_label = "Size";
25
	ui_tooltip = "Measured in pixels. If this is set to zero then the ratio will be used instead.";
26
> = float2(15.0, 15.0);
27
*/
28

29
uniform float2 border_width <
30
	ui_type = "drag";
31
	ui_label = "Size";
32
	ui_tooltip = "Measured in pixels. If this is set to zero then the ratio will be used instead.";
33
	ui_min = 0.0; ui_max = (BUFFER_WIDTH * 0.5);
34
	ui_step = 1.0;
35
	> = float2(15.0, 15.0);
36

37
uniform float border_ratio <
38
	ui_type = "input";
39
	ui_label = "Size Ratio";
40
	ui_tooltip = "Set the desired ratio for the visible area.";
41
> = 2.35;
42

43
uniform float3 border_color <
44
	ui_type = "color";
45
	ui_label = "Border Color";
46
> = float3(255.0, 255.0, 255.0);
47

48
float3 BorderPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
49
{
50
	float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
51

52
	// -- calculate the right border_width for a given border_ratio --
53
	float2 border_width_variable = border_width;
54
	if (border_width.x == -border_width.y) // If width is not used
55
		if (BUFFER_ASPECT_RATIO < border_ratio)
56
			border_width_variable = float2(0.0, (BUFFER_HEIGHT - (BUFFER_WIDTH / border_ratio)) * 0.5);
57
		else
58
			border_width_variable = float2((BUFFER_WIDTH - (BUFFER_HEIGHT * border_ratio)) * 0.5, 0.0);
59

60
	float2 border = (BUFFER_PIXEL_SIZE * border_width_variable); // Translate integer pixel width to floating point
61
	float2 within_border = saturate((-texcoord * texcoord + texcoord) - (-border * border + border)); // Becomes positive when inside the border and zero when outside
62

63
	return all(within_border) ? color : border_color;
64
}
65

66
technique Border
67
{
68
	pass
69
	{
70
		VertexShader = PostProcessVS;
71
		PixelShader = BorderPass;
72
	}
73
}
74

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.