slang-shaders/crt/shaders/crt-maximus-royale/src/H_blur.slang
Carlos O'Connor 858404b1db CRT Maximus Royale filter added
Based on CRT Royale, this filter includes a lot of cool features:

- Horizontal ringing (produced by low pass filters e.g. SNES video output)
- CVBS / S-VIDEO / RGB filter modes
- Accurate pixel perfect dimensions (for 1080 resolutions and up)
- TV frames that reminds the 90's experience
- PC monitor frame also available
- New adjustable scale system to fix image size and overscans
- Ambient lighting and rear LED simulation modes
- Reflections over the screen borders
- Nice bulged screen finish
- Auto scales to any resolution, preserving 4:3 ratio
- 3 shaders available: normal mode, fast mode and doubled outputs mode

Glcore and d3d11 drivers supported at the moment.
2022-09-03 22:52:33 -05:00

74 lines
2 KiB
Plaintext

#version 450
///////////////////////////// GPL LICENSE NOTICE /////////////////////////////
// crt-maximus-royale: A fully customizable extension for crt-royale shader,
// inside a TV / MONITOR BOX with backlight and some other cool stuff.
// Copyright (C) 2022 DigiDwrf
//
// 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 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
{
float Hsharpness;
} params;
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
} global;
#pragma parameter Hsharpness "Horizontal Sharpness" 10.0 1.0 20.0 0.5
#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 Source;
void main()
{
vec3 Color;
float count = -0.005 / params.Hsharpness;
float limit = 0.005 / params.Hsharpness;
float countAdd = 0.001 / params.Hsharpness;
if (params.Hsharpness < 20.0)
{
for (float i = count; i < limit ; i += countAdd)
{
Color += texture(Source, vec2(vTexCoord.x + i,vTexCoord.y)).rgb;
}
Color /= 10.0;
}
else
{
Color = texture(Source, vTexCoord).rgb;
}
FragColor = vec4( Color , 1.0 );
}