diff --git a/reshade/retro-v2-softlight-image-adjustments.glslp b/reshade/retro-v2-softlight-image-adjustments.glslp new file mode 100644 index 00000000..21235c3e --- /dev/null +++ b/reshade/retro-v2-softlight-image-adjustments.glslp @@ -0,0 +1,33 @@ +shaders = 3 +shader0 = ../misc/image-adjustment.glsl +shader1 = ../handheld/shaders/retro-v2.glsl +shader2 = shaders/blendsoftlight/blendsoftlight.glsl + +textures = "overlay;overlay2;BORDER;BORDERTHICK;BORDERTHIN" +# change this path to point to your overlay image +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" + +scale_type1 = source +scale1 = 4 + +filter_linear1 = false +filter_linear2 = true + +parameters = "RETRO_PIXEL_SIZE;ia_luminance;ia_target_gamma;ia_saturation" +# set these to the width/height of your overlay image +SCALE = "1.0" +RETRO_PIXEL_SIZE = "0.70" +ia_luminance = 0.90 +ia_target_gamma = 2.40 +ia_saturation = 0.90 +ia_black_level = -0.10 +ia_contrast = 1.10 diff --git a/reshade/retro-v2-softlight-subtle.glslp b/reshade/retro-v2-softlight-subtle.glslp new file mode 100644 index 00000000..9a69487b --- /dev/null +++ b/reshade/retro-v2-softlight-subtle.glslp @@ -0,0 +1,29 @@ +shaders = 2 +shader0 = ../handheld/shaders/retro-v2.glsl +shader1 = shaders/blendsoftlight/blendsoftlight.glsl + + + +textures = "overlay;overlay2;BORDER;BORDERTHICK;BORDERTHIN" +# change this path to point to your overlay image +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" + +scale_type0 = source +scale0 = 4 + +filter_linear0 = false +filter_linear1 = true + +parameters = "RETRO_PIXEL_SIZE" +# set these to the width/height of your overlay image +SCALE = "1.0" +RETRO_PIXEL_SIZE = "0.70" diff --git a/reshade/retro-v2-softlight.glslp b/reshade/retro-v2-softlight.glslp new file mode 100644 index 00000000..c22c64f8 --- /dev/null +++ b/reshade/retro-v2-softlight.glslp @@ -0,0 +1,29 @@ +shaders = 2 +shader0 = ../handheld/shaders/retro-v2.glsl +shader1 = shaders/blendsoftlight/blendsoftlight.glsl + + + +textures = "overlay;overlay2;BORDER;BORDERTHICK;BORDERTHIN" +# change this path to point to your overlay image +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" + +scale_type0 = source +scale0 = 4 + +filter_linear0 = false +filter_linear1 = true + +parameters = "RETRO_PIXEL_SIZE" +# set these to the width/height of your overlay image +SCALE = "1.0" +RETRO_PIXEL_SIZE = "0.70" diff --git a/reshade/shaders/blendsoftlight/blendsoftlight.glsl b/reshade/shaders/blendsoftlight/blendsoftlight.glsl new file mode 100644 index 00000000..4ccb02b4 --- /dev/null +++ b/reshade/shaders/blendsoftlight/blendsoftlight.glsl @@ -0,0 +1,182 @@ +// version directive if necessary + +// blendSoftlight +// based on: +// https://github.com/jamieowen/glsl-blend for blendSoftlight +// +// The MIT License (MIT) Copyright (c) 2015 Jamie Owen +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Same MIT License applies to contributions from Ben Reaves +// + +#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) + +#if __VERSION__ >= 130 +#define COMPAT_VARYING out +#define COMPAT_ATTRIBUTE in +#define COMPAT_TEXTURE texture +#else +#define COMPAT_VARYING varying +#define COMPAT_ATTRIBUTE attribute +#define COMPAT_TEXTURE texture2D +#endif + +#ifdef GL_ES +#define COMPAT_PRECISION mediump +#else +#define COMPAT_PRECISION +#endif + +COMPAT_ATTRIBUTE vec4 VertexCoord; +COMPAT_ATTRIBUTE vec4 COLOR; +COMPAT_ATTRIBUTE vec4 TexCoord; +COMPAT_VARYING vec4 COL0; +COMPAT_VARYING vec4 TEX0; + +vec4 _oPosition1; +uniform mat4 MVPMatrix; +uniform COMPAT_PRECISION int FrameDirection; +uniform COMPAT_PRECISION int FrameCount; +uniform COMPAT_PRECISION vec2 OutputSize; +uniform COMPAT_PRECISION vec2 TextureSize; +uniform COMPAT_PRECISION vec2 InputSize; + +// compatibility #defines +#define vTexCoord TEX0.xy +#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize +#define OutputSize vec4(OutputSize, 1.0 / OutputSize) + +#ifdef PARAMETER_UNIFORM +// All parameter floats need to have COMPAT_PRECISION in front of them +uniform COMPAT_PRECISION float SCALE; +uniform COMPAT_PRECISION float ASPECTRATIO; +#else +#define SCALE 1.0 +#define ASPECTRATIO 43.0 +#endif + +void main() +{ + gl_Position = MVPMatrix * VertexCoord; + if (ASPECTRATIO == 43.0) { + TEX0.xy = TexCoord.xy; + } + else if (ASPECTRATIO == 87.0) { + vec2 box_scale = vec2(SCALE + 0.06, SCALE + 0.06); + vec2 scale = (OutputSize.xy / SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5, 0.5) * SourceSize.xy / TextureSize.xy; + vec2 diff = TexCoord.xy - middle; + TEX0.xy = (middle + diff * scale); + } + else { + TEX0.xy = TexCoord.xy; + } +} + +#elif defined(FRAGMENT) + +#ifdef GL_ES +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else +precision mediump float; +#endif +#define COMPAT_PRECISION mediump +#else +#define COMPAT_PRECISION +#endif + +#if __VERSION__ >= 130 +#define COMPAT_VARYING in +#define COMPAT_TEXTURE texture +out COMPAT_PRECISION vec4 FragColor; +#else +#define COMPAT_VARYING varying +#define FragColor gl_FragColor +#define COMPAT_TEXTURE texture2D +#endif + +uniform COMPAT_PRECISION int FrameDirection; +uniform COMPAT_PRECISION int FrameCount; +uniform COMPAT_PRECISION vec2 OutputSize; +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 +#define Source Texture +#define vTexCoord TEX0.xy + +#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize +#define OutSize vec4(OutputSize, 1.0 / OutputSize) + +#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) { + return (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend)); +} + +void main() +{ + + 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,ImageFinal,softlight.a); + // ImageFinal = mix(frame,clamp(ImageFinal,0.0,OverlayMix),softlight.a); + + // 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{ + FragColor = vec4(ImageFinal); + } +} +#endif diff --git a/reshade/shaders/blendsoftlight/border.png b/reshade/shaders/blendsoftlight/border.png new file mode 100644 index 00000000..f7b3e5c2 Binary files /dev/null and b/reshade/shaders/blendsoftlight/border.png differ diff --git a/reshade/shaders/blendsoftlight/borderthick.png b/reshade/shaders/blendsoftlight/borderthick.png new file mode 100644 index 00000000..6cdefc56 Binary files /dev/null and b/reshade/shaders/blendsoftlight/borderthick.png differ diff --git a/reshade/shaders/blendsoftlight/borderthin.png b/reshade/shaders/blendsoftlight/borderthin.png new file mode 100644 index 00000000..a0c2e842 Binary files /dev/null and b/reshade/shaders/blendsoftlight/borderthin.png differ diff --git a/reshade/shaders/blendsoftlight/shine720.png b/reshade/shaders/blendsoftlight/shine720.png new file mode 100644 index 00000000..a17d83ae Binary files /dev/null and b/reshade/shaders/blendsoftlight/shine720.png differ diff --git a/reshade/shaders/blendsoftlight/shine720_subtle.png b/reshade/shaders/blendsoftlight/shine720_subtle.png new file mode 100644 index 00000000..919ae1d0 Binary files /dev/null and b/reshade/shaders/blendsoftlight/shine720_subtle.png differ diff --git a/reshade/shaders/blendsoftlight/shine_subtle.png b/reshade/shaders/blendsoftlight/shine_subtle.png new file mode 100644 index 00000000..6588d9b7 Binary files /dev/null and b/reshade/shaders/blendsoftlight/shine_subtle.png differ diff --git a/reshade/shaders/blendsoftlight/shineblack720.png b/reshade/shaders/blendsoftlight/shineblack720.png new file mode 100644 index 00000000..8c26b411 Binary files /dev/null and b/reshade/shaders/blendsoftlight/shineblack720.png differ