mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
break glow-trails to its own shader and add vector-glow presets
This commit is contained in:
parent
54d09899b4
commit
8009dea4d7
|
@ -1,6 +1,6 @@
|
||||||
shaders = 17
|
shaders = 17
|
||||||
|
|
||||||
shader0 = shaders/crt-lottes-multipass/glow-trails0.slang
|
shader0 = shaders/glow-trails/glow-trails0.slang
|
||||||
filter_linear0 = false
|
filter_linear0 = false
|
||||||
scale_type0 = source
|
scale_type0 = source
|
||||||
scale0 = 1.0
|
scale0 = 1.0
|
||||||
|
@ -18,7 +18,7 @@ scale_type2 = "source"
|
||||||
scale2 = "1.0"
|
scale2 = "1.0"
|
||||||
srgb_framebuffer2 = "true"
|
srgb_framebuffer2 = "true"
|
||||||
|
|
||||||
shader3 = shaders/crt-lottes-multipass/glow-trails1.slang
|
shader3 = shaders/glow-trails/glow-trails1.slang
|
||||||
|
|
||||||
shader4 = shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
|
shader4 = shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
|
||||||
srgb_framebuffer4 = true
|
srgb_framebuffer4 = true
|
||||||
|
|
45
crt/shaders/glow-trails/combine.slang
Normal file
45
crt/shaders/glow-trails/combine.slang
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(push_constant) uniform Push
|
||||||
|
{
|
||||||
|
vec4 SourceSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 OutputSize;
|
||||||
|
uint FrameCount;
|
||||||
|
float screen_combine;
|
||||||
|
float haze_strength;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
#pragma parameter screen_combine "Screen Combine" 0.0 0.0 1.0 1.0
|
||||||
|
#pragma parameter haze_strength "Haze Strength" 0.5 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;
|
||||||
|
layout(set = 0, binding = 3) uniform sampler2D PASS1;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 blurred = pow(texture(Source, vTexCoord), vec4(2.2));
|
||||||
|
vec4 unblurred = pow(texture(PASS1, vTexCoord), vec4(2.2));
|
||||||
|
vec4 dark = vec4(pow(mix(unblurred, blurred, params.haze_strength), vec4(1.0 / 2.2)));//vec4(pow((unblurred + blurred) / 2.0, vec4(1.0 / 2.2)));
|
||||||
|
vec4 bright = vec4(pow(vec4(1.0) - (vec4(1.0) - unblurred) * (vec4(1.0) - blurred), vec4(1.0 / 2.2)));
|
||||||
|
FragColor = (params.screen_combine < 0.5) ? dark : bright;
|
||||||
|
}
|
66
crt/shaders/glow-trails/glow-trails0.slang
Normal file
66
crt/shaders/glow-trails/glow-trails0.slang
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(push_constant) uniform Push
|
||||||
|
{
|
||||||
|
vec4 SourceSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 OutputSize;
|
||||||
|
uint FrameCount;
|
||||||
|
float mixfactor;
|
||||||
|
float threshold;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
#pragma parameter mixfactor "Motionblur Fadeout" 0.5 0.0 1.0 0.01
|
||||||
|
#pragma parameter threshold "Brightness Threshold" 0.9 0.0 1.0 0.01
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
float key(float avg)
|
||||||
|
{
|
||||||
|
float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));
|
||||||
|
return max(0.0, guess) + 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat3 yiq2rgb_mat = mat3(
|
||||||
|
1.0, 1.0, 1.0,
|
||||||
|
0.956, -0.2720, -1.1060,
|
||||||
|
0.6210, -0.6474, 1.7046
|
||||||
|
);
|
||||||
|
|
||||||
|
mat3 yiq_mat = mat3(
|
||||||
|
0.2989, 0.5959, 0.2115,
|
||||||
|
0.5870, -0.2744, -0.5229,
|
||||||
|
0.1140, -0.3216, 0.3114
|
||||||
|
);
|
||||||
|
|
||||||
|
#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 PassFeedback0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec3 frame = texture(Source, vTexCoord).rgb;
|
||||||
|
float luma = (frame.rrr * yiq_mat).r;
|
||||||
|
float trails = clamp(luma - params.threshold, 0.0, 1.0);
|
||||||
|
vec4 fdback = pow(texture(PassFeedback0, vTexCoord), vec4(2.2));
|
||||||
|
vec4 mixed = clamp((1.0 - params.mixfactor) * vec4(trails) - params.mixfactor * fdback, 0.0, 1.0) + params.mixfactor * fdback;
|
||||||
|
// vec4 current = pow(texture(Source, vTexCoord), vec4(2.2));
|
||||||
|
|
||||||
|
FragColor = pow(mixed, vec4(1.0 / 2.2));
|
||||||
|
}
|
47
crt/shaders/glow-trails/glow-trails1.slang
Normal file
47
crt/shaders/glow-trails/glow-trails1.slang
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(push_constant) uniform Push
|
||||||
|
{
|
||||||
|
vec4 SourceSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 OutputSize;
|
||||||
|
uint FrameCount;
|
||||||
|
float trail_bright;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
#pragma parameter trail_bright "Phos. Trail Brightness" 0.25 0.0 1.0 0.01
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
mat3 yiq_mat = mat3(
|
||||||
|
0.2989, 0.5959, 0.2115,
|
||||||
|
0.5870, -0.2744, -0.5229,
|
||||||
|
0.1140, -0.3216, 0.3114
|
||||||
|
);
|
||||||
|
|
||||||
|
#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 Original;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 trails = texture(Source, vTexCoord).rgba;
|
||||||
|
vec4 current = pow(texture(Original, vTexCoord).rgba, vec4(2.2));
|
||||||
|
FragColor = vec4(pow(current + vec4(clamp(trails.r - current.r, 0.0, 1.0) * params.trail_bright), vec4(1.0 / 2.2)));
|
||||||
|
}
|
29
crt/vector-glow-alt-render.slangp
Normal file
29
crt/vector-glow-alt-render.slangp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
shaders = 4
|
||||||
|
|
||||||
|
shader0 = "../misc/image-adjustment.slang"
|
||||||
|
alias0 = PASS1
|
||||||
|
|
||||||
|
shader1 = "../blurs/blur11fast-vertical.slang"
|
||||||
|
filter_linear1 = "true"
|
||||||
|
scale_type1 = "source"
|
||||||
|
scale1 = "0.5"
|
||||||
|
mipmap1 = "true"
|
||||||
|
|
||||||
|
shader2 = "../blurs/blur11fast-horizontal.slang"
|
||||||
|
filter_linear2 = "true"
|
||||||
|
scale_type2 = "source"
|
||||||
|
scale2 = "0.5"
|
||||||
|
mipmap_input2 = "true"
|
||||||
|
|
||||||
|
shader3 = "shaders/glow-trails/combine.slang"
|
||||||
|
scale_type3 = "viewport"
|
||||||
|
scale3 = 1.0
|
||||||
|
|
||||||
|
parameters = "mixfactor;threshold;trail_bright;glowFactor;haze_strength;luminance;screen_combine"
|
||||||
|
mixfactor = "0.18"
|
||||||
|
threshold = "0.90"
|
||||||
|
trail_bright = "0.30"
|
||||||
|
glowFactor = "0.10"
|
||||||
|
haze_strength = "0.75"
|
||||||
|
luminance = "1.50"
|
||||||
|
screen_combine = "1.0"
|
49
crt/vector-glow.slangp
Normal file
49
crt/vector-glow.slangp
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
shaders = 9
|
||||||
|
|
||||||
|
shader0 = shaders/glow-trails/glow-trails0.slang
|
||||||
|
filter_linear0 = false
|
||||||
|
scale_type0 = source
|
||||||
|
scale0 = 1.0
|
||||||
|
|
||||||
|
shader1 = "../blurs/blur9fast-vertical.slang"
|
||||||
|
filter_linear1 = "true"
|
||||||
|
scale_type1 = "source"
|
||||||
|
scale1 = "1.0"
|
||||||
|
srgb_framebuffer1 = "true"
|
||||||
|
|
||||||
|
shader2 = "../blurs/blur9fast-horizontal.slang"
|
||||||
|
alias2 = "TRAIL_BLUR"
|
||||||
|
filter_linear2 = "true"
|
||||||
|
scale_type2 = "source"
|
||||||
|
scale2 = "1.0"
|
||||||
|
srgb_framebuffer2 = "true"
|
||||||
|
|
||||||
|
shader3 = shaders/glow-trails/glow-trails1.slang
|
||||||
|
|
||||||
|
shader4 = "../anti-aliasing/shaders/advanced-aa.slang"
|
||||||
|
alias4 = PASS1
|
||||||
|
|
||||||
|
shader5 = "../blurs/blur9fast-vertical.slang"
|
||||||
|
filter_linear5 = "true"
|
||||||
|
scale_type5 = "source"
|
||||||
|
scale5 = "1.0"
|
||||||
|
srgb_framebuffer5 = "true"
|
||||||
|
|
||||||
|
shader6 = "../blurs/blur9fast-horizontal.slang"
|
||||||
|
filter_linear6 = "true"
|
||||||
|
scale_type6 = "source"
|
||||||
|
scale6 = "1.0"
|
||||||
|
srgb_framebuffer6 = "true"
|
||||||
|
|
||||||
|
shader7 = "shaders/glow-trails/combine.slang"
|
||||||
|
|
||||||
|
shader8 = "../misc/image-adjustment.slang"
|
||||||
|
|
||||||
|
parameters = "mixfactor;threshold;trail_bright;glowFactor;haze_strength;luminance;bright"
|
||||||
|
mixfactor = "0.18"
|
||||||
|
threshold = "0.90"
|
||||||
|
trail_bright = "0.30"
|
||||||
|
glowFactor = "0.10"
|
||||||
|
haze_strength = "0.25"
|
||||||
|
luminance = "1.50"
|
||||||
|
bright = "1.0"
|
|
@ -1,6 +1,6 @@
|
||||||
shaders = 18
|
shaders = 18
|
||||||
|
|
||||||
shader0 = ../crt/shaders/crt-lottes-multipass/glow-trails0.slang
|
shader0 = ../crt/shaders/glow-trails/glow-trails0.slang
|
||||||
filter_linear0 = false
|
filter_linear0 = false
|
||||||
scale_type0 = source
|
scale_type0 = source
|
||||||
scale0 = 1.0
|
scale0 = 1.0
|
||||||
|
@ -18,7 +18,7 @@ scale_type2 = "source"
|
||||||
scale2 = "1.0"
|
scale2 = "1.0"
|
||||||
srgb_framebuffer2 = "true"
|
srgb_framebuffer2 = "true"
|
||||||
|
|
||||||
shader3 = ../crt/shaders/crt-lottes-multipass/glow-trails1.slang
|
shader3 = ../crt/shaders/glow-trails/glow-trails1.slang
|
||||||
|
|
||||||
shader4 = ../crt/shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
|
shader4 = ../crt/shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
|
||||||
srgb_framebuffer4 = true
|
srgb_framebuffer4 = true
|
||||||
|
|
Loading…
Reference in a new issue