Skip to content

Commit

Permalink
retro-v2 softlight, further refinements to border & softlight gradations
Browse files Browse the repository at this point in the history
  • Loading branch information
rbreaves committed Oct 15, 2022
1 parent 5870471 commit 6ff70d2
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 9 deletions.
10 changes: 8 additions & 2 deletions reshade/retro-v2-softlight-subtle.glslp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ shader1 = shaders/blendsoftlight/blendsoftlight.glsl



textures = "overlay;BORDER"
textures = "overlay;overlay2;BORDER;BORDERTHICK;BORDERTHIN"
# change this path to point to your overlay image
overlay = shaders/blendsoftlight/shine_subtle.png
overlay = shaders/blendsoftlight/shine720_subtle.png
overlay2 = shaders/blendsoftlight/shineblack720.png
BORDER = shaders/blendsoftlight/border.png
BORDERTHICK = shaders/blendsoftlight/borderthick.png
BORDERTHIN = shaders/blendsoftlight/borderthin.png
BorderBool = 0.0
ThickBool = 0.0
ThinBool = 0.0
OverlayMix = 1.0
ASPECTRATIO = "43.0"

Expand Down
10 changes: 8 additions & 2 deletions reshade/retro-v2-softlight.glslp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ shader1 = shaders/blendsoftlight/blendsoftlight.glsl



textures = "overlay;BORDER"
textures = "overlay;overlay2;BORDER;BORDERTHICK;BORDERTHIN"
# change this path to point to your overlay image
overlay = shaders/blendsoftlight/shine.png
overlay = shaders/blendsoftlight/shine720.png
overlay2 = shaders/blendsoftlight/shineblack720.png
BORDER = shaders/blendsoftlight/border.png
BORDERTHICK = shaders/blendsoftlight/borderthick.png
BORDERTHIN = shaders/blendsoftlight/borderthin.png
BorderBool = 0.0
ThickBool = 0.0
ThinBool = 0.0
OverlayMix = 1.0
ASPECTRATIO = "43.0"

Expand Down
34 changes: 29 additions & 5 deletions reshade/shaders/blendsoftlight/blendsoftlight.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#pragma parameter OverlayMix "Overlay Mix" 1.0 0.0 1.0 0.05
#pragma parameter SCALE "Box Scale" 4.0 0.25 4.0 0.05
#pragma parameter ASPECTRATIO "Aspect Ratio" 87.0 43.0 87.0 44.0
#pragma parameter BorderBool "Normal Borders" 0.0 0.0 1.0 1.0
#pragma parameter ThickBool "Thick Borders" 0.0 0.0 1.0 1.0
#pragma parameter ThinBool "Thin Borders" 0.0 0.0 1.0 1.0

#if defined(VERTEX)

Expand Down Expand Up @@ -110,7 +113,10 @@ uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
uniform sampler2D Texture;
uniform sampler2D BORDER;
uniform sampler2D BORDERTHICK;
uniform sampler2D BORDERTHIN;
uniform sampler2D overlay;
uniform sampler2D overlay2;
COMPAT_VARYING vec4 TEX0;

// compatibility #defines
Expand All @@ -123,9 +129,15 @@ COMPAT_VARYING vec4 TEX0;
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float OverlayMix;
uniform COMPAT_PRECISION float ASPECTRATIO;
uniform COMPAT_PRECISION float BorderBool;
uniform COMPAT_PRECISION float ThickBool;
uniform COMPAT_PRECISION float ThinBool;
#else
#define OverlayMix 1.0
#define ASPECTRATIO 43.0
#define BorderBool 0.0
#define ThickBool 0.0
#define ThinBool 0.0
#endif

float blendSoftlight(float base, float blend) {
Expand All @@ -135,20 +147,32 @@ float blendSoftlight(float base, float blend) {
void main()
{

vec4 frame = COMPAT_TEXTURE(Source, vTexCoord).rgba;
vec4 softlight = COMPAT_TEXTURE(overlay, vTexCoord).rgba;
vec4 frame = COMPAT_TEXTURE(Source, vTexCoord).rgba;
vec4 softlight = COMPAT_TEXTURE(overlay, vTexCoord).rgba;
if ( OverlayMix < 1.0 ){
softlight = COMPAT_TEXTURE(overlay2, vTexCoord).rgba;
softlight.a = OverlayMix;
}

vec4 ImageFinal = frame;

ImageFinal.r = blendSoftlight(frame.r,softlight.r);
ImageFinal.g = blendSoftlight(frame.g,softlight.g);
ImageFinal.b = blendSoftlight(frame.b,softlight.b);
ImageFinal.a = blendSoftlight(frame.a,softlight.a);
ImageFinal = mix(frame,clamp(ImageFinal,0.0,OverlayMix),softlight.a);
ImageFinal = mix(frame,ImageFinal,softlight.a);
// ImageFinal = mix(frame,clamp(ImageFinal,0.0,OverlayMix),softlight.a);

if (ASPECTRATIO == 87.0) {
// Aspect ratio 8:7 will always have a normal border applied
// otherwise glitching will occur on the edges
if (ASPECTRATIO == 87.0 || BorderBool == 1.0 || ThickBool == 1.0 || ThinBool == 1.0) {
vec4 background = COMPAT_TEXTURE(BORDER, vTexCoord);

if(ThickBool == 1.0){
background = COMPAT_TEXTURE(BORDERTHICK, vTexCoord);
}
if(ThinBool == 1.0){
background = COMPAT_TEXTURE(BORDERTHIN, vTexCoord);
}
FragColor = vec4(mix(ImageFinal, background, background.a));
}
else{
Expand Down
Binary file modified reshade/shaders/blendsoftlight/border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reshade/shaders/blendsoftlight/borderthick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reshade/shaders/blendsoftlight/borderthin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed reshade/shaders/blendsoftlight/shine.png
Binary file not shown.
Binary file added reshade/shaders/blendsoftlight/shine720.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reshade/shaders/blendsoftlight/shineblack720.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ff70d2

Please sign in to comment.