mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-25 08:51:32 +11:00
7cdc185f8c
Changes: * Guest Advanced updated to crt-guest-advanced-2023-02-25-release1 * Improvements to the new Magic Glow feature * Turn Magic Glow on and Increase the Glow amount to see the effect * New Slot Mask Mitigation option to reduce moire * Added/Restored Guest's Raster Bloom as well as Overscan control * Updated Comments in presets to use # instead of // as per @hunterk's request * Added rotation option for Rotate CRT Tube: * -1 = 90 Degrees Clockwise (or 270 Counter Clockwise) * 0 = No Rotation * 1 = 90 Degrees Counter Clockwise * Added groundwork for the wildcard replacement feature so presets will auto rotate and not flip in the future * Added DREZ presets which keep the horizontal resolution * Helpful for applying to modern games, these two are good to try * `Presets\Base_CRT_Presets_DREZ\MBZ__3__STD__GDV__DREZ_X-VIEWPORT_Y-240p.slangp` * `Presets\Base_CRT_Presets_DREZ\MBZ__3__STD__GDV__DREZ_X-VIEWPORT_Y-480p.slangp` * Also looks good on MVC2, try `Presets\Base_CRT_Presets_DREZ\MBZ__3__STD__GDV__DREZ_X-VIEWPORT_Y-240p.slangp` * Updated preset capability and performance table * Added contrast for signal noise * Added some more Sinden presets for SCREEN-ONLY and POTATO * Added Screen Region to Resolution Debug text * Good for getting the screen region pixel coordinates if you need them * Adjusted Ambient Lighting Scaling when using the Inherit Zoom scale mode * Now when you zoom out it is much less likely to generate a black frame covering the outer parts of the background image * The minimum size of the lighting texture will be close to the height of the current viewport * This reduces the likelihood that we will see the cutoff * ScaleFx: Exposed more of the settings so they can be tweaked * Default Settings changed: * ScaleFx Threshold: now 0.43 (was 0.5) * ScaleFx Filter Corners: now 0 (was 1) * These settings result in a slighly clearer picture and less rounding of square corners * SMOOTH-ADV ntsc presets: ntsc_scale adjusted so it visually matches the regular ADV ntsc presets
135 lines
3.7 KiB
Plaintext
135 lines
3.7 KiB
Plaintext
#version 450
|
|
|
|
/*
|
|
Gaussian blur - horizontal pass, dynamic range, resizable
|
|
|
|
Copyright (C) 2020 - 2022 guest(r) - guest.r@gmail.com
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
layout(push_constant) uniform Push
|
|
{
|
|
vec4 LinearizePassSize;
|
|
vec4 OriginalSize;
|
|
vec4 OutputSize;
|
|
uint FrameCount;
|
|
float glow;
|
|
float SIZEH;
|
|
float SIGMA_H;
|
|
float m_glow;
|
|
float m_glow_cutoff;
|
|
float m_glow_low;
|
|
float m_glow_high;
|
|
float m_glow_dist;
|
|
} params;
|
|
|
|
#pragma parameter GDV_GDV_ADV_LINE " " 0 0 0.001 0.001
|
|
#pragma parameter GDV_GDV_ADV_TITLE_2 "[ --- GUEST-DrVenom Advanced --- ]:" 0.0 0.0 1.0 1.0
|
|
|
|
#pragma parameter bogus_glow "[ GLOW ]:" 0.0 0.0 1.0 1.0
|
|
|
|
#pragma parameter m_glow " Ordinary Glow / Magic Glow -- m_glow" 0.0 0.0 1.0 1.0
|
|
|
|
#pragma parameter m_glow_low " Magic Glow Low Strength -- m_glow_low" 0.35 0.0 7.0 0.05
|
|
|
|
#pragma parameter m_glow_high " Magic Glow High Strength -- m_glow_high" 5.0 0.0 7.0 0.10
|
|
|
|
#pragma parameter m_glow_dist " Magic Glow Distribution -- m_glow_dist" 1.0 0.20 4.0 0.05
|
|
|
|
#pragma parameter glow " (Magic) Glow Strength -- glow" 0.08 -2.0 2.0 0.01
|
|
#define m_glow params.m_glow
|
|
|
|
#pragma parameter m_glow_mask " Magic Glow Mask Strength -- m_glow_mask" 1.0 0.0 2.0 0.025
|
|
|
|
#pragma parameter m_glow_cutoff " Magic Glow Cutoff -- m_glow_cutoff" 0.12 0.0 0.4 0.01
|
|
#define m_glow_cutoff params.m_glow_cutoff
|
|
|
|
#pragma parameter SIZEH " Horizontal Radius (Num Samples) -- SIZEH" 6.0 1.0 50.0 1.0
|
|
#define SIZEH params.SIZEH
|
|
|
|
#pragma parameter SIGMA_H " Horizontal Sigma ( Spread ) -- SIGMA_H" 1.20 0.20 15.0 0.10
|
|
#define SIGMA_H params.SIGMA_H
|
|
|
|
layout(std140, set = 0, binding = 0) uniform UBO
|
|
{
|
|
mat4 MVP;
|
|
} global;
|
|
|
|
#pragma stage vertex
|
|
layout(location = 0) in vec4 Position;
|
|
layout(location = 1) in vec2 TexCoord;
|
|
layout(location = 0) out vec2 vTexCoord;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = global.MVP * Position;
|
|
vTexCoord = TexCoord;
|
|
}
|
|
|
|
#pragma stage fragment
|
|
layout(location = 0) in vec2 vTexCoord;
|
|
layout(location = 0) out vec4 FragColor;
|
|
layout(set = 0, binding = 2) uniform sampler2D LinearizePass;
|
|
|
|
#define COMPAT_TEXTURE(c,d) texture(c,d)
|
|
|
|
float invsqrsigma = 1.0/(2.0*SIGMA_H*SIGMA_H);
|
|
|
|
float gaussian(float x)
|
|
{
|
|
return exp(-x*x*invsqrsigma);
|
|
}
|
|
|
|
vec3 plant (vec3 tar, float r)
|
|
{
|
|
float t = max(max(tar.r,tar.g),tar.b) + 0.00001;
|
|
return tar * r / t;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
vec4 SourceSize1 = params.OriginalSize;
|
|
float f = fract(SourceSize1.x * vTexCoord.x);
|
|
f = 0.5 - f;
|
|
vec2 tex = floor(SourceSize1.xy * vTexCoord)*SourceSize1.zw + 0.5*SourceSize1.zw;
|
|
vec3 color = vec3(0.0);
|
|
vec2 dx = vec2(SourceSize1.z, 0.0);
|
|
|
|
float w;
|
|
float wsum = 0.0;
|
|
vec3 pixel;
|
|
float n = -SIZEH;
|
|
|
|
do
|
|
{
|
|
pixel = COMPAT_TEXTURE(LinearizePass, tex + n*dx).rgb;
|
|
if (m_glow > 0.5)
|
|
{
|
|
pixel = max(pixel-m_glow_cutoff, 0.0);
|
|
pixel = plant(pixel, max(max(max(pixel.r,pixel.g),pixel.b)-m_glow_cutoff,0.0));
|
|
}
|
|
w = gaussian(n+f);
|
|
color = color + w * pixel;
|
|
wsum = wsum + w;
|
|
n = n + 1.0;
|
|
|
|
} while (n <= SIZEH);
|
|
|
|
color = color / wsum;
|
|
|
|
FragColor = vec4(color, 1.0);
|
|
} |