mirror of
https://github.com/libretro/slang-shaders.git
synced 2024-11-23 08:19:54 +00:00
add crt-torridgristle shaders and preset
This commit is contained in:
parent
969a763d35
commit
d81d82ef48
44
crt/crt-torridgristle.slangp
Normal file
44
crt/crt-torridgristle.slangp
Normal file
@ -0,0 +1,44 @@
|
||||
shaders = 7
|
||||
|
||||
shader0 = shaders/torridgristle/Scanline-Interpolation.slang
|
||||
filter_linear0 = true
|
||||
scale_type0 = source
|
||||
|
||||
shader1 = shaders/torridgristle/ScanlineSimple.slang
|
||||
filter_linear1 = true
|
||||
scale_type1 = source
|
||||
scale1 = 3.0
|
||||
|
||||
shader2 = ../reshade/shaders/blendoverlay/blendoverlay.slang
|
||||
filter_linear2 = true
|
||||
scale_type2 = viewport
|
||||
|
||||
shader3 = shaders/torridgristle/Brighten.slang
|
||||
filter_linear3 = true
|
||||
alias3 = candy_ref
|
||||
|
||||
shader4 = shaders/torridgristle/sunset-gaussian-vert.slang
|
||||
filter_linear4 = true
|
||||
scale_type4 = source
|
||||
|
||||
shader5 = shaders/torridgristle/sunset-gaussian-horiz.slang
|
||||
filter_linear5 = true
|
||||
scale_type5 = source
|
||||
|
||||
shader6 = shaders/torridgristle/Candy-Bloom.slang
|
||||
filter_linear6 = true
|
||||
|
||||
textures = "overlay"
|
||||
overlay = ../reshade/shaders/blendoverlay/shadowmask-4x4.png
|
||||
filter_overlay = linear
|
||||
|
||||
parameters = "ScanlineSize;YIQAmount;BrightenLevel;BrightenAmount;GlowLevel;GlowTightness;LUTHeight;LUTWidth;OverlayMix"
|
||||
ScanlineSize = 3.0;
|
||||
YIQAmount = 0.35;
|
||||
BrightenLevel = 2.0;
|
||||
BrightenAmount = 0.1;
|
||||
GlowLevel = 1.0;
|
||||
GlowTightness = 0.8;
|
||||
LUTWidth = 4.0
|
||||
LUTHeight = 4.0
|
||||
OverlayMix = 0.5
|
43
crt/shaders/torridgristle/Brighten.slang
Normal file
43
crt/shaders/torridgristle/Brighten.slang
Normal file
@ -0,0 +1,43 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
float BrightenLevel;
|
||||
float BrightenAmount;
|
||||
} params;
|
||||
|
||||
#pragma parameter BrightenLevel "Brighten Level" 2.0 1.0 10.0 1.0
|
||||
#pragma parameter BrightenAmount "Brighten Amount" 0.1 0.0 1.0 0.1
|
||||
|
||||
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 Source;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Picture = texture(Source, vTexCoord).xyz;
|
||||
Picture = clamp(Picture,0.0,1.0);
|
||||
|
||||
FragColor = vec4(mix(Picture,1.0-pow(1.0-Picture,vec3(params.BrightenLevel)),params.BrightenAmount),1.0);
|
||||
}
|
53
crt/shaders/torridgristle/Candy-Bloom.slang
Normal file
53
crt/shaders/torridgristle/Candy-Bloom.slang
Normal file
@ -0,0 +1,53 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
float GlowLevel;
|
||||
float GlowTightness;
|
||||
} params;
|
||||
|
||||
#pragma parameter GlowLevel "Glow Level" 1.0 0.0 1.0 0.1
|
||||
#pragma parameter GlowTightness "Glow Tightness" 0.5 0.0 1.0 0.1
|
||||
|
||||
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 Source;
|
||||
layout(set = 0, binding = 3) uniform sampler2D candy_ref;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Picture = texture(Source, vTexCoord).xyz;
|
||||
|
||||
float MaxRGB = max(Picture.x, max(Picture.y, Picture.z));
|
||||
float MinRGB = min(Picture.x, min(Picture.y, Picture.z));
|
||||
|
||||
float YIQLuminance = ((0.299*Picture.x) + (0.587*Picture.y) + (0.114*Picture.z));
|
||||
|
||||
|
||||
Picture /= MaxRGB;
|
||||
Picture = clamp(Picture,0.0,1.0);
|
||||
|
||||
|
||||
FragColor = vec4(mix(texture(candy_ref, vTexCoord).xyz, Picture, mix(1.-pow(1.-YIQLuminance,2.0),YIQLuminance*YIQLuminance,params.GlowTightness)*params.GlowLevel),1.0);
|
||||
}
|
36
crt/shaders/torridgristle/Scanline-Interpolation.slang
Normal file
36
crt/shaders/torridgristle/Scanline-Interpolation.slang
Normal file
@ -0,0 +1,36 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
} params;
|
||||
|
||||
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 Source;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texCoordHard = vec2(vTexCoord.x,(floor(vTexCoord.y*params.SourceSize.y)+0.5)/params.SourceSize.y);
|
||||
FragColor = vec4(texture(Source, texCoordHard).rgb, 1.0);
|
||||
}
|
67
crt/shaders/torridgristle/ScanlineSimple.slang
Normal file
67
crt/shaders/torridgristle/ScanlineSimple.slang
Normal file
@ -0,0 +1,67 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
float ScanlineSize;
|
||||
float YIQAmount;
|
||||
} params;
|
||||
|
||||
#pragma parameter ScanlineSize "Scanline Size" 3.0 2.0 32.0 1.0
|
||||
#pragma parameter YIQAmount "YIQ Amount" 1.0 0.0 1.0 0.05
|
||||
|
||||
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 Source;
|
||||
|
||||
#define Pi 3.1415926536
|
||||
const mat3 RGB_to_YIQ = mat3( 0.299 , 0.595716 , 0.211456 , 0.587 , -0.274453 , -0.522591 , 0.114 , -0.321263 , 0.311135 );
|
||||
const mat3 YIQ_to_RGB = mat3( 1.0 , 1.0 , 1.0 , 0.9563 , -0.2721 , -1.1070 , 0.6210 , -0.6474 , 1.7046 );
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Picture = texture(Source,vTexCoord).xyz;
|
||||
|
||||
float HSBrightness = max(max(Picture.x,Picture.y),max(Picture.y,Picture.z));
|
||||
float YIQLuminance = ((0.299*Picture.x) + (0.587*Picture.y) + (0.114*Picture.z));
|
||||
|
||||
float HSBYIQHybrid = mix(HSBrightness,YIQLuminance,HSBrightness);
|
||||
|
||||
float Scanline = mod(vTexCoord.y*params.OutputSize.y,params.ScanlineSize)/params.ScanlineSize;
|
||||
Scanline = 1.-abs(Scanline-0.5)*2.;
|
||||
Scanline = 1.-pow(1.-Scanline,2.0);
|
||||
|
||||
Scanline = clamp(sqrt(Scanline)-(1-HSBYIQHybrid),0.0,1.0);
|
||||
Scanline /= HSBYIQHybrid;
|
||||
|
||||
|
||||
|
||||
vec3 YIQApplication = Picture * RGB_to_YIQ;
|
||||
YIQApplication.x *= Scanline;
|
||||
YIQApplication *= YIQ_to_RGB;
|
||||
|
||||
FragColor = vec4(mix(Picture*Scanline,YIQApplication*mix(Scanline,1.0,0.75),params.YIQAmount),1.0);
|
||||
//FragColor = vec4(Picture,1.0);
|
||||
//FragColor = vec4(Scanline);
|
||||
|
||||
}
|
49
crt/shaders/torridgristle/sunset-gaussian-horiz.slang
Normal file
49
crt/shaders/torridgristle/sunset-gaussian-horiz.slang
Normal file
@ -0,0 +1,49 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
} params;
|
||||
|
||||
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;
|
||||
layout(location = 1) out vec2 blurCoordinates[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
|
||||
blurCoordinates[0] = vTexCoord.xy;
|
||||
blurCoordinates[1] = vTexCoord.xy + params.OutputSize.zw * vec2(1.407333,0.0);
|
||||
blurCoordinates[2] = vTexCoord.xy - params.OutputSize.zw * vec2(1.407333,0.0);
|
||||
blurCoordinates[3] = vTexCoord.xy + params.OutputSize.zw * vec2(3.294215,0.0);
|
||||
blurCoordinates[4] = vTexCoord.xy - params.OutputSize.zw * vec2(3.294215,0.0);
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 1) in vec2 blurCoordinates[5];
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sum = vec4(0.0);
|
||||
sum += texture(Source, blurCoordinates[0]) * 0.204164;
|
||||
sum += texture(Source, blurCoordinates[1]) * 0.304005;
|
||||
sum += texture(Source, blurCoordinates[2]) * 0.304005;
|
||||
sum += texture(Source, blurCoordinates[3]) * 0.093913;
|
||||
sum += texture(Source, blurCoordinates[4]) * 0.093913;
|
||||
FragColor = sum;
|
||||
}
|
49
crt/shaders/torridgristle/sunset-gaussian-vert.slang
Normal file
49
crt/shaders/torridgristle/sunset-gaussian-vert.slang
Normal file
@ -0,0 +1,49 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
} params;
|
||||
|
||||
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;
|
||||
layout(location = 1) out vec2 blurCoordinates[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
|
||||
blurCoordinates[0] = vTexCoord.xy;
|
||||
blurCoordinates[1] = vTexCoord.xy + params.OutputSize.zw * vec2(0.,1.407333);
|
||||
blurCoordinates[2] = vTexCoord.xy - params.OutputSize.zw * vec2(0.,1.407333);
|
||||
blurCoordinates[3] = vTexCoord.xy + params.OutputSize.zw * vec2(0.,3.294215);
|
||||
blurCoordinates[4] = vTexCoord.xy - params.OutputSize.zw * vec2(0.,3.294215);
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 1) in vec2 blurCoordinates[5];
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sum = vec4(0.0);
|
||||
sum += texture(Source, blurCoordinates[0]) * 0.204164;
|
||||
sum += texture(Source, blurCoordinates[1]) * 0.304005;
|
||||
sum += texture(Source, blurCoordinates[2]) * 0.304005;
|
||||
sum += texture(Source, blurCoordinates[3]) * 0.093913;
|
||||
sum += texture(Source, blurCoordinates[4]) * 0.093913;
|
||||
FragColor = sum;
|
||||
}
|
Loading…
Reference in New Issue
Block a user