Reduce blur fill shimmering with lowpass filter

This commit is contained in:
Isaac 2023-06-23 00:09:07 +02:00
parent a20a608b85
commit 13f4d9184e
7 changed files with 136 additions and 114 deletions

View file

@ -1,82 +1,89 @@
shaders = 10 shaders = 12
parameters = "BLUR_RADIUS" parameters = "SIGMA;BLUR_RADIUS"
SIGMA = 1.0
BLUR_RADIUS = 2.0 BLUR_RADIUS = 2.0
shader0 = ../blurs/shaders/kawase/linearize.slang shader0 = ../blurs/shaders/kawase/linearize.slang
scale_type0 = source scale_type0 = source
scale_x0 = 1.0 scale0 = 1.0
scale_y0 = 1.0
float_framebuffer0 = true float_framebuffer0 = true
alias0 = "Input" alias0 = "Input"
shader1 = shaders/blur_fill/render_sampling_areas.slang shader1 = ../blurs/shaders/gauss_4tap/gauss_2tap_h.slang
scale_type1 = viewport filter_linear1 = true
scale_x1 = 0.2 scale_type1 = source
scale_y1 = 0.2 scale1 = 1.0
float_framebuffer1 = true float_framebuffer1 = true
alias1 = "Tiled" wrap_mode1 = mirrored_repeat
shader2 = ../blurs/shaders/dual_filter/downsample.slang shader2 = ../blurs/shaders/gauss_4tap/gauss_2tap_v.slang
filter_linear2 = true filter_linear2 = true
scale_type2 = source scale_type2 = source
scale_x2 = 0.5 scale2 = 1.0
scale_y2 = 0.5
float_framebuffer2 = true float_framebuffer2 = true
wrap_mode2 = mirrored_repeat wrap_mode2 = mirrored_repeat
shader3 = ../blurs/shaders/dual_filter/downsample.slang shader3 = shaders/blur_fill/render_sampling_areas.slang
filter_linear3 = true filter_linear3 = true
scale_type3 = source scale_type3 = source
scale_x3 = 0.5 scale_x3 = 2.0
scale_y3 = 0.5 scale_y3 = 2.0
float_framebuffer3 = true float_framebuffer3 = true
wrap_mode3 = mirrored_repeat alias3 = "Tiled"
shader4 = ../blurs/shaders/dual_filter/downsample.slang shader4 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear4 = true filter_linear4 = true
scale_type4 = source scale_type4 = source
scale_x4 = 0.5 scale4 = 0.5
scale_y4 = 0.5
float_framebuffer4 = true float_framebuffer4 = true
wrap_mode4 = mirrored_repeat wrap_mode4 = mirrored_repeat
shader5 = ../blurs/shaders/dual_filter/upsample.slang shader5 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear5 = true filter_linear5 = true
scale_type5 = source scale_type5 = source
scale_x5 = 2.0 scale5 = 0.5
scale_y5 = 2.0
float_framebuffer5 = true float_framebuffer5 = true
wrap_mode5 = mirrored_repeat wrap_mode5 = mirrored_repeat
shader6 = ../blurs/shaders/dual_filter/upsample.slang shader6 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear6 = true filter_linear6 = true
scale_type6 = source scale_type6 = source
scale_x6 = 2.0 scale6 = 0.5
scale_y6 = 2.0
float_framebuffer6 = true float_framebuffer6 = true
wrap_mode6 = mirrored_repeat wrap_mode6 = mirrored_repeat
shader7 = ../blurs/shaders/dual_filter/upsample.slang shader7 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear7 = true filter_linear7 = true
scale_type7 = source scale_type7 = source
scale_x7 = 2.0 scale7 = 2.0
scale_y7 = 2.0
float_framebuffer7 = true float_framebuffer7 = true
wrap_mode7 = mirrored_repeat wrap_mode7 = mirrored_repeat
alias7 = "Blurred"
shader8 = shaders/blur_fill/compose.slang shader8 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear8 = true filter_linear8 = true
scale_type8 = viewport scale_type8 = source
scale_x8 = 1.0 scale8 = 2.0
scale_y8 = 1.0
float_framebuffer8 = true float_framebuffer8 = true
mipmap_input8 = true wrap_mode8 = mirrored_repeat
shader9 = ../blurs/shaders/kawase/delinearize.slang shader9 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear9 = true filter_linear9 = true
scale_type9 = viewport scale_type9 = source
scale_x9 = 1.0 scale9 = 2.0
scale_y9 = 1.0
float_framebuffer9 = true float_framebuffer9 = true
wrap_mode9 = mirrored_repeat
alias9 = "Blurred"
shader10 = shaders/blur_fill/compose.slang
filter_linear10 = true
scale_type10 = viewport
scale10 = 1.0
float_framebuffer10 = true
mipmap_input10 = true
shader11 = ../blurs/shaders/kawase/delinearize.slang
filter_linear11 = true
scale_type11 = viewport
scale11 = 1.0
float_framebuffer11 = true

View file

@ -1,82 +1,89 @@
shaders = 10 shaders = 12
parameters = "BLUR_RADIUS" parameters = "SIGMA;BLUR_RADIUS"
BLUR_RADIUS = 4.0 SIGMA = 2.0
BLUR_RADIUS = 3.0
shader0 = ../blurs/shaders/kawase/linearize.slang shader0 = ../blurs/shaders/kawase/linearize.slang
scale_type0 = source scale_type0 = source
scale_x0 = 1.0 scale0 = 1.0
scale_y0 = 1.0
float_framebuffer0 = true float_framebuffer0 = true
alias0 = "Input" alias0 = "Input"
shader1 = shaders/blur_fill/render_sampling_areas.slang shader1 = ../blurs/shaders/gauss_4tap/gauss_2tap_h.slang
scale_type1 = viewport filter_linear1 = true
scale_x1 = 0.1 scale_type1 = source
scale_y1 = 0.1 scale1 = 1.0
float_framebuffer1 = true float_framebuffer1 = true
alias1 = "Tiled" wrap_mode1 = mirrored_repeat
shader2 = ../blurs/shaders/dual_filter/downsample.slang shader2 = ../blurs/shaders/gauss_4tap/gauss_2tap_v.slang
filter_linear2 = true filter_linear2 = true
scale_type2 = source scale_type2 = source
scale_x2 = 0.5 scale2 = 1.0
scale_y2 = 0.5
float_framebuffer2 = true float_framebuffer2 = true
wrap_mode2 = mirrored_repeat wrap_mode2 = mirrored_repeat
shader3 = ../blurs/shaders/dual_filter/downsample.slang shader3 = shaders/blur_fill/render_sampling_areas.slang
filter_linear3 = true filter_linear3 = true
scale_type3 = source scale_type3 = source
scale_x3 = 0.5 scale_x3 = 1.0
scale_y3 = 0.5 scale_y3 = 1.0
float_framebuffer3 = true float_framebuffer3 = true
wrap_mode3 = mirrored_repeat alias3 = "Tiled"
shader4 = ../blurs/shaders/dual_filter/downsample.slang shader4 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear4 = true filter_linear4 = true
scale_type4 = source scale_type4 = source
scale_x4 = 0.5 scale4 = 0.5
scale_y4 = 0.5
float_framebuffer4 = true float_framebuffer4 = true
wrap_mode4 = mirrored_repeat wrap_mode4 = mirrored_repeat
shader5 = ../blurs/shaders/dual_filter/upsample.slang shader5 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear5 = true filter_linear5 = true
scale_type5 = source scale_type5 = source
scale_x5 = 2.0 scale5 = 0.5
scale_y5 = 2.0
float_framebuffer5 = true float_framebuffer5 = true
wrap_mode5 = mirrored_repeat wrap_mode5 = mirrored_repeat
shader6 = ../blurs/shaders/dual_filter/upsample.slang shader6 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear6 = true filter_linear6 = true
scale_type6 = source scale_type6 = source
scale_x6 = 2.0 scale6 = 0.5
scale_y6 = 2.0
float_framebuffer6 = true float_framebuffer6 = true
wrap_mode6 = mirrored_repeat wrap_mode6 = mirrored_repeat
shader7 = ../blurs/shaders/dual_filter/upsample.slang shader7 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear7 = true filter_linear7 = true
scale_type7 = source scale_type7 = source
scale_x7 = 2.0 scale7 = 2.0
scale_y7 = 2.0
float_framebuffer7 = true float_framebuffer7 = true
wrap_mode7 = mirrored_repeat wrap_mode7 = mirrored_repeat
alias7 = "Blurred"
shader8 = shaders/blur_fill/compose.slang shader8 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear8 = true filter_linear8 = true
scale_type8 = viewport scale_type8 = source
scale_x8 = 1.0 scale8 = 2.0
scale_y8 = 1.0
float_framebuffer8 = true float_framebuffer8 = true
mipmap_input8 = true wrap_mode8 = mirrored_repeat
shader9 = ../blurs/shaders/kawase/delinearize.slang shader9 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear9 = true filter_linear9 = true
scale_type9 = viewport scale_type9 = source
scale_x9 = 1.0 scale9 = 2.0
scale_y9 = 1.0
float_framebuffer9 = true float_framebuffer9 = true
wrap_mode9 = mirrored_repeat
alias9 = "Blurred"
shader10 = shaders/blur_fill/compose.slang
filter_linear10 = true
scale_type10 = viewport
scale10 = 1.0
float_framebuffer10 = true
mipmap_input10 = true
shader11 = ../blurs/shaders/kawase/delinearize.slang
filter_linear11 = true
scale_type11 = viewport
scale11 = 1.0
float_framebuffer11 = true

View file

@ -1,82 +1,89 @@
shaders = 10 shaders = 12
parameters = "BLUR_RADIUS" parameters = "SIGMA;BLUR_RADIUS"
SIGMA = 1.0
BLUR_RADIUS = 1.0 BLUR_RADIUS = 1.0
shader0 = ../blurs/shaders/kawase/linearize.slang shader0 = ../blurs/shaders/kawase/linearize.slang
scale_type0 = source scale_type0 = source
scale_x0 = 1.0 scale0 = 1.0
scale_y0 = 1.0
float_framebuffer0 = true float_framebuffer0 = true
alias0 = "Input" alias0 = "Input"
shader1 = shaders/blur_fill/render_sampling_areas.slang shader1 = ../blurs/shaders/gauss_4tap/gauss_2tap_h.slang
scale_type1 = viewport filter_linear1 = true
scale_x1 = 0.4 scale_type1 = source
scale_y1 = 0.4 scale1 = 1.0
float_framebuffer1 = true float_framebuffer1 = true
alias1 = "Tiled" wrap_mode1 = mirrored_repeat
shader2 = ../blurs/shaders/dual_filter/downsample.slang shader2 = ../blurs/shaders/gauss_4tap/gauss_2tap_v.slang
filter_linear2 = true filter_linear2 = true
scale_type2 = source scale_type2 = source
scale_x2 = 0.5 scale2 = 1.0
scale_y2 = 0.5
float_framebuffer2 = true float_framebuffer2 = true
wrap_mode2 = mirrored_repeat wrap_mode2 = mirrored_repeat
shader3 = ../blurs/shaders/dual_filter/downsample.slang shader3 = shaders/blur_fill/render_sampling_areas.slang
filter_linear3 = true filter_linear3 = true
scale_type3 = source scale_type3 = source
scale_x3 = 0.5 scale_x3 = 3.0
scale_y3 = 0.5 scale_y3 = 3.0
float_framebuffer3 = true float_framebuffer3 = true
wrap_mode3 = mirrored_repeat alias3 = "Tiled"
shader4 = ../blurs/shaders/dual_filter/downsample.slang shader4 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear4 = true filter_linear4 = true
scale_type4 = source scale_type4 = source
scale_x4 = 0.5 scale4 = 0.5
scale_y4 = 0.5
float_framebuffer4 = true float_framebuffer4 = true
wrap_mode4 = mirrored_repeat wrap_mode4 = mirrored_repeat
shader5 = ../blurs/shaders/dual_filter/upsample.slang shader5 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear5 = true filter_linear5 = true
scale_type5 = source scale_type5 = source
scale_x5 = 2.0 scale5 = 0.5
scale_y5 = 2.0
float_framebuffer5 = true float_framebuffer5 = true
wrap_mode5 = mirrored_repeat wrap_mode5 = mirrored_repeat
shader6 = ../blurs/shaders/dual_filter/upsample.slang shader6 = ../blurs/shaders/dual_filter/downsample.slang
filter_linear6 = true filter_linear6 = true
scale_type6 = source scale_type6 = source
scale_x6 = 2.0 scale6 = 0.5
scale_y6 = 2.0
float_framebuffer6 = true float_framebuffer6 = true
wrap_mode6 = mirrored_repeat wrap_mode6 = mirrored_repeat
shader7 = ../blurs/shaders/dual_filter/upsample.slang shader7 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear7 = true filter_linear7 = true
scale_type7 = source scale_type7 = source
scale_x7 = 2.0 scale7 = 2.0
scale_y7 = 2.0
float_framebuffer7 = true float_framebuffer7 = true
wrap_mode7 = mirrored_repeat wrap_mode7 = mirrored_repeat
alias7 = "Blurred"
shader8 = shaders/blur_fill/compose.slang shader8 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear8 = true filter_linear8 = true
scale_type8 = viewport scale_type8 = source
scale_x8 = 1.0 scale8 = 2.0
scale_y8 = 1.0
float_framebuffer8 = true float_framebuffer8 = true
mipmap_input8 = true wrap_mode8 = mirrored_repeat
shader9 = ../blurs/shaders/kawase/delinearize.slang shader9 = ../blurs/shaders/dual_filter/upsample.slang
filter_linear9 = true filter_linear9 = true
scale_type9 = viewport scale_type9 = source
scale_x9 = 1.0 scale9 = 2.0
scale_y9 = 1.0
float_framebuffer9 = true float_framebuffer9 = true
wrap_mode9 = mirrored_repeat
alias9 = "Blurred"
shader10 = shaders/blur_fill/compose.slang
filter_linear10 = true
scale_type10 = viewport
scale10 = 1.0
float_framebuffer10 = true
mipmap_input10 = true
shader11 = ../blurs/shaders/kawase/delinearize.slang
filter_linear11 = true
scale_type11 = viewport
scale11 = 1.0
float_framebuffer11 = true

View file

@ -1,7 +1,7 @@
#version 450 #version 450
/* /*
Average fill v1.0 by fishku Average fill v1.2 by fishku
Copyright (C) 2023 Copyright (C) 2023
Public domain license (CC0) Public domain license (CC0)

View file

@ -1,7 +1,7 @@
#version 450 #version 450
/* /*
Blur fill v1.0 by fishku Blur fill v1.3 by fishku
Copyright (C) 2023 Copyright (C) 2023
Public domain license (CC0) Public domain license (CC0)
@ -27,6 +27,7 @@
strength of the blur. strength of the blur.
Changelog: Changelog:
v1.3: Reduce shimmering artifacts.
v1.2: Fix scaling bugs. v1.2: Fix scaling bugs.
v1.1: Fix bug with glcore driver. v1.1: Fix bug with glcore driver.
v1.0: Initial release. v1.0: Initial release.

View file

@ -1,7 +1,7 @@
// See compose.slang for copyright and other information. // See compose.slang for copyright and other information.
// clang-format off // clang-format off
#pragma parameter BLUR_FILL_SETTINGS "=== Blur fill v1.2 settings ===" 0.0 0.0 1.0 1.0 #pragma parameter BLUR_FILL_SETTINGS "=== Blur fill v1.3 settings ===" 0.0 0.0 1.0 1.0
#pragma parameter OS_CROP_TOP "Overscan crop top" 0.0 0.0 1024.0 1.0 #pragma parameter OS_CROP_TOP "Overscan crop top" 0.0 0.0 1024.0 1.0
#pragma parameter OS_CROP_BOTTOM "Overscan crop bottom" 0.0 0.0 1024.0 1.0 #pragma parameter OS_CROP_BOTTOM "Overscan crop bottom" 0.0 0.0 1024.0 1.0
#pragma parameter OS_CROP_LEFT "Overscan crop left" 0.0 0.0 1024.0 1.0 #pragma parameter OS_CROP_LEFT "Overscan crop left" 0.0 0.0 1024.0 1.0

View file

@ -41,7 +41,7 @@ void main() {
#pragma stage fragment #pragma stage fragment
layout(location = 0) in vec2 vTexCoord; layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor; layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Input; layout(set = 0, binding = 2) uniform sampler2D Source;
float min_of_vec4(vec4 i) { return min(min(i.x, i.y), min(i.z, i.w)); } float min_of_vec4(vec4 i) { return min(min(i.x, i.y), min(i.z, i.w)); }
@ -218,7 +218,7 @@ vec3 sample_mirrored_frame(sampler2D tex, vec2 coord, vec4 input_extrema) {
void main() { void main() {
const vec2 pixel_coord = o2i(vTexCoord); const vec2 pixel_coord = o2i(vTexCoord);
FragColor = vec4( FragColor = vec4(
sample_mirrored_frame(Input, pixel_coord, sample_mirrored_frame(Source, pixel_coord,
vec4(param.OS_CROP_LEFT, param.OS_CROP_TOP, vec4(param.OS_CROP_LEFT, param.OS_CROP_TOP,
param.InputSize.x - param.OS_CROP_RIGHT, param.InputSize.x - param.OS_CROP_RIGHT,
param.InputSize.y - param.OS_CROP_BOTTOM)), param.InputSize.y - param.OS_CROP_BOTTOM)),