Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opacity adjustment to Border.fx #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Shaders/Border.fx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
* Added the border_ratio feature
* -- Version 1.4.1 by CeeJay.dk --
* Cleaned up setting for Reshade 3.x
*/
* -- Version 1.4.2 by Marot --
* Added opacity adjustment to existing color setting.
*/

#include "ReShade.fxh"
#include "ReShadeUI.fxh"

/*
uniform float2 border_width <
Expand All @@ -40,10 +41,10 @@ uniform float border_ratio <
ui_tooltip = "Set the desired ratio for the visible area.";
> = 2.35;

uniform float3 border_color <
uniform float4 border_color <
ui_type = "color";
ui_label = "Border Color";
> = float3(0.0, 0.0, 0.0);
> = float4(0.0, 0.0, 0.0, 1.0);

float3 BorderPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
Expand All @@ -60,7 +61,7 @@ float3 BorderPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Ta
float2 border = (BUFFER_PIXEL_SIZE * border_width_variable); // Translate integer pixel width to floating point
float2 within_border = saturate((-texcoord * texcoord + texcoord) - (-border * border + border)); // Becomes positive when inside the border and zero when outside

return all(within_border) ? color : border_color;
return all(within_border) ? color : lerp(color, border_color.rgb, border_color.a);
}

technique Border
Expand Down