From d96eccaf2f2bdc2331a41219f721bc98cc10380f Mon Sep 17 00:00:00 2001 From: hunterk Date: Sat, 18 Aug 2018 13:52:21 -0500 Subject: [PATCH] add wrap mode to kawase presets to fix dark border from sampling outside of image --- blurs/kawase/screen_combine.slang | 6 +++--- blurs/kawase_blur_5pass.slangp | 7 ++++++- blurs/kawase_blur_9pass.slangp | 11 ++++++++++- blurs/kawase_glow.slangp | 31 ++++++++++++++++++++----------- border/bigblur.slangp | 7 ++++++- 5 files changed, 45 insertions(+), 17 deletions(-) diff --git a/blurs/kawase/screen_combine.slang b/blurs/kawase/screen_combine.slang index f9b29de..a8602c7 100644 --- a/blurs/kawase/screen_combine.slang +++ b/blurs/kawase/screen_combine.slang @@ -28,10 +28,10 @@ void main() 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; +layout(set = 0, binding = 3) uniform sampler2D Reference; void main() { - FragColor = 1.0 - (1.0 - texture(Source, vTexCoord)) * (1.0 - texture(Original, vTexCoord)); + FragColor = 1.0 - (1.0 - texture(Source, vTexCoord)) * (1.0 - texture(Reference, vTexCoord)); FragColor = pow(FragColor, vec4(2.2)); -} \ No newline at end of file +} diff --git a/blurs/kawase_blur_5pass.slangp b/blurs/kawase_blur_5pass.slangp index 645d791..b4a6b44 100644 --- a/blurs/kawase_blur_5pass.slangp +++ b/blurs/kawase_blur_5pass.slangp @@ -8,26 +8,31 @@ shader1 = kawase/kawase0.slang filter_linear1 = true srgb_framebuffer1 = true scale_type1 = source +wrap_mode1 = mirrored_repeat shader2 = kawase/kawase1.slang filter_linear2 = true srgb_framebuffer2 = true scale_type2 = source +wrap_mode2 = mirrored_repeat shader3 = kawase/kawase1.slang filter_linear3 = true srgb_framebuffer3 = true scale_type3 = source +wrap_mode3 = mirrored_repeat shader4 = kawase/kawase2.slang filter_linear4 = true srgb_framebuffer4 = true scale_type4 = source +wrap_mode4 = mirrored_repeat shader5 = kawase/kawase3.slang filter_linear5 = true srgb_framebuffer5 = true scale_type5 = source +wrap_mode5 = mirrored_repeat shader6 = kawase/delinearize.slang -filter_linear6 = true \ No newline at end of file +filter_linear6 = true diff --git a/blurs/kawase_blur_9pass.slangp b/blurs/kawase_blur_9pass.slangp index ebb3b01..477f51b 100644 --- a/blurs/kawase_blur_9pass.slangp +++ b/blurs/kawase_blur_9pass.slangp @@ -8,46 +8,55 @@ shader1 = kawase/kawase0.slang filter_linear1 = true srgb_framebuffer1 = true scale_type1 = source +wrap_mode1 = mirrored_repeat shader2 = kawase/kawase1.slang filter_linear2 = true srgb_framebuffer2 = true scale_type2 = source +wrap_mode2 = mirrored_repeat shader3 = kawase/kawase2.slang filter_linear3 = true srgb_framebuffer3 = true scale_type3 = source +wrap_mode3 = mirrored_repeat shader4 = kawase/kawase3.slang filter_linear4 = true srgb_framebuffer4 = true scale_type4 = source +wrap_mode4 = mirrored_repeat shader5 = kawase/kawase4.slang filter_linear5 = true srgb_framebuffer5 = true scale_type5 = source +wrap_mode5 = mirrored_repeat shader6 = kawase/kawase4.slang filter_linear6 = true srgb_framebuffer6 = true scale_type6 = source +wrap_mode6 = mirrored_repeat shader7 = kawase/kawase5.slang filter_linear7 = true srgb_framebuffer7 = true scale_type7 = source +wrap_mode7 = mirrored_repeat shader8 = kawase/kawase6.slang filter_linear8 = true srgb_framebuffer8 = true scale_type8 = source +wrap_mode8 = mirrored_repeat shader9 = kawase/kawase7.slang filter_linear9 = true srgb_framebuffer9 = true scale_type9 = source +wrap_mode9 = mirrored_repeat shader10 = kawase/delinearize.slang -filter_linear10 = true \ No newline at end of file +filter_linear10 = true diff --git a/blurs/kawase_glow.slangp b/blurs/kawase_glow.slangp index cad7d7f..4c042d5 100644 --- a/blurs/kawase_glow.slangp +++ b/blurs/kawase_glow.slangp @@ -1,35 +1,44 @@ -shaders = 8 +shaders = 9 -shader0 = kawase/linearize.slang -srgb_framebuffer0 = true +shader0 = ../stock.slang scale_type0 = source +alias0 = Reference -shader1 = kawase/kawase0.slang -filter_linear1 = true +shader1 = kawase/linearize.slang srgb_framebuffer1 = true scale_type1 = source -shader2 = kawase/kawase1.slang +shader2 = kawase/kawase0.slang filter_linear2 = true srgb_framebuffer2 = true scale_type2 = source +wrap_mode2 = mirrored_repeat shader3 = kawase/kawase1.slang filter_linear3 = true srgb_framebuffer3 = true scale_type3 = source +wrap_mode3 = mirrored_repeat -shader4 = kawase/kawase2.slang +shader4 = kawase/kawase1.slang filter_linear4 = true srgb_framebuffer4 = true scale_type4 = source +wrap_mode4 = mirrored_repeat -shader5 = kawase/kawase3.slang +shader5 = kawase/kawase2.slang filter_linear5 = true srgb_framebuffer5 = true scale_type5 = source +wrap_mode5 = mirrored_repeat -shader7 = kawase/screen_combine.slang +shader6 = kawase/kawase3.slang +filter_linear6 = true +srgb_framebuffer6 = true +scale_type6 = source +wrap_mode6 = mirrored_repeat -shader6 = kawase/delinearize.slang -filter_linear6 = true \ No newline at end of file +shader7 = kawase/delinearize.slang +filter_linear7 = true + +shader8 = kawase/screen_combine.slang diff --git a/border/bigblur.slangp b/border/bigblur.slangp index 336b16b..6073934 100644 --- a/border/bigblur.slangp +++ b/border/bigblur.slangp @@ -11,29 +11,34 @@ shader2 = ../blurs/kawase/kawase0.slang filter_linear2 = true srgb_framebuffer2 = true scale_type2 = source +wrap_mode2 = mirrored_repeat shader3 = ../blurs/kawase/kawase1.slang filter_linear3 = true srgb_framebuffer3 = true scale_type3 = source +wrap_mode3 = mirrored_repeat shader4 = ../blurs/kawase/kawase1.slang filter_linear4 = true srgb_framebuffer4 = true scale_type4 = source +wrap_mode4 = mirrored_repeat shader5 = ../blurs/kawase/kawase2.slang filter_linear5 = true srgb_framebuffer5 = true scale_type5 = source +wrap_mode5 = mirrored_repeat shader6 = ../blurs/kawase/kawase3.slang filter_linear6 = true srgb_framebuffer6 = true scale_type6 = source +wrap_mode6 = mirrored_repeat shader7 = ../blurs/kawase/delinearize.slang filter_linear7 = true shader8 = shaders/bigblur.slang -filter_linear8 = true \ No newline at end of file +filter_linear8 = true