add glow trails to lottes-multipass-glow

This commit is contained in:
hunterk 2016-09-13 15:51:25 -05:00
parent 7e155ce6fb
commit b3edb4699e
3 changed files with 185 additions and 46 deletions

View file

@ -1,72 +1,98 @@
shaders = 13 shaders = 17
shader0 = shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang shader0 = shaders/crt-lottes-multipass/glow-trails0.slang
float_framebuffer0 = true filter_linear0 = false
alias0 = "REFERENCE" scale_type0 = source
scale0 = 1.0
shader1 = "shaders/crt-lottes-multipass/threshold.slang" shader1 = "../blurs/blur9fast-vertical.slang"
filter_linear1 = "true"
scale_type1 = "source"
scale1 = "1.0"
srgb_framebuffer1 = "true" srgb_framebuffer1 = "true"
shader2 = "../blurs/blur9fast-vertical.slang" shader2 = "../blurs/blur9fast-horizontal.slang"
alias2 = "TRAIL_BLUR"
filter_linear2 = "true" filter_linear2 = "true"
scale_type2 = "source" scale_type2 = "source"
scale2 = "1.0" scale2 = "1.0"
srgb_framebuffer2 = "true" srgb_framebuffer2 = "true"
shader3 = "../blurs/blur9fast-horizontal.slang" shader3 = shaders/crt-lottes-multipass/glow-trails1.slang
alias3 = "HALATION_BLUR"
filter_linear3 = "true"
scale_type3 = "source"
scale3 = "1.0"
srgb_framebuffer3 = "true"
shader4 = shaders/crt-lottes-multipass/horz3minus1.slang shader4 = shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
float_framebuffer4 = true srgb_framebuffer4 = true
scale_type4 = source alias4 = "REFERENCE"
filter_linear4 = true
alias4 = horz3minus1
shader5 = shaders/crt-lottes-multipass/horz3plus1.slang shader5 = "shaders/crt-lottes-multipass/threshold.slang"
float_framebuffer5 = true srgb_framebuffer5 = "true"
scale_type5 = source
filter_linear5 = true
alias5 = horz3plus1
shader6 = shaders/crt-lottes-multipass/horz5minus2.slang shader6 = "../blurs/blur9fast-vertical.slang"
float_framebuffer6 = true filter_linear6 = "true"
scale_type6 = source scale_type6 = "source"
filter_linear6 = true scale6 = "1.0"
alias6 = horz5minus2 srgb_framebuffer6 = "true"
shader7 = shaders/crt-lottes-multipass/horz5.slang shader7 = "../blurs/blur9fast-horizontal.slang"
float_framebuffer7 = true alias7 = "HALATION_BLUR"
scale_type7 = source filter_linear7 = "true"
filter_linear7 = true scale_type7 = "source"
alias7 = horz5 scale7 = "1.0"
srgb_framebuffer7 = "true"
shader8 = shaders/crt-lottes-multipass/horz5plus2.slang shader8 = shaders/crt-lottes-multipass/horz3minus1.slang
float_framebuffer8 = true srgb_framebuffer8 = true
scale_type8 = source scale_type8 = source
filter_linear8 = true filter_linear8 = true
alias8 = horz5plus2 alias8 = horz3minus1
shader9 = shaders/crt-lottes-multipass/horz7minus1.slang shader9 = shaders/crt-lottes-multipass/horz3plus1.slang
float_framebuffer9 = true srgb_framebuffer9 = true
scale_type9 = source scale_type9 = source
filter_linear9 = true filter_linear9 = true
alias9 = horz7minus1 alias9 = horz3plus1
shader10 = shaders/crt-lottes-multipass/horz7.slang shader10 = shaders/crt-lottes-multipass/horz5minus2.slang
float_framebuffer10 = true srgb_framebuffer10 = true
scale_type10 = source scale_type10 = source
filter_linear10 = true filter_linear10 = true
alias10 = horz7 alias10 = horz5minus2
shader11 = shaders/crt-lottes-multipass/horz7plus1.slang shader11 = shaders/crt-lottes-multipass/horz5.slang
float_framebuffer11 = true srgb_framebuffer11 = true
scale_type11 = source scale_type11 = source
filter_linear11 = true filter_linear11 = true
alias11 = horz7plus1 alias11 = horz5
shader12 = shaders/crt-lottes-multipass/crt-lottes-multipass-glow.slang shader12 = shaders/crt-lottes-multipass/horz5plus2.slang
texture_wrap_mode12 = "clamp_to_edge" srgb_framebuffer12 = true
scale_type12 = source
filter_linear12 = true
alias12 = horz5plus2
shader13 = shaders/crt-lottes-multipass/horz7minus1.slang
srgb_framebuffer13 = true
scale_type13 = source
filter_linear13 = true
alias13 = horz7minus1
shader14 = shaders/crt-lottes-multipass/horz7.slang
srgb_framebuffer14 = true
scale_type14 = source
filter_linear14 = true
alias14 = horz7
shader15 = shaders/crt-lottes-multipass/horz7plus1.slang
srgb_framebuffer15 = true
scale_type15 = source
filter_linear15 = true
alias15 = horz7plus1
shader16 = shaders/crt-lottes-multipass/crt-lottes-multipass-glow.slang
texture_wrap_mode16 = "clamp_to_edge"
parameters = "mixfactor;threshold;trail_bright;glowFactor"
mixfactor = "0.75"
threshold = "0.90"
trail_bright = "0.10"
glowFactor = "0.15"

View 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));
}

View 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)));
}