add kawase blurs and make bigblur use them, get rid of ugly, broken bigblur-crt

This commit is contained in:
hunterk 2018-08-15 11:33:39 -05:00
parent 67f6db2744
commit 19b1796bdb
17 changed files with 685 additions and 25 deletions

View file

@ -0,0 +1,35 @@
#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()
{
FragColor = pow(vec4(texture(Source, vTexCoord).rgb, 1.0), vec4(1.0 / 2.2));
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(0., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(1., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(2., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(3., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(4., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(5., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(7., vTexCoord, Source);
}

View file

@ -0,0 +1,53 @@
#version 450
// Kuwase Blur
// based on a shadertoy by Kubuxu
// https://www.shadertoy.com/view/Xl3XW7
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;
vec4 reSample(float d, vec2 uv, sampler2D decal)
{
vec2 step1 = (vec2(d) + 0.5) * params.SourceSize.zw;
vec4 color = vec4(0.);
color += texture(decal, uv + step1) / 4.;
color += texture(decal, uv - step1) / 4.;
vec2 step2 = step1;
step2.x = -step2.x;
color += texture(decal, uv + step2) / 4.;
color += texture(decal, uv - step2) / 4.;
return color;
}
void main()
{
FragColor = reSample(7., vTexCoord, Source);
}

View file

@ -0,0 +1,35 @@
#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()
{
FragColor = pow(vec4(texture(Source, vTexCoord).rgb, 1.0), vec4(2.2));
}

View file

@ -0,0 +1,37 @@
#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;
layout(set = 0, binding = 3) uniform sampler2D Original;
void main()
{
FragColor = 1.0 - (1.0 - texture(Source, vTexCoord)) * (1.0 - texture(Original, vTexCoord));
FragColor = pow(FragColor, vec4(2.2));
}

View file

@ -0,0 +1,33 @@
shaders = 7
shader0 = kawase/linearize.slang
srgb_framebuffer0 = true
scale_type0 = source
shader1 = kawase/kawase0.slang
filter_linear1 = true
srgb_framebuffer1 = true
scale_type1 = source
shader2 = kawase/kawase1.slang
filter_linear2 = true
srgb_framebuffer2 = true
scale_type2 = source
shader3 = kawase/kawase1.slang
filter_linear3 = true
srgb_framebuffer3 = true
scale_type3 = source
shader4 = kawase/kawase2.slang
filter_linear4 = true
srgb_framebuffer4 = true
scale_type4 = source
shader5 = kawase/kawase3.slang
filter_linear5 = true
srgb_framebuffer5 = true
scale_type5 = source
shader6 = kawase/delinearize.slang
filter_linear6 = true

View file

@ -0,0 +1,53 @@
shaders = 11
shader0 = kawase/linearize.slang
srgb_framebuffer0 = true
scale_type0 = source
shader1 = kawase/kawase0.slang
filter_linear1 = true
srgb_framebuffer1 = true
scale_type1 = source
shader2 = kawase/kawase1.slang
filter_linear2 = true
srgb_framebuffer2 = true
scale_type2 = source
shader3 = kawase/kawase2.slang
filter_linear3 = true
srgb_framebuffer3 = true
scale_type3 = source
shader4 = kawase/kawase3.slang
filter_linear4 = true
srgb_framebuffer4 = true
scale_type4 = source
shader5 = kawase/kawase4.slang
filter_linear5 = true
srgb_framebuffer5 = true
scale_type5 = source
shader6 = kawase/kawase4.slang
filter_linear6 = true
srgb_framebuffer6 = true
scale_type6 = source
shader7 = kawase/kawase5.slang
filter_linear7 = true
srgb_framebuffer7 = true
scale_type7 = source
shader8 = kawase/kawase6.slang
filter_linear8 = true
srgb_framebuffer8 = true
scale_type8 = source
shader9 = kawase/kawase7.slang
filter_linear9 = true
srgb_framebuffer9 = true
scale_type9 = source
shader10 = kawase/delinearize.slang
filter_linear10 = true

35
blurs/kawase_glow.slangp Normal file
View file

@ -0,0 +1,35 @@
shaders = 8
shader0 = kawase/linearize.slang
srgb_framebuffer0 = true
scale_type0 = source
shader1 = kawase/kawase0.slang
filter_linear1 = true
srgb_framebuffer1 = true
scale_type1 = source
shader2 = kawase/kawase1.slang
filter_linear2 = true
srgb_framebuffer2 = true
scale_type2 = source
shader3 = kawase/kawase1.slang
filter_linear3 = true
srgb_framebuffer3 = true
scale_type3 = source
shader4 = kawase/kawase2.slang
filter_linear4 = true
srgb_framebuffer4 = true
scale_type4 = source
shader5 = kawase/kawase3.slang
filter_linear5 = true
srgb_framebuffer5 = true
scale_type5 = source
shader7 = kawase/screen_combine.slang
shader6 = kawase/delinearize.slang
filter_linear6 = true

View file

@ -1,17 +0,0 @@
shaders = 4
shader0 = ../crt/shaders/crt-aperture.slang
scale_type0 = source
scale0 = 4.0
filter_linear0 = false
alias0 = Reference
shader1 = ../blurs/blur11resize-vertical.slang
scale_type1 = source
scale1 = 0.5
shader2 = ../blurs/blur11resize-horizontal.slang
scale_type2 = source
scale2 = 0.5
shader3 = shaders/bigblur.slang

View file

@ -1,14 +1,39 @@
shaders = 4 shaders = 9
shader0 = ../misc/image-adjustment.slang shader0 = ../stock.slang
alias0 = Reference alias0 = Reference
shader1 = ../blurs/blur9fast-vertical.slang shader1 = ../blurs/kawase/linearize.slang
srgb_framebuffer1 = true
scale_type1 = source scale_type1 = source
scale1 = 1.0
shader2 = ../blurs/blur9fast-horizontal.slang shader2 = ../blurs/kawase/kawase0.slang
filter_linear2 = true
srgb_framebuffer2 = true
scale_type2 = source scale_type2 = source
scale2 = 1.0
shader3 = shaders/bigblur.slang shader3 = ../blurs/kawase/kawase1.slang
filter_linear3 = true
srgb_framebuffer3 = true
scale_type3 = source
shader4 = ../blurs/kawase/kawase1.slang
filter_linear4 = true
srgb_framebuffer4 = true
scale_type4 = source
shader5 = ../blurs/kawase/kawase2.slang
filter_linear5 = true
srgb_framebuffer5 = true
scale_type5 = source
shader6 = ../blurs/kawase/kawase3.slang
filter_linear6 = true
srgb_framebuffer6 = true
scale_type6 = source
shader7 = ../blurs/kawase/delinearize.slang
filter_linear7 = true
shader8 = shaders/bigblur.slang
filter_linear8 = true

View file

@ -63,7 +63,7 @@ void main()
vec2 middle = vec2(0.49999, 0.49999); vec2 middle = vec2(0.49999, 0.49999);
vec2 diff = TexCoord.xy - middle; vec2 diff = TexCoord.xy - middle;
vTexCoord = middle + diff * scale; vTexCoord = middle + diff * scale;
vec2 zoom_coord = (((vTexCoord.xy - middle) / params.border_zoom) * vec2(params.OutputSize.x / params.OutputSize.y, 1.0) vec2 zoom_coord = (((TexCoord.xy - middle) / params.border_zoom) * vec2(params.OutputSize.x / params.OutputSize.y, 1.0)
/ vec2(params.aspect_x / params.aspect_y, 1.0)) + middle; / vec2(params.aspect_x / params.aspect_y, 1.0)) + middle;
tex_border = zoom_coord; tex_border = zoom_coord;
} }