diff --git a/xbr/README.md b/xbr/README.md index 264ce50..ae0a09d 100644 --- a/xbr/README.md +++ b/xbr/README.md @@ -2,21 +2,6 @@ xBR Shaders ======= These shaders uses the xBR algorithm to scale. xBR (scale by rules) works by detecting edges and interpolating pixels along them. It has some empyrical rules developed to detect the edges in many directions. There are many versions implemented and they differs basically by the number of directions considered and the way interpolations are done. -xbr-lvl1-noblend.cg --------------- - -The most basic xBR shader. Level 1 means it only detects two edge directions (45º and 135º). The interpolation doesn't blend pixel colors. It uses the most similar color from one of its neighbors. So, the final result uses the original color palette. And because of that, it only works properly at odd scale factors (3x, 5x, 7x...). - -Recommended sampling: `Point` -Recommended scale factors: `multiple odd scale factors` - -xbr-lvl2-noblend.cg --------------- - -An evolution from last shader. Level 2 means it can detect four edge directions, which shows as better rounded objects on screen. The interpolation doesn't blend pixel colors. It uses the most similar color from one of its neighbors. So, the final result uses the original color palette. And because of that, it only works properly at odd scale factors (3x, 5x, 7x...). - -Recommended sampling: `Point` -Recommended scale factors: `multiple odd scale factors` xbr-lvl2.cg -------------- @@ -26,62 +11,32 @@ It can detect four edge directions, which shows as better rounded objects on scr Recommended sampling: `Point` Recommended scale factors: `Integer multiples` -xbr-lvl2-multipass.cg +xbr-lvl2-sharp.cg -------------- -It's the same as the last one. But this one divides the calculations among multiple shaders. So, this one is faster than the single versions. +It can detect four edge directions, which shows as better rounded objects on screen. The interpolation blends pixel colors, so that the final image is smooth. This is a sharper version than the standard. It works well in any integer scale factor. Recommended sampling: `Point` Recommended scale factors: `Integer multiples` -xbr-lvl2-fast.cg --------------- - -This is a simplified lvl2 implementation. Much faster than the standard version, though it sacrifices some quality. - -Recommended sampling: `Point` -Recommended scale factors: `Integer multiples` - -xbr-lvl3-noblend.cg --------------- - -Level 3 means it can detect six edge directions, which shows as better rounded objects on screen. The interpolation doesn't blend pixel colors. It uses the most similar color from one of its neighbors. So, the final result uses the original color palette. And because of that, it only works properly at odd scale factors (3x, 5x, 7x...). - -Recommended sampling: `Point` -Recommended scale factors: `multiple odd scale factors` xbr-lvl3.cg -------------- -It can detect six edge directions, which shows as even better rounded objects on screen than the lvl2. The interpolation blends pixel colors, so that the final image is smoother than the noblend versions. It works well in any integer scale factor. +It can detect six edge directions, which shows as even better rounded objects on screen than the lvl2. The interpolation blends pixel colors, so that the final image is smooth. It works well in any integer scale factor. Recommended sampling: `Point` Recommended scale factors: `Integer multiples` -xbr-lvl3-multipass.cg +xbr-lvl3-sharp.cg -------------- -It's the same as the last one. But this one divides the calculations among multiple shaders. So, this one is faster than the single versions. +It can detect six edge directions, which shows as even better rounded objects on screen than the lvl2. The interpolation blends pixel colors, so that the final image is smooth. This is a sharper version than the standard. It works well in any integer scale factor. Recommended sampling: `Point` Recommended scale factors: `Integer multiples` -xbr-mlv4-multipass.cg --------------- - -This shader is the latest evolution of the standard xBR algorithm. It can can detect eight edge directions, which shows as better rounded objects on screen. Besides, it has a non-greedy selection of edges internally, which means it doesn't automatically chooses to interpolate along the steeper edge. The interpolation blends pixel colors, so that the final image is smoother than the noblend versions. It works well in any integer scale factor. - -Recommended sampling: `Point` -Recommended scale factors: `Integer multiples` - -xbr-hybrid.cg --------------- - -This shader combines xBR with reverse-aa. It's recommended for games with smooth color gradients. - -Recommended sampling: `Point` - -super-xbr-2p.cg +super-xbr.cg -------------- Super-xBR uses parts of the xBR algorithm and combines with other linear interpolation ones. It is intended for games with smooth color gradients. Compared to the hybrid ones, Super-xBR provides a much better image, without discontinuities. @@ -89,10 +44,15 @@ Super-xBR uses parts of the xBR algorithm and combines with other linear interpo Recommended sampling: `Point` Recommended scale factors: `Integer multiples` -super-xbr-3p-smoother.cg +super-xbr-fast.cg -------------- -The same as the last one with an additional step to increase smoothness. This one provides even better image quality, though a bit slower. +It's a faster version of Super-xBR. Recommended sampling: `Point` Recommended scale factors: `Integer multiples` + +Other Presets folder +-------------- + +This folder contains other presets for historical purposes. diff --git a/xbr/2xBR-lv1-multipass.slangp b/xbr/other presets/2xBR-lv1-multipass.slangp similarity index 100% rename from xbr/2xBR-lv1-multipass.slangp rename to xbr/other presets/2xBR-lv1-multipass.slangp diff --git a/xbr/4xbr-hybrid-crt.slangp b/xbr/other presets/4xbr-hybrid-crt.slangp similarity index 100% rename from xbr/4xbr-hybrid-crt.slangp rename to xbr/other presets/4xbr-hybrid-crt.slangp diff --git a/xbr/shaders/2xBR-multipass/2xbr-lv1-c-pass0.slang b/xbr/other presets/shaders/2xBR-multipass/2xbr-lv1-c-pass0.slang similarity index 100% rename from xbr/shaders/2xBR-multipass/2xbr-lv1-c-pass0.slang rename to xbr/other presets/shaders/2xBR-multipass/2xbr-lv1-c-pass0.slang diff --git a/xbr/shaders/2xBR-multipass/2xbr-lv1-c-pass1.slang b/xbr/other presets/shaders/2xBR-multipass/2xbr-lv1-c-pass1.slang similarity index 100% rename from xbr/shaders/2xBR-multipass/2xbr-lv1-c-pass1.slang rename to xbr/other presets/shaders/2xBR-multipass/2xbr-lv1-c-pass1.slang diff --git a/xbr/shaders/4xbr-hybrid-crt.slang b/xbr/other presets/shaders/4xbr-hybrid-crt.slang similarity index 100% rename from xbr/shaders/4xbr-hybrid-crt.slang rename to xbr/other presets/shaders/4xbr-hybrid-crt.slang diff --git a/xbr/other presets/shaders/super-xbr/custom-jinc2-sharper.slang b/xbr/other presets/shaders/super-xbr/custom-jinc2-sharper.slang new file mode 100644 index 0000000..4a2d06b --- /dev/null +++ b/xbr/other presets/shaders/super-xbr/custom-jinc2-sharper.slang @@ -0,0 +1,185 @@ +#version 450 + +/* + Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader + + Copyright (C) 2011-2014 Hyllian/Jararaca - sergiogdb@gmail.com + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float JINC2_WINDOW_SINC; + float JINC2_SINC; + float JINC2_AR_STRENGTH; +} params; + +#pragma parameter JINC2_WINDOW_SINC "Window Sinc Param" 0.50 0.0 1.0 0.01 +#pragma parameter JINC2_SINC "Sinc Param" 0.88 0.0 1.0 0.01 +#pragma parameter JINC2_AR_STRENGTH "Anti-ringing Strength" 0.0 0.0 1.0 0.1 + +#define mul(a,b) (b*a) + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + + /* + This is an approximation of Jinc(x)*Jinc(x*r1/r2) for x < 2.5, + where r1 and r2 are the first two zeros of jinc function. + For a jinc 2-lobe best approximation, use A=0.5 and B=0.825. + */ + +// A=0.5, B=0.825 is the best jinc approximation for x<2.5. if B=1.0, it's a lanczos filter. +// Increase A to get more blur. Decrease it to get a sharper picture. +// B = 0.825 to get rid of dithering. Increase B to get a fine sharpness, though dithering returns. + +#define halfpi 1.5707963267948966192313216916398 +#define pi 3.1415926535897932384626433832795 +#define wa (params.JINC2_WINDOW_SINC*pi) +#define wb (params.JINC2_SINC*pi) + +const vec3 Y = vec3(0.299, 0.587, 0.114); + +float df(float A, float B) +{ + return abs(A-B); +} + +// Calculates the distance between two points +float d(vec2 pt1, vec2 pt2) +{ + vec2 v = pt2 - pt1; + return sqrt(dot(v,v)); +} + +vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return min(a, min(b, min(c, d))); +} +vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return max(a, max(b, max(c, d))); +} + +vec4 resampler(vec4 x) +{ + vec4 res; + + res.x = (x.x==0.0) ? (wa*wb) : sin(x.x*wa)*sin(x.x*wb)/(x.x*x.x); + res.y = (x.y==0.0) ? (wa*wb) : sin(x.y*wa)*sin(x.y*wb)/(x.y*x.y); + res.z = (x.z==0.0) ? (wa*wb) : sin(x.z*wa)*sin(x.z*wb)/(x.z*x.z); + res.w = (x.w==0.0) ? (wa*wb) : sin(x.w*wa)*sin(x.w*wb)/(x.w*x.w); + + return res; +} + +#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 * 1.0001; +} + +#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() +{ + vec3 color; + mat4x4 weights; + + vec2 dx = vec2(1.0, 0.0); + vec2 dy = vec2(0.0, 1.0); + + vec2 pc = vTexCoord * params.SourceSize.xy; + + vec2 tc = (floor(pc-vec2(0.5,0.5))+vec2(0.5,0.5)); + + weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy))); + weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx ))); + weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy))); + weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy))); + + //weights[0][0] = weights[0][3] = weights[3][0] = weights[3][3] = 0.0; + + dx = dx / params.SourceSize.xy; + dy = dy / params.SourceSize.xy; + tc = tc / params.SourceSize.xy; + + // reading the texels + + vec3 c00 = texture(Source, tc -dx -dy).xyz; + vec3 c10 = texture(Source, tc -dy).xyz; + vec3 c20 = texture(Source, tc +dx -dy).xyz; + vec3 c30 = texture(Source, tc+2.0*dx -dy).xyz; + vec3 c01 = texture(Source, tc -dx ).xyz; + vec3 c11 = texture(Source, tc ).xyz; + vec3 c21 = texture(Source, tc +dx ).xyz; + vec3 c31 = texture(Source, tc+2.0*dx ).xyz; + vec3 c02 = texture(Source, tc -dx +dy).xyz; + vec3 c12 = texture(Source, tc +dy).xyz; + vec3 c22 = texture(Source, tc +dx +dy).xyz; + vec3 c32 = texture(Source, tc+2.0*dx +dy).xyz; + vec3 c03 = texture(Source, tc -dx+2.0*dy).xyz; + vec3 c13 = texture(Source, tc +2.0*dy).xyz; + vec3 c23 = texture(Source, tc +dx+2.0*dy).xyz; + vec3 c33 = texture(Source, tc+2.0*dx+2.0*dy).xyz; + + + + color = mul(weights[0], mat4x3(c00, c10, c20, c30)); + color+= mul(weights[1], mat4x3(c01, c11, c21, c31)); + color+= mul(weights[2], mat4x3(c02, c12, c22, c32)); + color+= mul(weights[3], mat4x3(c03, c13, c23, c33)); + color = color/(dot(mul(weights, vec4(1.)), vec4(1.))); + + + + // Anti-ringing + // Get min/max samples + pc = vTexCoord; + c00 = texture(Source, pc ).xyz; + c11 = texture(Source, pc +dx ).xyz; + c21 = texture(Source, pc -dx ).xyz; + c12 = texture(Source, pc +dy).xyz; + c22 = texture(Source, pc -dy).xyz; + + + vec3 min_sample = min4(c11, c21, c12, c22); + vec3 max_sample = max4(c11, c21, c12, c22); + min_sample = min(min_sample, c00); + max_sample = max(max_sample, c00); + + vec3 aux = color; + + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, params.JINC2_AR_STRENGTH); + + FragColor = vec4(color, 1.); +} diff --git a/xbr/shaders/super-xbr/super-2xbr-3d-pass0.slang b/xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass0.slang similarity index 100% rename from xbr/shaders/super-xbr/super-2xbr-3d-pass0.slang rename to xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass0.slang diff --git a/xbr/shaders/super-xbr/super-2xbr-3d-pass1.slang b/xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass1.slang similarity index 100% rename from xbr/shaders/super-xbr/super-2xbr-3d-pass1.slang rename to xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass1.slang diff --git a/xbr/shaders/super-xbr/super-2xbr-3d-pass2.slang b/xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass2.slang similarity index 100% rename from xbr/shaders/super-xbr/super-2xbr-3d-pass2.slang rename to xbr/other presets/shaders/super-xbr/super-2xbr-3d-pass2.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass0.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass0.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass0.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass0.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass1.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass1.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass1.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass1.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass1f.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass1f.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass1f.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass1f.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass2.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass2.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass2.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass2.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass3.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass3.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass3.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass3.slang diff --git a/xbr/shaders/super-xbr/super-4xbr-3d-pass3f.slang b/xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass3f.slang similarity index 100% rename from xbr/shaders/super-xbr/super-4xbr-3d-pass3f.slang rename to xbr/other presets/shaders/super-xbr/super-4xbr-3d-pass3f.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass0.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass0.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass0.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass0.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass1.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass1.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass1.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass1.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass2.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass2.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass2.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass2.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass3.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass3.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass3.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass3.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass4.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass4.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass4.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass4.slang diff --git a/xbr/shaders/super-xbr/super-8xbr-3d-pass5.slang b/xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass5.slang similarity index 100% rename from xbr/shaders/super-xbr/super-8xbr-3d-pass5.slang rename to xbr/other presets/shaders/super-xbr/super-8xbr-3d-pass5.slang diff --git a/xbr/shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang b/xbr/other presets/shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang similarity index 100% rename from xbr/shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang rename to xbr/other presets/shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang diff --git a/xbr/super-2xbr-3d-2p.slangp b/xbr/other presets/super-2xbr-3d-2p.slangp similarity index 100% rename from xbr/super-2xbr-3d-2p.slangp rename to xbr/other presets/super-2xbr-3d-2p.slangp diff --git a/xbr/super-2xbr-3d-3p-smoother.slangp b/xbr/other presets/super-2xbr-3d-3p-smoother.slangp similarity index 100% rename from xbr/super-2xbr-3d-3p-smoother.slangp rename to xbr/other presets/super-2xbr-3d-3p-smoother.slangp diff --git a/xbr/super-4xbr-3d-4p.slangp b/xbr/other presets/super-4xbr-3d-4p.slangp similarity index 100% rename from xbr/super-4xbr-3d-4p.slangp rename to xbr/other presets/super-4xbr-3d-4p.slangp diff --git a/xbr/super-4xbr-3d-6p-smoother.slangp b/xbr/other presets/super-4xbr-3d-6p-smoother.slangp similarity index 96% rename from xbr/super-4xbr-3d-6p-smoother.slangp rename to xbr/other presets/super-4xbr-3d-6p-smoother.slangp index d7b56ba..8d885b7 100644 --- a/xbr/super-4xbr-3d-6p-smoother.slangp +++ b/xbr/other presets/super-4xbr-3d-6p-smoother.slangp @@ -35,6 +35,6 @@ scale_type_x5 = "source" scale_x5 = "1.000000" scale_type_y5 = "source" scale_y5 = "1.000000" -shader6 = "../stock.slang" +shader6 = "../shaders/support/stock.slang" filter_linear6 = true diff --git a/xbr/super-8xbr-3d-6p.slangp b/xbr/other presets/super-8xbr-3d-6p.slangp similarity index 100% rename from xbr/super-8xbr-3d-6p.slangp rename to xbr/other presets/super-8xbr-3d-6p.slangp diff --git a/xbr/xbr-hybrid.slangp b/xbr/other presets/xbr-hybrid.slangp similarity index 86% rename from xbr/xbr-hybrid.slangp rename to xbr/other presets/xbr-hybrid.slangp index 6771c23..efb6b18 100644 --- a/xbr/xbr-hybrid.slangp +++ b/xbr/other presets/xbr-hybrid.slangp @@ -1,7 +1,7 @@ shaders = 3 shader0 = shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang shader1 = shaders/xbr-hybrid/2xbr-hybrid-v5-gamma.slang -shader2 = ../stock.slang +shader2 = ../shaders/support/stock.slang filter_linear0 = false filter_linear1 = false diff --git a/xbr/other presets/xbr-lv1-standalone.slangp b/xbr/other presets/xbr-lv1-standalone.slangp new file mode 100644 index 0000000..d9bc0ec --- /dev/null +++ b/xbr/other presets/xbr-lv1-standalone.slangp @@ -0,0 +1,4 @@ +shaders = 1 + +shader0 = "../shaders/xbr-lv1-standalone.slang" +filter_linear0 = false diff --git a/xbr/other presets/xbr-lv2-hd.slangp b/xbr/other presets/xbr-lv2-hd.slangp new file mode 100644 index 0000000..2c81891 --- /dev/null +++ b/xbr/other presets/xbr-lv2-hd.slangp @@ -0,0 +1,4 @@ +shaders = 1 + +shader0 = ../shaders/xbr-lv2-hd.slang +filter_linear0 = false diff --git a/xbr/other presets/xbr-lv2-multipass.slangp b/xbr/other presets/xbr-lv2-multipass.slangp new file mode 100644 index 0000000..2b2e6e9 --- /dev/null +++ b/xbr/other presets/xbr-lv2-multipass.slangp @@ -0,0 +1,17 @@ +shaders = "3" + +shader0 = ../shaders/support/stock.slang +scale_type0 = source +scale0 = 1.0 +alias0 = XbrSource + +shader1 = ../shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = ../shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang + +filter_linear0 = "false" +filter_linear1 = "false" +filter_linear2 = "false" + diff --git a/xbr/other presets/xbr-lv2-standalone.slangp b/xbr/other presets/xbr-lv2-standalone.slangp new file mode 100644 index 0000000..5920ffd --- /dev/null +++ b/xbr/other presets/xbr-lv2-standalone.slangp @@ -0,0 +1,4 @@ +shaders = 1 + +shader0 = "../shaders/xbr-lv2-standalone.slang" +filter_linear0 = false diff --git a/xbr/other presets/xbr-lv3-9x-multipass.slangp b/xbr/other presets/xbr-lv3-9x-multipass.slangp new file mode 100644 index 0000000..4811eb2 --- /dev/null +++ b/xbr/other presets/xbr-lv3-9x-multipass.slangp @@ -0,0 +1,52 @@ +shaders = "8" + +shader0 = ../shaders/support/linearize.slang +scale_type0 = "source" +scale0 = "1.000000" +filter_linear0 = "false" +alias0 = XbrSource + +shader1 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +filter_linear1 = "false" +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang +filter_linear2 = "false" +scale_type2 = "source" +scale2 = "3.000000" +alias2 = xbr3x + +shader3 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +filter_linear3 = "false" +scale_type3 = "source" +scale3 = "1.000000" + +shader4 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass1b.slang +filter_linear4 = "false" +scale_type4 = "source" +scale4 = "3.000000" + +shader5 = ../shaders/support/b-spline-x.slang +filter_linear5 = false +scale_type_x5 = viewport +scale_type_y5 = source +scale5 = 1.0 + +shader6 = ../shaders/support/b-spline-y.slang +filter_linear6 = false +scale_type6 = viewport +scale6 = 1.0 + + +shader7 = ../shaders/support/delinearize.slang +scale_type7 = "source" +scale7 = "1.000000" +filter_linear7 = "false" + + +parameters = "SMALL_DETAILS;KA;XBR_EQ_THRESHOLD" + +SMALL_DETAILS = "1.0" +KA = "0.35" +XBR_EQ_THRESHOLD = "0.22" diff --git a/xbr/other presets/xbr-lv3-9x-standalone.slangp b/xbr/other presets/xbr-lv3-9x-standalone.slangp new file mode 100644 index 0000000..6bffc3e --- /dev/null +++ b/xbr/other presets/xbr-lv3-9x-standalone.slangp @@ -0,0 +1,27 @@ +shaders = 4 + +shader0 = ../shaders/xbr-lv3-standalone.slang +filter_linear0 = false +scale_type0 = "source" +scale0 = "3.000000" + +shader1 = ../shaders/xbr-lv3-standalone.slang +filter_linear1 = false +scale_type1 = "source" +scale1 = "3.000000" + +shader2 = ../shaders/support/b-spline-x.slang +filter_linear2 = false +scale_type_x2 = viewport +scale_type_y2 = source +scale2 = 1.0 + +shader3 = ../shaders/support/b-spline-y.slang +filter_linear3 = false +scale_type3 = viewport +scale3 = 1.0 + +parameters = "XBR_BLENDING" + +XBR_BLENDING = "0.0" + diff --git a/xbr/other presets/xbr-lv3-multipass.slangp b/xbr/other presets/xbr-lv3-multipass.slangp new file mode 100644 index 0000000..dcd61c4 --- /dev/null +++ b/xbr/other presets/xbr-lv3-multipass.slangp @@ -0,0 +1,30 @@ +shaders = "5" + +shader0 = ../shaders/support/stock.slang +scale_type0 = source +scale0 = 1.0 +alias0 = XbrSource + +shader1 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = ../shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang +scale_type2 = "source" +scale2 = "3.000000" + +shader3 = ../shaders/support/b-spline-x.slang +filter_linear3 = false +scale_type_x3 = viewport +scale_type_y3 = source +scale3 = 1.0 + +shader4 = ../shaders/support/b-spline-y.slang +filter_linear4 = false +scale_type4 = viewport +scale4 = 1.0 + +filter_linear0 = "false" +filter_linear1 = "false" +filter_linear2 = "false" + diff --git a/xbr/other presets/xbr-lv3-standalone.slangp b/xbr/other presets/xbr-lv3-standalone.slangp new file mode 100644 index 0000000..d9e0827 --- /dev/null +++ b/xbr/other presets/xbr-lv3-standalone.slangp @@ -0,0 +1,18 @@ +shaders = 3 + +shader0 = ../shaders/xbr-lv3-standalone.slang +filter_linear0 = false +scale_type0 = "source" +scale0 = "3.000000" + +shader1 = ../shaders/support/b-spline-x.slang +filter_linear1 = false +scale_type_x1 = viewport +scale_type_y1 = source +scale1 = 1.0 + +shader2 = ../shaders/support/b-spline-y.slang +filter_linear2 = false +scale_type2 = viewport +scale2 = 1.0 + diff --git a/xbr/xbr-mlv4-multipass.slangp b/xbr/other presets/xbr-mlv4-multipass.slangp similarity index 68% rename from xbr/xbr-mlv4-multipass.slangp rename to xbr/other presets/xbr-mlv4-multipass.slangp index f847a70..0c75b39 100644 --- a/xbr/xbr-mlv4-multipass.slangp +++ b/xbr/other presets/xbr-mlv4-multipass.slangp @@ -1,11 +1,11 @@ shaders = "5" -shader0 = ../stock.slang +shader0 = ../shaders/support/stock.slang scale_type0 = "source" scale0 = 1.0 alias0 = REF -shader1 = shaders/xbr-mlv4-multipass/xbr-mlv4-pass1.slang +shader1 = ../shaders/xbr-mlv4-multipass/xbr-mlv4-pass1.slang filter_linear1 = "false" float_framebuffer1 = "false" scale_type_x1 = "source" @@ -14,7 +14,7 @@ scale_type_y1 = "source" scale_y1 = "1.000000" alias1 = "PASS1" -shader2 = shaders/xbr-mlv4-multipass/xbr-mlv4-pass2.slang +shader2 = ../shaders/xbr-mlv4-multipass/xbr-mlv4-pass2.slang filter_linear2 = "false" float_framebuffer2 = "false" scale_type_x2 = "source" @@ -23,7 +23,7 @@ scale_type_y2 = "source" scale_y2 = "1.000000" alias2 = "PASS2" -shader3 = shaders/xbr-mlv4-multipass/xbr-mlv4-pass3.slang +shader3 = ../shaders/xbr-mlv4-multipass/xbr-mlv4-pass3.slang filter_linear3 = "false" float_framebuffer3 = "false" scale_type_x3 = "source" @@ -32,6 +32,6 @@ scale_type_y3 = "source" scale_y3 = "2.000000" alias3 = "PASS3" -shader4 = shaders/xbr-mlv4-multipass/xbr-mlv4-pass4.slang +shader4 = ../shaders/xbr-mlv4-multipass/xbr-mlv4-pass4.slang filter_linear4 = "false" float_framebuffer4 = "false" diff --git a/xbr/shaders/super-xbr/custom-jinc2-sharper.slang b/xbr/shaders/super-xbr/custom-jinc2-sharper.slang index 218b42b..224420b 100644 --- a/xbr/shaders/super-xbr/custom-jinc2-sharper.slang +++ b/xbr/shaders/super-xbr/custom-jinc2-sharper.slang @@ -32,9 +32,9 @@ layout(push_constant) uniform Push float JINC2_AR_STRENGTH; } params; -#pragma parameter JINC2_WINDOW_SINC "Window Sinc Param" 0.42 0.0 1.0 0.01 -#pragma parameter JINC2_SINC "Sinc Param" 0.92 0.0 1.0 0.01 -#pragma parameter JINC2_AR_STRENGTH "Anti-ringing Strength" 1.0 0.0 1.0 0.1 +#pragma parameter JINC2_WINDOW_SINC "Window Sinc Param" 0.50 0.0 1.0 0.01 +#pragma parameter JINC2_SINC "Sinc Param" 0.88 0.0 1.0 0.01 +#pragma parameter JINC2_AR_STRENGTH "Anti-ringing Strength" 0.0 0.0 1.0 0.1 #define mul(a,b) (b*a) @@ -163,23 +163,13 @@ void main() // Anti-ringing // Get min/max samples - pc = vTexCoord; - c00 = texture(Source, pc ).xyz; - c11 = texture(Source, pc +dx ).xyz; - c21 = texture(Source, pc -dx ).xyz; - c12 = texture(Source, pc +dy).xyz; - c22 = texture(Source, pc -dy).xyz; - - vec3 min_sample = min4(c11, c21, c12, c22); vec3 max_sample = max4(c11, c21, c12, c22); - min_sample = min(min_sample, c00); - max_sample = max(max_sample, c00); vec3 aux = color; - color = clamp(color, min_sample, max_sample); - color = mix(aux, color, params.JINC2_AR_STRENGTH); + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, params.JINC2_AR_STRENGTH); FragColor = vec4(color, 1.); -} \ No newline at end of file +} diff --git a/xbr/shaders/super-xbr/super-xbr-fast-pass0.slang b/xbr/shaders/super-xbr/super-xbr-fast-pass0.slang new file mode 100644 index 0000000..f221de4 --- /dev/null +++ b/xbr/shaders/super-xbr/super-xbr-fast-pass0.slang @@ -0,0 +1,186 @@ +#version 450 + +/* + + ******* Super XBR Shader - pass0 ******* + + Copyright (c) 2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float XBR_EDGE_STR_P0; + float XBR_WEIGHT; +} params; + +#pragma parameter XBR_EDGE_STR_P0 "Jaggies Anti-Aliasing [Rough <--> Smooth]" 0.25 0.0 1.0 0.05 +#pragma parameter XBR_WEIGHT "Color Blending [Rough <--> Smooth]" 0.0 0.0 1.0 0.5 + +#define XBR_EDGE_STR 4.0*(1.000001 - params.XBR_EDGE_STR_P0) +#define weight (params.XBR_WEIGHT*1.29633/10.0) + + +const float wp1 = 1.0; +const float wp2 = 0.0; +const float wp3 = 0.0; +const float wp4 = 2.0; +const float wp5 =-1.0; +const float wp6 = 0.0; + +const vec3 Y = vec3(.2126, .7152, .0722); + + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + + +float RGBtoYUV(vec3 color) +{ + return dot(color, Y); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float wp1, float wp2, float wp3, float wp4, float wp5, float wp6, float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return min(a, min(b, min(c, d))); +} + +vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return max(a, max(b, max(c, d))); +} + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; +layout(location = 3) out vec4 t3; +layout(location = 4) out vec4 t4; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord * 1.0001; + + float dx = params.SourceSize.z; + float dy = params.SourceSize.w; + t1 = vTexCoord.xyxy + vec4(-dx, -dy, 2.0*dx, 2.0*dy); + t2 = vTexCoord.xyxy + vec4( 0, -dy, dx, 2.0*dy); + t3 = vTexCoord.xyxy + vec4(-dx, 0, 2.0*dx, dy); + t4 = vTexCoord.xyxy + vec4( 0, 0, dx, dy); +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 3) in vec4 t3; +layout(location = 4) in vec4 t4; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec3 P0 = texture(Source, t1.xy).xyz; + vec3 P1 = texture(Source, t1.zy).xyz; + vec3 P2 = texture(Source, t1.xw).xyz; + vec3 P3 = texture(Source, t1.zw).xyz; + + vec3 B = texture(Source, t2.xy).xyz; + vec3 C = texture(Source, t2.zy).xyz; + vec3 H5 = texture(Source, t2.xw).xyz; + vec3 I5 = texture(Source, t2.zw).xyz; + + vec3 D = texture(Source, t3.xy).xyz; + vec3 F4 = texture(Source, t3.zy).xyz; + vec3 G = texture(Source, t3.xw).xyz; + vec3 I4 = texture(Source, t3.zw).xyz; + + vec3 E = texture(Source, t4.xy).xyz; + vec3 F = texture(Source, t4.zy).xyz; + vec3 H = texture(Source, t4.xw).xyz; + vec3 I = texture(Source, t4.zw).xyz; + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( wp1, wp2, wp3, wp4, wp5, wp6, d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( wp1, wp2, wp3, wp4, wp5, wp6, c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + float limits = XBR_EDGE_STR; + + /* Filter weights. Two taps only. */ + vec4 fw = vec4(-weight, weight+0.5, weight+0.5, -weight); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mat4x3( P2, H, F, P1 ) * fw; + vec3 c2 = mat4x3( P0, E, I, P3 ) * fw; + + /* Smoothly blends the two strongest directions. */ + vec3 color = mix(c1, c2, smoothstep(-limits, limits, d_edge)); + + /* Anti-ringing code. */ + vec3 min_sample = min4( E, F, H, I ); + vec3 max_sample = max4( E, F, H, I ); + color = clamp(color, min_sample, max_sample); + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/super-xbr/super-xbr-pass3.slang b/xbr/shaders/super-xbr/super-xbr-fast-pass1.slang old mode 100755 new mode 100644 similarity index 55% rename from xbr/shaders/super-xbr/super-xbr-pass3.slang rename to xbr/shaders/super-xbr/super-xbr-fast-pass1.slang index 5b8944f..97670be --- a/xbr/shaders/super-xbr/super-xbr-pass3.slang +++ b/xbr/shaders/super-xbr/super-xbr-fast-pass1.slang @@ -4,7 +4,7 @@ ******* Super XBR Shader - pass1 ******* - Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + Copyright (c) 2022 Hyllian - sergiogdb@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -26,9 +26,6 @@ */ -#define XBR_EDGE_STR 0.6 -#define XBR_WEIGHT 1.0 -#define XBR_ANTI_RINGING 1.0 layout(push_constant) uniform Push { @@ -36,28 +33,26 @@ layout(push_constant) uniform Push vec4 OriginalSize; vec4 OutputSize; uint FrameCount; - float MODE; - float XBR_EDGE_SHP; - float XBR_TEXTURE_SHP; - float XBR_EDGE_STR_P1; } params; -#pragma parameter XBR_EDGE_STR_P1 "Xbr - Edge Strength p1" 0.0 0.0 5.0 0.5 -#pragma parameter MODE "Mode - Normal, Details, Adaptive" 0.0 0.0 2.0 1.0 -#pragma parameter XBR_EDGE_SHP "Adaptive Dynamic Edge Sharp" 0.4 0.0 3.0 0.1 -#pragma parameter XBR_TEXTURE_SHP "Adaptive Static Edge Sharp" 1.0 0.0 2.0 0.1 -#define MODE params.MODE -#define XBR_EDGE_SHP params.XBR_EDGE_SHP -#define XBR_TEXTURE_SHP params.XBR_TEXTURE_SHP -#define XBR_EDGE_STR_P1 params.XBR_EDGE_STR_P1 +#define XBR_WEIGHT_P1 0.0 +#define XBR_ANTI_RINGING 1.0 +#define XBR_EDGE_STR_P1 3.0 +#define weight (XBR_WEIGHT_P1*1.29633/10.0) + +const float wp1 = 1.0; +const float wp2 = 0.0; +const float wp3 = 0.0; +const float wp4 = 2.0; +const float wp5 =-1.0; +const float wp6 = 0.0; layout(std140, set = 0, binding = 0) uniform UBO { mat4 MVP; } global; -#define mul(a,b) (b*a) const vec3 Y = vec3(.2126, .7152, .0722); @@ -86,10 +81,6 @@ float d_wd(float wp1, float wp2, float wp3, float wp4, float wp5, float wp6, flo return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); } -float hv_wd(float wp1, float wp2, float wp3, float wp4, float wp5, float wp6, float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) -{ - return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); -} vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d) { @@ -120,81 +111,39 @@ 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 PassPrev2; - -#define Original PassPrev2 +layout(set = 0, binding = 3) uniform sampler2D XbrSource; void main() { -// settings // - float wp1, wp2, wp3, wp4, wp5, wp6, weight1, weight2; - if (MODE == 1.0) - { - wp1 = 1.0; - wp2 = 0.0; - wp3 = 0.0; - wp4 = 0.0; - wp5 = 0.0; - wp6 = 0.0; - - weight1 = (XBR_WEIGHT*1.75068/10.0); - weight2 = (XBR_WEIGHT*1.29633/10.0/2.0); - } - else if (MODE == 2.0) - { - wp1 = 8.0; - wp2 = 0.0; - wp3 = 0.0; - wp4 = 0.0; - wp5 = 0.0; - wp6 = 0.0; - - weight1 = (1.75068/10.0); - weight2 = (1.29633/10.0/2.0); - } - else - { - wp1 = 8.0; - wp2 = 0.0; - wp3 = 0.0; - wp4 = 0.0; - wp5 = 0.0; - wp6 = 0.0; - - weight1 = (XBR_WEIGHT*1.75068/10.0); - weight2 = (XBR_WEIGHT*1.29633/10.0/2.0); - } -// end settings // - //Skip pixels on wrong grid vec2 fp = fract(vTexCoord.xy * params.SourceSize.xy); vec2 dir = fp - vec2(0.5,0.5); if ((dir.x*dir.y)>0.0) { - FragColor = mix( texture(Original, vTexCoord), texture(Source, vTexCoord), step(0.0, dir.x)); + FragColor = mix( texture(XbrSource, vTexCoord), texture(Source, vTexCoord), step(0.0, dir.x)); } else { vec2 g1 = (fp.x>0.5) ? vec2(0.5/params.SourceSize.x, 0.0) : vec2(0.0, 0.5/params.SourceSize.y); vec2 g2 = (fp.x>0.5) ? vec2(0.0, 0.5/params.SourceSize.y) : vec2(0.5/params.SourceSize.x, 0.0); - vec3 P0 = texture(Original, vTexCoord -3.0*g1 ).xyz; + vec3 P0 = texture(XbrSource, vTexCoord -3.0*g1 ).xyz; vec3 P1 = texture(Source, vTexCoord -3.0*g2).xyz; vec3 P2 = texture(Source, vTexCoord +3.0*g2).xyz; - vec3 P3 = texture(Original, vTexCoord +3.0*g1 ).xyz; + vec3 P3 = texture(XbrSource, vTexCoord +3.0*g1 ).xyz; vec3 B = texture(Source, vTexCoord -2.0*g1 -g2).xyz; - vec3 C = texture(Original, vTexCoord -g1 -2.0*g2).xyz; + vec3 C = texture(XbrSource, vTexCoord -g1 -2.0*g2).xyz; vec3 D = texture(Source, vTexCoord -2.0*g1 +g2).xyz; - vec3 E = texture(Original, vTexCoord -g1 ).xyz; + vec3 E = texture(XbrSource, vTexCoord -g1 ).xyz; vec3 F = texture(Source, vTexCoord -g2).xyz; - vec3 G = texture(Original, vTexCoord -g1 +2.0*g2).xyz; + vec3 G = texture(XbrSource, vTexCoord -g1 +2.0*g2).xyz; vec3 H = texture(Source, vTexCoord +g2).xyz; - vec3 I = texture(Original, vTexCoord +g1 ).xyz; + vec3 I = texture(XbrSource, vTexCoord +g1 ).xyz; - vec3 F4 = texture(Original, vTexCoord +g1 -2.0*g2).xyz; + vec3 F4 = texture(XbrSource, vTexCoord +g1 -2.0*g2).xyz; vec3 I4 = texture(Source, vTexCoord +2.0*g1 -g2).xyz; - vec3 H5 = texture(Original, vTexCoord +g1 +2.0*g2).xyz; + vec3 H5 = texture(XbrSource, vTexCoord +g1 +2.0*g2).xyz; vec3 I5 = texture(Source, vTexCoord +2.0*g1 +g2).xyz; float b = RGBtoYUV( B ); @@ -214,42 +163,17 @@ void main() /* Calc edgeness in diagonal directions. */ float d_edge = (d_wd( wp1, wp2, wp3, wp4, wp5, wp6, d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( wp1, wp2, wp3, wp4, wp5, wp6, c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); - /* Calc edgeness in horizontal/vertical directions. */ - float hv_edge = (hv_wd(wp1, wp2, wp3, wp4, wp5, wp6, f, i, e, h, c, i5, b, h5) - hv_wd(wp1, wp2, wp3, wp4, wp5, wp6, e, f, h, i, d, f4, g, i4)); - float limits = XBR_EDGE_STR_P1 + 0.000001; - float edge_strength = smoothstep(0.0, limits, abs(d_edge)); - vec4 w1, w2; - vec3 c3, c4; - if (MODE == 2.0) - { - float contrast = max(max4float(df(e,f),df(e,i),df(e,h),df(f,h)),max(df(f,i),df(h,i)))/(e+0.001); - - float wgt1 = weight1*(smoothstep(0.0, 0.6, contrast)*XBR_EDGE_SHP + XBR_TEXTURE_SHP); - float wgt2 = weight2*(smoothstep(0.0, 0.6, contrast)*XBR_EDGE_SHP + XBR_TEXTURE_SHP); - - /* Filter weights. Two taps only. */ - w1 = vec4(-wgt1, wgt1+ 0.5, wgt1+ 0.5, -wgt1); - w2 = vec4(-wgt2, wgt2+0.25, wgt2+0.25, -wgt2); - c3 = mul(w2, mat4x3(P0+2.0*(D+G)+P2, B+2.0*(E+H)+H5, C+2.0*(F+I)+I5, P1+2.0*(F4+I4)+P3))/3.0; - c4 = mul(w2, mat4x3(P0+2.0*(C+B)+P1, D+2.0*(F+E)+F4, G+2.0*(I+H)+I4, P2+2.0*(I5+H5)+P3))/3.0; - } - else - { - /* Filter weights. Two taps only. */ - w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); - w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); - c3 = mul(w2, mat4x3(D+G, E+H, F+I, F4+I4)); - c4 = mul(w2, mat4x3(C+B, F+E, I+H, I5+H5)); - } + /* Filter weights. Two taps only. */ + vec4 fw = vec4(-weight, weight+0.5, weight+0.5, -weight); /* Filtering and normalization in four direction generating four colors. */ - vec3 c1 = mul(w1, mat4x3( P2, H, F, P1 )); - vec3 c2 = mul(w1, mat4x3( P0, E, I, P3 )); + vec3 c1 = mat4x3( P2, H, F, P1 ) * fw; + vec3 c2 = mat4x3( P0, E, I, P3 ) * fw; - /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ - vec3 color = mix(mix(c1, c2, step(0.0, d_edge)), mix(c3, c4, step(0.0, hv_edge)), 1. - edge_strength); + /* Smoothly blends the two strongest directions. */ + vec3 color = mix(c1, c2, smoothstep(-limits, limits, d_edge)); /* Anti-ringing code. */ vec3 min_sample = min4( E, F, H, I ); diff --git a/xbr/shaders/super-xbr/super-xbr-fast-pass2.slang b/xbr/shaders/super-xbr/super-xbr-fast-pass2.slang new file mode 100644 index 0000000..90a93ab --- /dev/null +++ b/xbr/shaders/super-xbr/super-xbr-fast-pass2.slang @@ -0,0 +1,193 @@ +#version 450 + +/* + + ******* Super XBR Shader - pass2 ******* This pass is optional. + + Copyright (c) 2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; +} params; + +#define XBR_WEIGHT_P2 1.0 +#define XBR_ANTI_RINGING 1.0 +#define XBR_EDGE_STR_P2 3.0 +#define weight (XBR_WEIGHT_P2*1.29633/10.0) + +const float wp1 = 1.0; +const float wp2 = 0.0; +const float wp3 = 0.0; +const float wp4 =-2.0; +const float wp5 =-1.0; +const float wp6 = 0.0; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +const vec3 Y = vec3(.2126, .7152, .0722); + +float RGBtoYUV(vec3 color) +{ + return dot(color, Y); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + +float d_wd(float wp1, float wp2, float wp3, float wp4, float wp5, float wp6, float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + + +vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return min(a, min(b, min(c, d))); +} +vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d) +{ + return max(a, max(b, max(c, d))); +} + +float max4float(float a, float b, float c, float d) +{ + return max(a, max(b, max(c, d))); +} + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; +layout(location = 3) out vec4 t3; +layout(location = 4) out vec4 t4; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord * 1.0001; + + float dx = params.SourceSize.z; + float dy = params.SourceSize.w; + t1 = vTexCoord.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + t2 = vTexCoord.xyxy + vec4( -dx, -2.0*dy, 0, dy); + t3 = vTexCoord.xyxy + vec4(-2.0*dx, -dy, dx, 0); + t4 = vTexCoord.xyxy + vec4( -dx, -dy, 0, 0); +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 3) in vec4 t3; +layout(location = 4) in vec4 t4; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec3 P0 = texture(Source, t1.xy).xyz; + vec3 P1 = texture(Source, t1.zy).xyz; + vec3 P2 = texture(Source, t1.xw).xyz; + vec3 P3 = texture(Source, t1.zw).xyz; + + vec3 B = texture(Source, t2.xy).xyz; + vec3 C = texture(Source, t2.zy).xyz; + vec3 H5 = texture(Source, t2.xw).xyz; + vec3 I5 = texture(Source, t2.zw).xyz; + + vec3 D = texture(Source, t3.xy).xyz; + vec3 F4 = texture(Source, t3.zy).xyz; + vec3 G = texture(Source, t3.xw).xyz; + vec3 I4 = texture(Source, t3.zw).xyz; + + vec3 E = texture(Source, t4.xy).xyz; + vec3 F = texture(Source, t4.zy).xyz; + vec3 H = texture(Source, t4.xw).xyz; + vec3 I = texture(Source, t4.zw).xyz; + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( wp1, wp2, wp3, wp4, wp5, wp6, d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( wp1, wp2, wp3, wp4, wp5, wp6, c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + float limits = XBR_EDGE_STR_P2 + 0.000001; + + /* Filter weights. Two taps only. */ + vec4 fw = vec4(-weight, weight+0.5, weight+0.5, -weight); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mat4x3( P2, H, F, P1 ) * fw; + vec3 c2 = mat4x3( P0, E, I, P3 ) * fw; + + /* Smoothly blends the two strongest directions. */ + vec3 color = mix(c1, c2, smoothstep(-limits, limits, d_edge)); + + /* Anti-ringing code. */ + vec3 min_sample = min4( E, F, H, I ); + vec3 max_sample = max4( E, F, H, I ); + color = clamp(color, min_sample, max_sample); + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/super-xbr/super-xbr-pass0.slang b/xbr/shaders/super-xbr/super-xbr-pass0.slang index dc5fca8..ebcf934 100755 --- a/xbr/shaders/super-xbr/super-xbr-pass0.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass0.slang @@ -40,9 +40,9 @@ layout(push_constant) uniform Push float XBR_TEXTURE_SHP; } params; -#pragma parameter MODE "Mode - Normal, Details, Adaptive" 0.0 0.0 2.0 1.0 +#pragma parameter MODE "Mode - Normal, Details, Adaptive" 1.0 0.0 2.0 1.0 #pragma parameter XBR_EDGE_STR_P0 "Xbr - Edge Strength p0" 5.0 0.0 5.0 0.5 -#pragma parameter XBR_WEIGHT "Xbr - Filter Weight" 1.0 0.00 1.50 0.01 +#pragma parameter XBR_WEIGHT "Xbr - Filter Weight" 0.0 0.0 1.0 0.1 #pragma parameter XBR_EDGE_SHP "Adaptive Dynamic Edge Sharp" 0.4 0.0 3.0 0.1 #pragma parameter XBR_TEXTURE_SHP "Adaptive Static Edge Sharp" 1.0 0.0 2.0 0.1 @@ -235,4 +235,4 @@ void main() color = clamp(color, min_sample, max_sample); FragColor = vec4(color, 1.0); -} \ No newline at end of file +} diff --git a/xbr/shaders/super-xbr/super-xbr-pass1.slang b/xbr/shaders/super-xbr/super-xbr-pass1.slang index 039a4b7..606c84d 100755 --- a/xbr/shaders/super-xbr/super-xbr-pass1.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass1.slang @@ -26,7 +26,6 @@ */ -#define XBR_EDGE_STR 0.6 #define XBR_WEIGHT 1.0 #define XBR_ANTI_RINGING 1.0 @@ -42,8 +41,8 @@ layout(push_constant) uniform Push float XBR_EDGE_STR_P1; } params; -#pragma parameter XBR_EDGE_STR_P1 "Xbr - Edge Strength p1" 0.0 0.0 5.0 0.5 -#pragma parameter MODE "Mode - Normal, Details, Adaptive" 0.0 0.0 2.0 1.0 +#pragma parameter XBR_EDGE_STR_P1 "Xbr - Edge Strength p1" 5.0 0.0 5.0 0.5 +#pragma parameter MODE "Mode - Normal, Details, Adaptive" 1.0 0.0 2.0 1.0 #pragma parameter XBR_EDGE_SHP "Adaptive Dynamic Edge Sharp" 0.4 0.0 3.0 0.1 #pragma parameter XBR_TEXTURE_SHP "Adaptive Static Edge Sharp" 1.0 0.0 2.0 0.1 @@ -120,7 +119,7 @@ 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 XbrSource; void main() { @@ -135,8 +134,8 @@ void main() wp5 = 0.0; wp6 = 0.0; - weight1 = (XBR_WEIGHT*1.75068/10.0); - weight2 = (XBR_WEIGHT*1.29633/10.0/2.0); + weight1 = (XBR_WEIGHT*1.29633/10.0); + weight2 = (XBR_WEIGHT*1.75068/10.0/2.0); } else if (MODE == 2.0) { @@ -147,8 +146,8 @@ void main() wp5 = 0.0; wp6 = 0.0; - weight1 = (1.75068/10.0); - weight2 = (1.29633/10.0/2.0); + weight1 = (1.29633/10.0); + weight2 = (1.75068/10.0/2.0); } else { @@ -159,8 +158,8 @@ void main() wp5 = 0.0; wp6 = 0.0; - weight1 = (XBR_WEIGHT*1.75068/10.0); - weight2 = (XBR_WEIGHT*1.29633/10.0/2.0); + weight1 = (XBR_WEIGHT*1.29633/10.0); + weight2 = (XBR_WEIGHT*1.75068/10.0/2.0); } // end settings // @@ -169,30 +168,30 @@ void main() vec2 dir = fp - vec2(0.5,0.5); if ((dir.x*dir.y)>0.0) { - FragColor = mix( texture(Original, vTexCoord), texture(Source, vTexCoord), step(0.0, dir.x)); + FragColor = mix( texture(XbrSource, vTexCoord), texture(Source, vTexCoord), step(0.0, dir.x)); } else { vec2 g1 = (fp.x>0.5) ? vec2(0.5/params.SourceSize.x, 0.0) : vec2(0.0, 0.5/params.SourceSize.y); vec2 g2 = (fp.x>0.5) ? vec2(0.0, 0.5/params.SourceSize.y) : vec2(0.5/params.SourceSize.x, 0.0); - vec3 P0 = texture(Original, vTexCoord -3.0*g1 ).xyz; + vec3 P0 = texture(XbrSource, vTexCoord -3.0*g1 ).xyz; vec3 P1 = texture(Source, vTexCoord -3.0*g2).xyz; vec3 P2 = texture(Source, vTexCoord +3.0*g2).xyz; - vec3 P3 = texture(Original, vTexCoord +3.0*g1 ).xyz; + vec3 P3 = texture(XbrSource, vTexCoord +3.0*g1 ).xyz; vec3 B = texture(Source, vTexCoord -2.0*g1 -g2).xyz; - vec3 C = texture(Original, vTexCoord -g1 -2.0*g2).xyz; + vec3 C = texture(XbrSource, vTexCoord -g1 -2.0*g2).xyz; vec3 D = texture(Source, vTexCoord -2.0*g1 +g2).xyz; - vec3 E = texture(Original, vTexCoord -g1 ).xyz; + vec3 E = texture(XbrSource, vTexCoord -g1 ).xyz; vec3 F = texture(Source, vTexCoord -g2).xyz; - vec3 G = texture(Original, vTexCoord -g1 +2.0*g2).xyz; + vec3 G = texture(XbrSource, vTexCoord -g1 +2.0*g2).xyz; vec3 H = texture(Source, vTexCoord +g2).xyz; - vec3 I = texture(Original, vTexCoord +g1 ).xyz; + vec3 I = texture(XbrSource, vTexCoord +g1 ).xyz; - vec3 F4 = texture(Original, vTexCoord +g1 -2.0*g2).xyz; + vec3 F4 = texture(XbrSource, vTexCoord +g1 -2.0*g2).xyz; vec3 I4 = texture(Source, vTexCoord +2.0*g1 -g2).xyz; - vec3 H5 = texture(Original, vTexCoord +g1 +2.0*g2).xyz; + vec3 H5 = texture(XbrSource, vTexCoord +g1 +2.0*g2).xyz; vec3 I5 = texture(Source, vTexCoord +2.0*g1 +g2).xyz; float b = RGBtoYUV( B ); diff --git a/xbr/shaders/super-xbr/super-xbr-pass2.slang b/xbr/shaders/super-xbr/super-xbr-pass2.slang index ec8ef8e..37d1414 100755 --- a/xbr/shaders/super-xbr/super-xbr-pass2.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass2.slang @@ -26,7 +26,6 @@ */ -const float XBR_EDGE_STR = 0.6; const float XBR_WEIGHT = 1.0; const float XBR_ANTI_RINGING = 1.0; @@ -42,7 +41,7 @@ layout(push_constant) uniform Push float XBR_EDGE_STR_P2; } params; -#pragma parameter MODE "Mode - Normal, Details, Adaptive" 0.0 0.0 2.0 1.0 +#pragma parameter MODE "Mode - Normal, Details, Adaptive" 1.0 0.0 2.0 1.0 #pragma parameter XBR_EDGE_STR_P2 "Xbr - Edge Strength p2" 5.0 0.0 5.0 0.5 #pragma parameter XBR_EDGE_SHP "Adaptive Dynamic Edge Sharp" 0.4 0.0 3.0 0.1 #pragma parameter XBR_TEXTURE_SHP "Adaptive Static Edge Sharp" 1.0 0.0 2.0 0.1 diff --git a/xbr/shaders/support/b-spline-x.slang b/xbr/shaders/support/b-spline-x.slang new file mode 100644 index 0000000..fd34157 --- /dev/null +++ b/xbr/shaders/support/b-spline-x.slang @@ -0,0 +1,92 @@ +#version 450 + +/* + b-spline-x Shader + + Copyright (C) 2011-2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +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; + +// B-Spline bicubic parameters +const float B = 1.0; +const float C = 0.0; + +const mat4 INV = mat4( (-B - 6.0*C)/6.0, (3.0*B + 12.0*C)/6.0, (-3.0*B - 6.0*C)/6.0, B/6.0, + (12.0 - 9.0*B - 6.0*C)/6.0, (-18.0 + 12.0*B + 6.0*C)/6.0, 0.0, (6.0 - 2.0*B)/6.0, + -(12.0 - 9.0*B - 6.0*C)/6.0, (18.0 - 15.0*B - 12.0*C)/6.0, (3.0*B + 6.0*C)/6.0, B/6.0, + (B + 6.0*C)/6.0, -C, 0.0, 0.0); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 ps = vec2(params.SourceSize.z, params.SourceSize.w); + float dx = ps.x; + float dy = ps.y; + + vTexCoord = TexCoord * 1.0004 - vec2(0.5, 0.0)*ps; + + t1 = vTexCoord.xyxy + vec4( -dx, 0.0, 0.0, 0.0); + t2 = vTexCoord.xyxy + vec4( dx, 0.0, 2.0*dx, 0.0); + +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec2 fp = fract(vTexCoord*params.SourceSize.xy); + + vec3 C0 = texture(Source, t1.xy).xyz; + vec3 C1 = texture(Source, t1.zw).xyz; + vec3 C2 = texture(Source, t2.xy).xyz; + vec3 C3 = texture(Source, t2.zw).xyz; + + vec4 Px = vec4(fp.x*fp.x*fp.x, fp.x*fp.x, fp.x, 1.0) * INV; + vec3 color = mat4x3(C0, C1, C2, C3) * Px; + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/b-spline-y.slang b/xbr/shaders/support/b-spline-y.slang new file mode 100644 index 0000000..a59c112 --- /dev/null +++ b/xbr/shaders/support/b-spline-y.slang @@ -0,0 +1,92 @@ +#version 450 + +/* + b-spline-y Shader + + Copyright (C) 2011-2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +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; + +// B-Spline bicubic parameters +const float B = 1.0; +const float C = 0.0; + +const mat4 INV = mat4( (-B - 6.0*C)/6.0, (3.0*B + 12.0*C)/6.0, (-3.0*B - 6.0*C)/6.0, B/6.0, + (12.0 - 9.0*B - 6.0*C)/6.0, (-18.0 + 12.0*B + 6.0*C)/6.0, 0.0, (6.0 - 2.0*B)/6.0, + -(12.0 - 9.0*B - 6.0*C)/6.0, (18.0 - 15.0*B - 12.0*C)/6.0, (3.0*B + 6.0*C)/6.0, B/6.0, + (B + 6.0*C)/6.0, -C, 0.0, 0.0); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 ps = vec2(params.SourceSize.z, params.SourceSize.w); + float dx = ps.x; + float dy = ps.y; + + vTexCoord = TexCoord * 1.0004 - vec2(0.0, 0.5)*ps; + + t1 = vTexCoord.xyxy + vec4( 0.0, -dy, 0.0, 0.0); + t2 = vTexCoord.xyxy + vec4( 0.0, dy, 0.0, 2.0*dy); + +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec2 fp = fract(vTexCoord*params.SourceSize.xy); + + vec3 C0 = texture(Source, t1.xy).xyz; + vec3 C1 = texture(Source, t1.zw).xyz; + vec3 C2 = texture(Source, t2.xy).xyz; + vec3 C3 = texture(Source, t2.zw).xyz; + + vec4 Py = vec4(fp.y*fp.y*fp.y, fp.y*fp.y, fp.y, 1.0) * INV; + vec3 color = mat4x3(C0, C1, C2, C3) * Py; + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/b-spline.slang b/xbr/shaders/support/b-spline.slang deleted file mode 100644 index b192576..0000000 --- a/xbr/shaders/support/b-spline.slang +++ /dev/null @@ -1,138 +0,0 @@ -#version 450 - -/* - Copyright (C) 2010 Team XBMC - http://www.xbmc.org - Copyright (C) 2011 Stefanos A. - http://www.opentk.com - -This Program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This Program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with XBMC; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -http://www.gnu.org/copyleft/gpl.html -*/ - -layout(push_constant) uniform Push -{ - vec4 SourceSize; - vec4 OriginalSize; - vec4 OutputSize; - uint FrameCount; - float B, C; -} params; - -// Default to Mitchel-Netravali coefficients for best psychovisual result -// bicubic-sharp is B = 0.1 and C = 0.5 -// bicubic-sharper is B = 0.0 and C = 0.75 -// Hyllian: using params for B-Spline (B=1.0, C=0.0). Very good at getting rid of jaggies. -#pragma parameter B "Bicubic Coeff B" 1.00 0.0 1.0 0.01 -#pragma parameter C "Bicubic Coeff C" 0.00 0.0 1.0 0.01 - -#define B params.B -#define C params.C - -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; - -float weight(float x) -{ - float ax = abs(x); - - if (ax < 1.0) - { - return - ( - pow(x, 2.0) * ((12.0 - 9.0 * B - 6.0 * C) * ax + (-18.0 + 12.0 * B + 6.0 * C)) + - (6.0 - 2.0 * B) - ) / 6.0; - } - else if ((ax >= 1.0) && (ax < 2.0)) - { - return - ( - pow(x, 2.0) * ((-B - 6.0 * C) * ax + (6.0 * B + 30.0 * C)) + - (-12.0 * B - 48.0 * C) * ax + (8.0 * B + 24.0 * C) - ) / 6.0; - } - else - { - return 0.0; - } -} - -vec4 weight4(float x) -{ - return vec4( - weight(x - 2.0), - weight(x - 1.0), - weight(x), - weight(x + 1.0)); -} - -vec3 pixel(float xpos, float ypos, sampler2D tex) -{ - return texture(tex, vec2(xpos, ypos)).rgb; -} - -vec3 line_run(float ypos, vec4 xpos, vec4 linetaps, sampler2D tex) -{ - return - pixel(xpos.r, ypos, tex) * linetaps.r + - pixel(xpos.g, ypos, tex) * linetaps.g + - pixel(xpos.b, ypos, tex) * linetaps.b + - pixel(xpos.a, ypos, tex) * linetaps.a; -} - -void main() -{ - vec2 stepxy = vec2(1.0/params.SourceSize.x, 1.0/params.SourceSize.y); - vec2 pos = vTexCoord.xy + stepxy * 0.5; - vec2 f = fract(pos / stepxy); - - vec4 linetaps = weight4(1.0 - f.x); - vec4 columntaps = weight4(1.0 - f.y); - - //make sure all taps added together is exactly 1.0, otherwise some (very small) distortion can occur - linetaps /= linetaps.r + linetaps.g + linetaps.b + linetaps.a; - columntaps /= columntaps.r + columntaps.g + columntaps.b + columntaps.a; - - vec2 xystart = (-1.5 - f) * stepxy + pos; - vec4 xpos = vec4(xystart.x, xystart.x + stepxy.x, xystart.x + stepxy.x * 2.0, xystart.x + stepxy.x * 3.0); - - -// final sum and weight normalization - vec4 final = vec4(line_run(xystart.y , xpos, linetaps, Source) * columntaps.r + - line_run(xystart.y + stepxy.y , xpos, linetaps, Source) * columntaps.g + - line_run(xystart.y + stepxy.y * 2.0, xpos, linetaps, Source) * columntaps.b + - line_run(xystart.y + stepxy.y * 3.0, xpos, linetaps, Source) * columntaps.a,1); - - FragColor = final; -} diff --git a/xbr/shaders/support/bicubic-x.slang b/xbr/shaders/support/bicubic-x.slang new file mode 100644 index 0000000..3cd71ca --- /dev/null +++ b/xbr/shaders/support/bicubic-x.slang @@ -0,0 +1,107 @@ +#version 450 + +/* + bicubic-x Shader + + Copyright (C) 2011-2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float B_ANTI_RINGING; +} params; + +#pragma parameter B_ANTI_RINGING "Bicubic Anti-Ringing [ OFF | ON ]" 1.0 0.0 1.0 1.0 + +#define B_ANTI_RINGING params.B_ANTI_RINGING + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +// Classic Mitchell-Netravali bicubic parameters +const float B = 1.0/3.0; +const float C = 1.0/3.0; + +const mat4 INV = mat4( (-B - 6.0*C)/6.0, (3.0*B + 12.0*C)/6.0, (-3.0*B - 6.0*C)/6.0, B/6.0, + (12.0 - 9.0*B - 6.0*C)/6.0, (-18.0 + 12.0*B + 6.0*C)/6.0, 0.0, (6.0 - 2.0*B)/6.0, + -(12.0 - 9.0*B - 6.0*C)/6.0, (18.0 - 15.0*B - 12.0*C)/6.0, (3.0*B + 6.0*C)/6.0, B/6.0, + (B + 6.0*C)/6.0, -C, 0.0, 0.0); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 ps = vec2(params.SourceSize.z, params.SourceSize.w); + float dx = ps.x; + float dy = ps.y; + + vTexCoord = TexCoord * 1.0001 - vec2(0.5, 0.0)*ps; + + t1 = vTexCoord.xyxy + vec4( -dx, 0.0, 0.0, 0.0); + t2 = vTexCoord.xyxy + vec4( dx, 0.0, 2.0*dx, 0.0); + +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec2 fp = fract(vTexCoord*params.SourceSize.xy); + + vec3 C0 = texture(Source, t1.xy).xyz; + vec3 C1 = texture(Source, t1.zw).xyz; + vec3 C2 = texture(Source, t2.xy).xyz; + vec3 C3 = texture(Source, t2.zw).xyz; + + vec4 Px = vec4(fp.x*fp.x*fp.x, fp.x*fp.x, fp.x, 1.0) * INV; + vec3 color = mat4x3(C0, C1, C2, C3) * Px; + + // Anti-ringing + if (B_ANTI_RINGING == 1.0) + { + vec3 aux = color; + vec3 min_sample = min(min(C0, C1), min(C2, C3)); + vec3 max_sample = max(max(C0, C1), max(C2, C3)); + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, step(0.0, (C0-C1)*(C2-C3))); + } + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/bicubic-y.slang b/xbr/shaders/support/bicubic-y.slang new file mode 100644 index 0000000..b48e503 --- /dev/null +++ b/xbr/shaders/support/bicubic-y.slang @@ -0,0 +1,107 @@ +#version 450 + +/* + bicubic-y Shader + + Copyright (C) 2011-2022 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float B_ANTI_RINGING; +} params; + +#pragma parameter B_ANTI_RINGING "Bicubic Anti-Ringing [ OFF | ON ]" 1.0 0.0 1.0 1.0 + +#define B_ANTI_RINGING params.B_ANTI_RINGING + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; +} global; + +// Classic Mitchell-Netravali bicubic parameters +const float B = 1.0/3.0; +const float C = 1.0/3.0; + +const mat4 INV = mat4( (-B - 6.0*C)/6.0, (3.0*B + 12.0*C)/6.0, (-3.0*B - 6.0*C)/6.0, B/6.0, + (12.0 - 9.0*B - 6.0*C)/6.0, (-18.0 + 12.0*B + 6.0*C)/6.0, 0.0, (6.0 - 2.0*B)/6.0, + -(12.0 - 9.0*B - 6.0*C)/6.0, (18.0 - 15.0*B - 12.0*C)/6.0, (3.0*B + 6.0*C)/6.0, B/6.0, + (B + 6.0*C)/6.0, -C, 0.0, 0.0); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out vec4 t1; +layout(location = 2) out vec4 t2; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 ps = vec2(params.SourceSize.z, params.SourceSize.w); + float dx = ps.x; + float dy = ps.y; + + vTexCoord = TexCoord * 1.0001 - vec2(0.0, 0.5)*ps; + + t1 = vTexCoord.xyxy + vec4( 0.0, -dy, 0.0, 0.0); + t2 = vTexCoord.xyxy + vec4( 0.0, dy, 0.0, 2.0*dy); + +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in vec4 t1; +layout(location = 2) in vec4 t2; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + vec2 fp = fract(vTexCoord*params.SourceSize.xy); + + vec3 C0 = texture(Source, t1.xy).xyz; + vec3 C1 = texture(Source, t1.zw).xyz; + vec3 C2 = texture(Source, t2.xy).xyz; + vec3 C3 = texture(Source, t2.zw).xyz; + + vec4 Py = vec4(fp.y*fp.y*fp.y, fp.y*fp.y, fp.y, 1.0) * INV; + vec3 color = mat4x3(C0, C1, C2, C3) * Py; + + // Anti-ringing + if (B_ANTI_RINGING == 1.0) + { + vec3 aux = color; + vec3 min_sample = min(min(C0, C1), min(C2, C3)); + vec3 max_sample = max(max(C0, C1), max(C2, C3)); + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, step(0.0, (C0-C1)*(C2-C3))); + } + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/delinearize.slang b/xbr/shaders/support/delinearize.slang new file mode 100644 index 0000000..bf3bc25 --- /dev/null +++ b/xbr/shaders/support/delinearize.slang @@ -0,0 +1,42 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float OutputGamma; +} params; + +#pragma parameter OutputGamma "OUTPUT GAMMA" 2.0 1.0 3.0 0.05 + +#define OutputGamma params.OutputGamma +#define GAMMA_OUT(color) pow(color, vec3(1.0 / OutputGamma, 1.0 / OutputGamma, 1.0 / OutputGamma)) + +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)); + FragColor = vec4(GAMMA_OUT(texture(Source, vTexCoord).rgb), 1.0); +} diff --git a/xbr/shaders/support/linearize.slang b/xbr/shaders/support/linearize.slang new file mode 100644 index 0000000..cae8fab --- /dev/null +++ b/xbr/shaders/support/linearize.slang @@ -0,0 +1,43 @@ +#version 450 + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float InputGamma; +} params; + +#pragma parameter InputGamma "INPUT GAMMA" 2.0 1.0 3.0 0.05 + +#define InputGamma params.InputGamma + +#define GAMMA_IN(color) pow(color, vec3(InputGamma, InputGamma, InputGamma)) + +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)); + FragColor = vec4(GAMMA_IN(texture(Source, vTexCoord).rgb), 1.0); +} diff --git a/xbr/shaders/support/spline16-x.slang b/xbr/shaders/support/spline16-x.slang new file mode 100644 index 0000000..5aca762 --- /dev/null +++ b/xbr/shaders/support/spline16-x.slang @@ -0,0 +1,140 @@ +#version 450 + +/* + Spline16 - PassX - by Hyllian 2022 + + Adapted from bicubic source shaders below. + + Spline36 math sources: https://www.panotools.org/dersch/interpolator/interpolator.html +*/ + + + +/* + Copyright (C) 2010 Team XBMC + http://www.xbmc.org + Copyright (C) 2011 Stefanos A. + http://www.opentk.com + +This Program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This Program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XBMC; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +http://www.gnu.org/copyleft/gpl.html +*/ + + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float S16_ANTI_RINGING; +} params; + +#pragma parameter S16_ANTI_RINGING "Spline16 Anti-Ringing [ OFF | ON ]" 1.0 0.0 1.0 1.0 + +#define S16_ANTI_RINGING params.S16_ANTI_RINGING + +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 + vec2(0.0001, 0.0001);; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + + +float weight(float x) +{ + x = abs(x); + + if (x < 1.0) + { + return + ( + ((x - 9.0 / 5.0) * x - 1.0 / 5.0 ) * x + 1.0 + ); + } + else if ((x >= 1.0) && (x < 2.0)) + { + return + ( + (( -1.0 / 3.0 * (x - 1) + 4.0 / 5.0 ) * (x - 1) - 7.0 / 15.0 ) * (x - 1) + ); + } + else + { + return 0.0; + } +} + +vec4 weight4(float x) +{ + return vec4( + weight(x - 2.0), + weight(x - 1.0), + weight(x), + weight(x + 1.0) + ); +} + + + +void main() +{ + vec2 ps = params.SourceSize.zw; + vec2 pos = vTexCoord.xy + ps * vec2(0.5, 0.0); + vec2 fp = fract(pos / ps); + + vec2 xystart = (-1.5 - fp) * ps + pos; + + float ypos = xystart.y + ps.y * 2.0; + + vec3 C0 = texture(Source, vec2(xystart.x , ypos)).rgb; + vec3 C1 = texture(Source, vec2(xystart.x + ps.x , ypos)).rgb; + vec3 C2 = texture(Source, vec2(xystart.x + ps.x * 2.0, ypos)).rgb; + vec3 C3 = texture(Source, vec2(xystart.x + ps.x * 3.0, ypos)).rgb; + + vec4 w = weight4(1.0 - fp.x); + + float sum = dot( w, vec4(1)); + w /= sum; + + vec3 color = mat4x3( C0, C1, C2, C3 ) * w; + + // Anti-ringing + if (S16_ANTI_RINGING == 1.0) + { + vec3 aux = color; + vec3 min_sample = min(min(C0, C1), min(C2, C3)); + vec3 max_sample = max(max(C0, C1), max(C2, C3)); + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, step(0.0, (C0-C1)*(C2-C3))); + } + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/spline16-y.slang b/xbr/shaders/support/spline16-y.slang new file mode 100644 index 0000000..2547608 --- /dev/null +++ b/xbr/shaders/support/spline16-y.slang @@ -0,0 +1,140 @@ +#version 450 + +/* + Spline16 - PassY - by Hyllian 2022 + + Adapted from bicubic source shaders below. + + Spline36 math sources: https://www.panotools.org/dersch/interpolator/interpolator.html +*/ + + + +/* + Copyright (C) 2010 Team XBMC + http://www.xbmc.org + Copyright (C) 2011 Stefanos A. + http://www.opentk.com + +This Program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This Program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XBMC; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +http://www.gnu.org/copyleft/gpl.html +*/ + + +layout(push_constant) uniform Push +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + float S16_ANTI_RINGING; +} params; + +#pragma parameter S16_ANTI_RINGING "Spline16 Anti-Ringing [ OFF | ON ]" 1.0 0.0 1.0 1.0 + +#define S16_ANTI_RINGING params.S16_ANTI_RINGING + +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 + vec2(0.0001, 0.0001);; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + + +float weight(float x) +{ + x = abs(x); + + if (x < 1.0) + { + return + ( + ((x - 9.0 / 5.0) * x - 1.0 / 5.0 ) * x + 1.0 + ); + } + else if ((x >= 1.0) && (x < 2.0)) + { + return + ( + (( -1.0 / 3.0 * (x - 1) + 4.0 / 5.0 ) * (x - 1) - 7.0 / 15.0 ) * (x - 1) + ); + } + else + { + return 0.0; + } +} + +vec4 weight4(float x) +{ + return vec4( + weight(x - 2.0), + weight(x - 1.0), + weight(x), + weight(x + 1.0) + ); +} + + + +void main() +{ + vec2 ps = params.SourceSize.zw; + vec2 pos = vTexCoord.xy + ps * vec2(0.0, 0.5); + vec2 fp = fract(pos / ps); + + vec2 xystart = (-1.5 - fp) * ps + pos; + + float xpos = xystart.x + ps.x * 2.0; + + vec3 C0 = texture(Source, vec2(xpos, xystart.y )).rgb; + vec3 C1 = texture(Source, vec2(xpos, xystart.y + ps.y )).rgb; + vec3 C2 = texture(Source, vec2(xpos, xystart.y + ps.y * 2.0)).rgb; + vec3 C3 = texture(Source, vec2(xpos, xystart.y + ps.y * 3.0)).rgb; + + vec4 w = weight4(1.0 - fp.y); + + float sum = dot( w, vec4(1)); + w /= sum; + + vec3 color = mat4x3( C0, C1, C2, C3 ) * w; + + // Anti-ringing + if (S16_ANTI_RINGING == 1.0) + { + vec3 aux = color; + vec3 min_sample = min(min(C0, C1), min(C2, C3)); + vec3 max_sample = max(max(C0, C1), max(C2, C3)); + color = clamp(color, min_sample, max_sample); + color = mix(aux, color, step(0.0, (C0-C1)*(C2-C3))); + } + + FragColor = vec4(color, 1.0); +} diff --git a/xbr/shaders/support/stock.slang b/xbr/shaders/support/stock.slang new file mode 100644 index 0000000..bf3cf6b --- /dev/null +++ b/xbr/shaders/support/stock.slang @@ -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 = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/xbr/shaders/xbr-lv1.slang b/xbr/shaders/xbr-lv1-standalone.slang similarity index 100% rename from xbr/shaders/xbr-lv1.slang rename to xbr/shaders/xbr-lv1-standalone.slang diff --git a/xbr/shaders/xbr-lv2-3d.slang b/xbr/shaders/xbr-lv2-hd.slang similarity index 100% rename from xbr/shaders/xbr-lv2-3d.slang rename to xbr/shaders/xbr-lv2-hd.slang diff --git a/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang b/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang index 3ec75f4..5409abc 100644 --- a/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang +++ b/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang @@ -29,18 +29,24 @@ layout(push_constant) uniform Push { - float XBR_EQ_THRESHOLD; - float XBR_LV2_COEFFICIENT; float SMALL_DETAILS; + float WP4; + float KA; + float XBR_EQ_THRESHOLD; + float FD; } params; -#pragma parameter XBR_EQ_THRESHOLD "COLOR DISTINCTION THRESHOLD" 0.32 0.0 1.0 0.01 -#pragma parameter XBR_LV2_COEFFICIENT "SMOOTHNESS THRESHOLD" 0.3 0.0 1.0 0.1 -#pragma parameter SMALL_DETAILS "SMALL DETAILS" 0.0 0.0 1.0 1.0 +#pragma parameter SMALL_DETAILS "XBR - MODE (VANILLA | SMALL DETAILS)" 0.0 0.0 1.0 1.0 +#pragma parameter WP4 "XBR - SMOOTHNESS LOCAL WEIGHT" 1.0 0.0 1.0 0.2 +#pragma parameter KA "XBR - SMOOTHNESS THRESHOLD" 1.0 0.0 1.0 0.05 +#pragma parameter XBR_EQ_THRESHOLD "XBR - COLOR DISTINCTION THRESHOLD" 0.26 0.0 1.0 0.01 +#pragma parameter FD "XBR - DITHERING/SMOOTHNESS COMPROMISE (MEDIUM | HIGH)" 0.0 0.0 1.0 1.0 -#define XBR_EQ_THRESHOLD params.XBR_EQ_THRESHOLD -#define XBR_LV2_COEFFICIENT params.XBR_LV2_COEFFICIENT -#define SMALL_DETAILS params.SMALL_DETAILS +#define SMALL_DETAILS params.SMALL_DETAILS +#define WP4 (5.0*params.WP4) +#define KA (6.0-5.0*params.KA) +#define XBR_EQ_THRESHOLD params.XBR_EQ_THRESHOLD +#define FD (1.0-params.FD) layout(std140, set = 0, binding = 0) uniform UBO { @@ -55,7 +61,8 @@ layout(std140, set = 0, binding = 0) uniform UBO //#define CORNER_B #define CORNER_C -#define lv2_cf (XBR_LV2_COEFFICIENT + 2.0) + +#define lv2_cf 2.4 #define saturate(c) clamp(c, 0.0, 1.0) #define round(X) floor((X)+0.5) @@ -180,11 +187,11 @@ vec4 weighted_distance(mat4x3 a, mat4x3 b, mat4x3 c, mat4x3 d, mat4x3 e, mat4x3 { if (SMALL_DETAILS < 0.5) { - return (dist4(a,b) + dist4(a,c) + dist4(d,e) + dist4(d,f) + 4.0*dist4(g,h)); + return ( FD * ( dist4(a,b) + dist4(a,c)) * (dist4(d,e) + dist4(d,f) ) + WP4 * dist4(g,h) ); } else { - return ( (dist4(a,b) + dist4(a,c)) * (dist4(d,e) + dist4(d,f)) + 2.0 * dist4(g,h) * (dist4(c,e)+dist4(b,f)) * (dist4(c,b)+dist4(e,f)) ); + return ( FD * ( dist4(a,b) + dist4(a,c) + dist4(d,e) + dist4(d,f) - dist4(c,e) - dist4(b,f) ) + WP4 * dist4(g,h) ); } } @@ -269,10 +276,8 @@ void main() vec4 d_fg = dist4(f, g); vec4 d_hc = dist4(h, c); - float K = (SMALL_DETAILS < 0.5 ? 1.0 : 1.9); - edri = LTE(wd1, wd2) * irlv0; - edr = LT( K*wd1, wd2) * irlv1 * NOT(edri.yzwx * edri.wxyz); + edr = LT( KA*wd1, wd2) * irlv1 * NOT(edri.yzwx * edri.wxyz); edr_l = LTE( lv2_cf * d_fg, d_hc ) * irlv2l * edr * (NOT(edri.yzwx) * eq(e, c)); edr_u = LTE( lv2_cf * d_hc, d_fg ) * irlv2u * edr * (NOT(edri.wxyz) * eq(e, g)); diff --git a/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang b/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang index e1b8245..a187fa4 100644 --- a/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang +++ b/xbr/shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang @@ -96,7 +96,7 @@ layout(location = 2) in vec4 t2; layout(location = 3) in float aa_factor; 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 XbrSource; // Return if A components are less than or equal B ones. vec4 LTE(vec4 A, vec4 B) @@ -173,11 +173,11 @@ void main() vec2 fp = fract(vTexCoord*global.SourceSize.xy); - vec3 B = texture(Original, t1.xy).rgb; - vec3 D = texture(Original, t2.xw).rgb; - vec3 E = texture(Original, t2.yw).rgb; - vec3 F = texture(Original, t2.zw).rgb; - vec3 H = texture(Original, t1.xw).rgb; + vec3 B = texture(XbrSource, t1.xy).rgb; + vec3 D = texture(XbrSource, t2.xw).rgb; + vec3 E = texture(XbrSource, t2.yw).rgb; + vec3 F = texture(XbrSource, t2.zw).rgb; + vec3 H = texture(XbrSource, t1.xw).rgb; mat4x3 e = mat4x3(E, E, E, E); mat4x3 f = mat4x3(F, B, D, H); diff --git a/xbr/shaders/xbr-lv2.slang b/xbr/shaders/xbr-lv2-standalone.slang similarity index 100% rename from xbr/shaders/xbr-lv2.slang rename to xbr/shaders/xbr-lv2-standalone.slang diff --git a/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang b/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang index ce1bdab..8958ba0 100644 --- a/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +++ b/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang @@ -29,15 +29,24 @@ layout(push_constant) uniform Push { + float SMALL_DETAILS; + float WP4; + float KA; float XBR_EQ_THRESHOLD; - float XBR_LV2_COEFFICIENT; + float FD; } params; -#pragma parameter XBR_EQ_THRESHOLD "COLOR DISTINCTION THRESHOLD" 0.32 0.0 1.0 0.01 -#pragma parameter XBR_LV2_COEFFICIENT "SMOOTHNESS THRESHOLD" 0.3 0.0 1.0 0.1 +#pragma parameter SMALL_DETAILS "XBR - MODE (VANILLA | SMALL DETAILS)" 0.0 0.0 1.0 1.0 +#pragma parameter WP4 "XBR - SMOOTHNESS LOCAL WEIGHT" 1.0 0.0 1.0 0.2 +#pragma parameter KA "XBR - SMOOTHNESS THRESHOLD" 1.0 0.0 1.0 0.05 +#pragma parameter XBR_EQ_THRESHOLD "XBR - COLOR DISTINCTION THRESHOLD" 0.26 0.0 1.0 0.01 +#pragma parameter FD "XBR - DITHERING/SMOOTHNESS COMPROMISE (MEDIUM | HIGH)" 0.0 0.0 1.0 1.0 -#define XBR_EQ_THRESHOLD params.XBR_EQ_THRESHOLD -#define XBR_LV2_COEFFICIENT params.XBR_LV2_COEFFICIENT +#define SMALL_DETAILS params.SMALL_DETAILS +#define WP4 (5.0*params.WP4) +#define KA (6.0-5.0*params.KA) +#define XBR_EQ_THRESHOLD params.XBR_EQ_THRESHOLD +#define FD (1.0-params.FD) layout(std140, set = 0, binding = 0) uniform UBO { @@ -53,7 +62,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #define CORNER_C #define XBR_EQ_THRESHOLD2 0.02 -#define lv2_cf (XBR_LV2_COEFFICIENT + 2.0) +#define lv2_cf 2.4 #define saturate(c) clamp(c, 0.0, 1.0) #define round(X) floor((X)+0.5) @@ -63,6 +72,7 @@ const vec4 zip2 = vec4( 16.0, 32.0, 64.0, 128.0); const vec4 low = vec4( 0.0, 0.0, 0.0, 0.0); const vec4 high = vec4(255.0, 255.0, 255.0, 255.0); const vec3 Y = vec3(0.2627, 0.6780, 0.0593); +const vec3 Ysd = vec3( 0.299, 0.587, 0.114); #pragma stage vertex layout(location = 0) in vec4 Position; @@ -173,10 +183,18 @@ vec4 neq(mat4x3 A, mat4x3 B) // Calculate weighted distance among pixels in some directions. vec4 weighted_distance(mat4x3 a, mat4x3 b, mat4x3 c, mat4x3 d, mat4x3 e, mat4x3 f, mat4x3 g, mat4x3 h) { - return (dist4(a,b) + dist4(a,c) + dist4(d,e) + dist4(d,f) + 4.0*dist4(g,h)); + if (SMALL_DETAILS < 0.5) + { + return ( FD * ( dist4(a,b) + dist4(a,c)) * (dist4(d,e) + dist4(d,f) ) + WP4 * dist4(g,h) ); + } + else + { + return ( FD * ( dist4(a,b) + dist4(a,c) + dist4(d,e) + dist4(d,f) - dist4(c,e) - dist4(b,f) ) + WP4 * dist4(g,h) ); + } } + void main() { vec4 edri, edr, edr_l, edr_u, edr3_l, edr3_u; // edr = edge detection rule, l = left, u = up. @@ -276,7 +294,7 @@ void main() vec4 d_hc = dist4(h, c); edri = LTE(wd1, wd2) * irlv0; - edr = LT( wd1, wd2) * irlv1 * NOT(edri.yzwx * edri.wxyz); + edr = LT( KA*wd1, wd2) * irlv1 * NOT(edri.yzwx * edri.wxyz); edr_l = LTE( lv2_cf * d_fg, d_hc ) * irlv2l * edr * (NOT(edri.yzwx) * eq(e, c)); edr_u = LTE( lv2_cf * d_hc, d_fg ) * irlv2u * edr * (NOT(edri.wxyz) * eq(e, g)); edr3_l = irlv3l * edr_l; diff --git a/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang b/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang index f44c194..2fae128 100644 --- a/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang +++ b/xbr/shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang @@ -103,7 +103,7 @@ layout(location = 2) in vec4 t2; layout(location = 3) in float aa_factor; 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 XbrSource; // Return if A components are less than or equal B ones. vec4 LTE(vec4 A, vec4 B) @@ -180,11 +180,11 @@ void main() vec2 fp = fract(vTexCoord*global.SourceSize.xy); - vec3 B = texture(Original, t1.xy).rgb; - vec3 D = texture(Original, t2.xw).rgb; - vec3 E = texture(Original, t2.yw).rgb; - vec3 F = texture(Original, t2.zw).rgb; - vec3 H = texture(Original, t1.xw).rgb; + vec3 B = texture(XbrSource, t1.xy).rgb; + vec3 D = texture(XbrSource, t2.xw).rgb; + vec3 E = texture(XbrSource, t2.yw).rgb; + vec3 F = texture(XbrSource, t2.zw).rgb; + vec3 H = texture(XbrSource, t1.xw).rgb; mat4x3 e = mat4x3(E, E, E, E); mat4x3 f = mat4x3(F, B, D, H); diff --git a/xbr/shaders/xbr-lv3.slang b/xbr/shaders/xbr-lv3-standalone.slang similarity index 100% rename from xbr/shaders/xbr-lv3.slang rename to xbr/shaders/xbr-lv3-standalone.slang diff --git a/xbr/super-xbr-2p.slangp b/xbr/super-xbr-2p.slangp deleted file mode 100644 index 7bc9c2b..0000000 --- a/xbr/super-xbr-2p.slangp +++ /dev/null @@ -1,16 +0,0 @@ -shaders = "3" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = false -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = false -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -shader2 = "shaders/super-xbr/custom-jinc2-sharper.slang" -filter_linear2 = false - diff --git a/xbr/super-xbr-3p-smoother.slangp b/xbr/super-xbr-3p-smoother.slangp deleted file mode 100644 index de2ba17..0000000 --- a/xbr/super-xbr-3p-smoother.slangp +++ /dev/null @@ -1,22 +0,0 @@ -shaders = "4" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = false -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = false -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -shader2 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear2 = false -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "shaders/super-xbr/custom-jinc2-sharper.slang" -filter_linear3 = false - diff --git a/xbr/super-xbr-6p-adaptive.slangp b/xbr/super-xbr-6p-adaptive.slangp deleted file mode 100644 index 01f37a1..0000000 --- a/xbr/super-xbr-6p-adaptive.slangp +++ /dev/null @@ -1,44 +0,0 @@ -shaders = "7" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = false -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = false -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -alias2 = "PassPrev2" -shader2 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear2 = false -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear3 = false -scale_type_x3 = "source" -scale_x3 = "1.000000" -scale_type_y3 = "source" -scale_y3 = "1.000000" -shader4 = "shaders/super-xbr/super-xbr-pass1b.slang" -filter_linear4 = false -scale_type_x4 = "source" -scale_x4 = "2.000000" -scale_type_y4 = "source" -scale_y4 = "2.000000" -shader5 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear5 = false -scale_type_x5 = "source" -scale_x5 = "1.000000" -scale_type_y5 = "source" -scale_y5 = "1.000000" -shader6 = "shaders/super-xbr/custom-jinc2-sharper.slang" -filter_linear6 = false - -parameters = "MODE;XBR_EDGE_STR" -MODE = "2.0" -XBR_EDGE_STR = "2.0" diff --git a/xbr/super-xbr-6p-anime4k.slangp b/xbr/super-xbr-6p-anime4k.slangp deleted file mode 100755 index d14d209..0000000 --- a/xbr/super-xbr-6p-anime4k.slangp +++ /dev/null @@ -1,127 +0,0 @@ -shaders = "11" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = "false" -wrap_mode0 = "clamp_to_border" -mipmap_input0 = "false" -alias0 = "" -float_framebuffer0 = "false" -srgb_framebuffer0 = "false" -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = "false" -wrap_mode1 = "clamp_to_border" -mipmap_input1 = "false" -alias1 = "" -float_framebuffer1 = "false" -srgb_framebuffer1 = "false" -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -shader2 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear2 = "false" -wrap_mode2 = "clamp_to_border" -mipmap_input2 = "false" -alias2 = "PassPrev2" -float_framebuffer2 = "false" -srgb_framebuffer2 = "false" -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear3 = "false" -wrap_mode3 = "clamp_to_border" -mipmap_input3 = "false" -alias3 = "" -float_framebuffer3 = "false" -srgb_framebuffer3 = "false" -scale_type_x3 = "source" -scale_x3 = "1.000000" -scale_type_y3 = "source" -scale_y3 = "1.000000" -shader4 = "shaders/super-xbr/super-xbr-pass3.slang" -filter_linear4 = "false" -wrap_mode4 = "clamp_to_border" -mipmap_input4 = "false" -alias4 = "" -float_framebuffer4 = "false" -srgb_framebuffer4 = "false" -scale_type_x4 = "source" -scale_x4 = "2.000000" -scale_type_y4 = "source" -scale_y4 = "2.000000" -shader5 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear5 = "false" -wrap_mode5 = "clamp_to_border" -mipmap_input5 = "false" -alias5 = "" -float_framebuffer5 = "false" -srgb_framebuffer5 = "false" -scale_type_x5 = "source" -scale_x5 = "1.000000" -scale_type_y5 = "source" -scale_y5 = "1.000000" -shader6 = "../cubic/shaders/catmull-rom-fast.slang" -filter_linear6 = "true" -wrap_mode6 = "clamp_to_border" -mipmap_input6 = "false" -alias6 = "" -float_framebuffer6 = "false" -srgb_framebuffer6 = "false" -scale_type_x6 = "viewport" -scale_type_y6 = "viewport" -shader7 = "../sharpen/shaders/anime4k/anime4k-compute-lum.slang" -filter_linear7 = "false" -wrap_mode7 = "clamp_to_border" -mipmap_input7 = "false" -alias7 = "" -float_framebuffer7 = "false" -srgb_framebuffer7 = "false" -scale_type_x7 = "source" -scale_x7 = "1.000000" -scale_type_y7 = "source" -scale_y7 = "1.000000" -shader8 = "../sharpen/shaders/anime4k/anime4k-push.slang" -filter_linear8 = "false" -wrap_mode8 = "clamp_to_border" -mipmap_input8 = "false" -alias8 = "" -float_framebuffer8 = "false" -srgb_framebuffer8 = "false" -scale_type_x8 = "source" -scale_x8 = "1.000000" -scale_type_y8 = "source" -scale_y8 = "1.000000" -shader9 = "../sharpen/shaders/anime4k/anime4k-compute-gradient.slang" -filter_linear9 = "false" -wrap_mode9 = "clamp_to_border" -mipmap_input9 = "false" -alias9 = "" -float_framebuffer9 = "false" -srgb_framebuffer9 = "false" -scale_type_x9 = "source" -scale_x9 = "1.000000" -scale_type_y9 = "source" -scale_y9 = "1.000000" -shader10 = "../sharpen/shaders/anime4k/anime4k-pushgrad-weak.slang" -filter_linear10 = "false" -wrap_mode10 = "clamp_to_border" -mipmap_input10 = "false" -alias10 = "" -float_framebuffer10 = "false" -srgb_framebuffer10 = "false" -scale_type_x10 = "source" -scale_x10 = "1.000000" -scale_type_y10 = "source" -scale_y10 = "1.000000" -parameters = "MODE;XBR_EDGE_STR;XBR_WEIGHT;XBR_ANTI_RINGING;XBR_EDGE_STR;XBR_WEIGHT;XBR_ANTI_RINGING;STRENGTH_PUSH;STRENGTH_GRAD" -MODE = "1.0" -XBR_EDGE_STR = "5.000000" -XBR_WEIGHT = "1.000000" -XBR_ANTI_RINGING = "1.000000" -STRENGTH_PUSH = "0.300000" -STRENGTH_GRAD = "0.300000" diff --git a/xbr/super-xbr-6p-small-details.slangp b/xbr/super-xbr-6p-small-details.slangp deleted file mode 100644 index 8939d8a..0000000 --- a/xbr/super-xbr-6p-small-details.slangp +++ /dev/null @@ -1,44 +0,0 @@ -shaders = "7" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = false -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = false -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -alias2 = "PassPrev2" -shader2 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear2 = false -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear3 = false -scale_type_x3 = "source" -scale_x3 = "1.000000" -scale_type_y3 = "source" -scale_y3 = "1.000000" -shader4 = "shaders/super-xbr/super-xbr-pass1b.slang" -filter_linear4 = false -scale_type_x4 = "source" -scale_x4 = "2.000000" -scale_type_y4 = "source" -scale_y4 = "2.000000" -shader5 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear5 = false -scale_type_x5 = "source" -scale_x5 = "1.000000" -scale_type_y5 = "source" -scale_y5 = "1.000000" -shader6 = "shaders/super-xbr/custom-jinc2-sharper.slang" -filter_linear6 = false - -parameters = "MODE;XBR_EDGE_STR" -MODE = "1.0" -XBR_EDGE_STR = "5.0" diff --git a/xbr/super-xbr-6p.slangp b/xbr/super-xbr-6p.slangp deleted file mode 100644 index fa09aa6..0000000 --- a/xbr/super-xbr-6p.slangp +++ /dev/null @@ -1,41 +0,0 @@ -shaders = "7" -shader0 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear0 = false -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "shaders/super-xbr/super-xbr-pass1.slang" -filter_linear1 = false -scale_type_x1 = "source" -scale_x1 = "2.000000" -scale_type_y1 = "source" -scale_y1 = "2.000000" -alias2 = "PassPrev2" -shader2 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear2 = false -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "shaders/super-xbr/super-xbr-pass0.slang" -filter_linear3 = false -scale_type_x3 = "source" -scale_x3 = "1.000000" -scale_type_y3 = "source" -scale_y3 = "1.000000" -shader4 = "shaders/super-xbr/super-xbr-pass1b.slang" -filter_linear4 = false -scale_type_x4 = "source" -scale_x4 = "2.000000" -scale_type_y4 = "source" -scale_y4 = "2.000000" -shader5 = "shaders/super-xbr/super-xbr-pass2.slang" -filter_linear5 = false -scale_type_x5 = "source" -scale_x5 = "1.000000" -scale_type_y5 = "source" -scale_y5 = "1.000000" -shader6 = "shaders/super-xbr/custom-jinc2-sharper.slang" -filter_linear6 = false - diff --git a/xbr/super-xbr-deposterize.slangp b/xbr/super-xbr-deposterize.slangp deleted file mode 100644 index cb78a5f..0000000 --- a/xbr/super-xbr-deposterize.slangp +++ /dev/null @@ -1,82 +0,0 @@ -shaders = "6" -shader0 = "..\misc\deposterize-pass0.slang" -filter_linear0 = "false" -wrap_mode0 = "clamp_to_border" -mipmap_input0 = "false" -alias0 = "" -float_framebuffer0 = "false" -srgb_framebuffer0 = "false" -scale_type_x0 = "source" -scale_x0 = "1.000000" -scale_type_y0 = "source" -scale_y0 = "1.000000" -shader1 = "..\misc\deposterize-pass1.slang" -filter_linear1 = "false" -wrap_mode1 = "clamp_to_border" -mipmap_input1 = "false" -alias1 = "" -float_framebuffer1 = "false" -srgb_framebuffer1 = "false" -scale_type_x1 = "source" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" -shader2 = "..\xbr\shaders\super-xbr\super-xbr-pass0.slang" -filter_linear2 = "false" -wrap_mode2 = "clamp_to_border" -mipmap_input2 = "false" -alias2 = "" -float_framebuffer2 = "false" -srgb_framebuffer2 = "false" -scale_type_x2 = "source" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" -shader3 = "..\xbr\shaders\super-xbr\super-xbr-pass1.slang" -filter_linear3 = "false" -wrap_mode3 = "clamp_to_border" -mipmap_input3 = "false" -alias3 = "" -float_framebuffer3 = "false" -srgb_framebuffer3 = "false" -scale_type_x3 = "source" -scale_x3 = "2.000000" -scale_type_y3 = "source" -scale_y3 = "2.000000" -shader4 = "..\xbr\shaders\super-xbr\super-xbr-pass2.slang" -filter_linear4 = "false" -wrap_mode4 = "clamp_to_border" -mipmap_input4 = "false" -alias4 = "" -float_framebuffer4 = "false" -srgb_framebuffer4 = "false" -scale_type_x4 = "source" -scale_x4 = "1.000000" -scale_type_y4 = "source" -scale_y4 = "1.000000" -shader5 = "..\xbr\shaders\super-xbr\custom-jinc2-sharper.slang" -filter_linear5 = "false" -wrap_mode5 = "clamp_to_border" -mipmap_input5 = "false" -alias5 = "" -float_framebuffer5 = "false" -srgb_framebuffer5 = "false" -parameters = "EQ_THRESH1;DIFF_THRESH1;EQ_THRESH2;DIFF_THRESH2;XBR_EDGE_STR;XBR_HV_EDGE_STR;XBR_WEIGHT;XBR_WEIGHT2;XBR_ANTI_RINGING;WP1;WP2;WP3;WP4;WP5;WP6;JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH" -EQ_THRESH1 = "0.010000" -DIFF_THRESH1 = "0.060000" -EQ_THRESH2 = "0.010000" -DIFF_THRESH2 = "0.060000" -XBR_EDGE_STR = "2.000000" -XBR_HV_EDGE_STR = "2.000000" -XBR_WEIGHT = "1.000000" -XBR_WEIGHT2 = "1.000000" -XBR_ANTI_RINGING = "0.000000" -WP1 = "2.000000" -WP2 = "1.000000" -WP3 = "-1.000000" -WP4 = "4.000000" -WP5 = "-1.000000" -WP6 = "1.000000" -JINC2_WINDOW_SINC = "0.420000" -JINC2_SINC = "0.920000" -JINC2_AR_STRENGTH = "0.000000" diff --git a/xbr/super-xbr-fast.slangp b/xbr/super-xbr-fast.slangp new file mode 100644 index 0000000..2718823 --- /dev/null +++ b/xbr/super-xbr-fast.slangp @@ -0,0 +1,37 @@ +shaders = "7" + +shader0 = "shaders/support/linearize.slang" +filter_linear0 = false +scale_type0 = "source" +scale0 = "1.000000" +alias0 = XbrSource + +shader1 = "shaders/super-xbr/super-xbr-fast-pass0.slang" +filter_linear1 = false +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = "shaders/super-xbr/super-xbr-fast-pass1.slang" +filter_linear2 = false +scale_type2 = "source" +scale2 = "2.000000" + +shader3 = "shaders/super-xbr/super-xbr-fast-pass2.slang" +filter_linear3 = false +scale_type3 = "source" +scale3 = "1.000000" + +shader4 = "shaders/support/spline16-x.slang" +filter_linear4 = false +scale_type_x4 = "viewport" +scale_type_y4 = "source" +scale4 = "1.000000" + +shader5 = "shaders/support/spline16-y.slang" +filter_linear5 = false +scale_type5 = "viewport" +scale5 = "1.000000" + +shader6 = "shaders/support/delinearize.slang" +filter_linear6 = false + diff --git a/xbr/super-xbr.slangp b/xbr/super-xbr.slangp new file mode 100644 index 0000000..5180a8e --- /dev/null +++ b/xbr/super-xbr.slangp @@ -0,0 +1,37 @@ +shaders = "7" + +shader0 = "shaders/support/linearize.slang" +filter_linear0 = false +scale_type0 = "source" +scale0 = "1.000000" +alias0 = XbrSource + +shader1 = "shaders/super-xbr/super-xbr-pass0.slang" +filter_linear1 = false +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = "shaders/super-xbr/super-xbr-pass1.slang" +filter_linear2 = false +scale_type2 = "source" +scale2 = "2.000000" + +shader3 = "shaders/super-xbr/super-xbr-pass2.slang" +filter_linear3 = false +scale_type3 = "source" +scale3 = "1.000000" + +shader4 = "shaders/support/spline16-x.slang" +filter_linear4 = false +scale_type_x4 = "viewport" +scale_type_y4 = "source" +scale4 = "1.000000" + +shader5 = "shaders/support/spline16-y.slang" +filter_linear5 = false +scale_type5 = "viewport" +scale5 = "1.000000" + +shader6 = "shaders/support/delinearize.slang" +filter_linear6 = false + diff --git a/xbr/xbr-lv1.slangp b/xbr/xbr-lv1.slangp deleted file mode 100644 index 68b5e2f..0000000 --- a/xbr/xbr-lv1.slangp +++ /dev/null @@ -1,4 +0,0 @@ -shaders = 1 - -shader0 = "shaders/xbr-lv1.slang" -filter_linear0 = false diff --git a/xbr/xbr-lv2-3d.slangp b/xbr/xbr-lv2-3d.slangp deleted file mode 100644 index 5180dc9..0000000 --- a/xbr/xbr-lv2-3d.slangp +++ /dev/null @@ -1,4 +0,0 @@ -shaders = 1 - -shader0 = shaders/xbr-lv2-3d.slang -filter_linear0 = false \ No newline at end of file diff --git a/xbr/xbr-lv2-multipass.slangp b/xbr/xbr-lv2-multipass.slangp deleted file mode 100644 index 0909dec..0000000 --- a/xbr/xbr-lv2-multipass.slangp +++ /dev/null @@ -1,10 +0,0 @@ -shaders = "2" -shader0 = shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang -scale_type0 = "source" -scale0 = "1.000000" - -shader1 = shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang - -filter_linear0 = "false" -filter_linear1 = "false" - diff --git a/xbr/xbr-lv2-sharp.slangp b/xbr/xbr-lv2-sharp.slangp new file mode 100644 index 0000000..9e137af --- /dev/null +++ b/xbr/xbr-lv2-sharp.slangp @@ -0,0 +1,43 @@ +shaders = "6" + +shader0 = shaders/support/linearize.slang +scale_type0 = "source" +scale0 = "1.000000" +filter_linear0 = "false" +alias0 = XbrSource + +shader1 = shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang +scale_type1 = "source" +scale1 = "1.000000" +filter_linear1 = "false" + +shader2 = shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang +scale_type2 = "source" +scale2 = "4.000000" +filter_linear2 = "false" + + +shader3 = shaders/support/b-spline-x.slang +filter_linear3 = false +scale_type_x3 = viewport +scale_type_y3 = source +scale3 = 1.0 + +shader4 = shaders/support/b-spline-y.slang +filter_linear4 = false +scale_type4 = viewport +scale4 = 1.0 + + +shader5 = shaders/support/delinearize.slang +scale_type5 = "source" +scale5 = "1.000000" +filter_linear5 = "false" + + +parameters = "SMALL_DETAILS;WP4;KA" + +SMALL_DETAILS = "1.0" +WP4 = "0.8" +KA = "0.35" + diff --git a/xbr/xbr-lv2-small-details.slangp b/xbr/xbr-lv2-small-details.slangp deleted file mode 100644 index 508d2db..0000000 --- a/xbr/xbr-lv2-small-details.slangp +++ /dev/null @@ -1,21 +0,0 @@ -shaders = "3" -shader0 = shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang -scale_type0 = "source" -scale0 = "1.000000" - -shader1 = shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang -scale_type1 = "source" -scale1 = "3.000000" - -shader2 = "shaders/support/b-spline.slang" -filter_linear2 = false - -filter_linear0 = "false" -filter_linear1 = "false" - -parameters = "XBR_LV2_COEFFICIENT;XBR_EQ_THRESHOLD;SMALL_DETAILS" - -XBR_LV2_COEFFICIENT = "0.0 -XBR_EQ_THRESHOLD = "0.22" -SMALL_DETAILS = "1.0" - diff --git a/xbr/xbr-lv2.slangp b/xbr/xbr-lv2.slangp index 36d4329..d01d415 100644 --- a/xbr/xbr-lv2.slangp +++ b/xbr/xbr-lv2.slangp @@ -1,4 +1,43 @@ -shaders = 1 +shaders = "6" + +shader0 = shaders/support/linearize.slang +scale_type0 = "source" +scale0 = "1.000000" +filter_linear0 = "false" +alias0 = XbrSource + +shader1 = shaders/xbr-lv2-multipass/xbr-lv2-pass0.slang +scale_type1 = "source" +scale1 = "1.000000" +filter_linear1 = "false" + +shader2 = shaders/xbr-lv2-multipass/xbr-lv2-pass1.slang +scale_type2 = "source" +scale2 = "3.000000" +filter_linear2 = "false" + + +shader3 = shaders/support/b-spline-x.slang +filter_linear3 = false +scale_type_x3 = viewport +scale_type_y3 = source +scale3 = 1.0 + +shader4 = shaders/support/b-spline-y.slang +filter_linear4 = false +scale_type4 = viewport +scale4 = 1.0 + + +shader5 = shaders/support/delinearize.slang +scale_type5 = "source" +scale5 = "1.000000" +filter_linear5 = "false" + + +parameters = "SMALL_DETAILS;WP4;KA" + +SMALL_DETAILS = "1.0" +WP4 = "0.8" +KA = "0.35" -shader0 = "shaders/xbr-lv2.slang" -filter_linear0 = false diff --git a/xbr/xbr-lv3-9x-multipass.slangp b/xbr/xbr-lv3-9x-multipass.slangp deleted file mode 100644 index b60198f..0000000 --- a/xbr/xbr-lv3-9x-multipass.slangp +++ /dev/null @@ -1,29 +0,0 @@ -shaders = "5" - -shader0 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang -filter_linear0 = "false" -scale_type0 = "source" -scale0 = "1.000000" - -shader1 = shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang -filter_linear1 = "false" -scale_type1 = "source" -scale1 = "3.000000" -alias1 = xbr3x - -shader2 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang -filter_linear2 = "false" -scale_type2 = "source" -scale2 = "1.000000" - -shader3 = shaders/xbr-lv3-multipass/xbr-lv3-pass1b.slang -filter_linear3 = "false" -scale_type3 = "source" -scale3 = "3.000000" - -shader4 = "shaders/support/b-spline.slang" -filter_linear4 = false - -parameters = "XBR_BLENDING" - -XBR_BLENDING = "0.0" diff --git a/xbr/xbr-lv3-9x.slangp b/xbr/xbr-lv3-9x.slangp deleted file mode 100644 index 4fb9437..0000000 --- a/xbr/xbr-lv3-9x.slangp +++ /dev/null @@ -1,20 +0,0 @@ -shaders = 3 - -shader0 = shaders/xbr-lv3.slang -filter_linear0 = false -scale_type0 = "source" -scale0 = "3.000000" - -shader1 = shaders/xbr-lv3.slang -filter_linear1 = false -scale_type1 = "source" -scale1 = "3.000000" - - -shader2 = "shaders/support/b-spline.slang" -filter_linear2 = false - -parameters = "XBR_BLENDING" - -XBR_BLENDING = "0.0" - diff --git a/xbr/xbr-lv3-multipass.slangp b/xbr/xbr-lv3-multipass.slangp deleted file mode 100644 index 057f083..0000000 --- a/xbr/xbr-lv3-multipass.slangp +++ /dev/null @@ -1,15 +0,0 @@ -shaders = "3" -shader0 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang -scale_type0 = "source" -scale0 = "1.000000" - -shader1 = shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang -scale_type1 = "source" -scale1 = "3.000000" - -shader2 = "shaders/support/b-spline.slang" -filter_linear2 = false - -filter_linear0 = "false" -filter_linear1 = "false" - diff --git a/xbr/xbr-lv3-sharp.slangp b/xbr/xbr-lv3-sharp.slangp new file mode 100644 index 0000000..cbfe698 --- /dev/null +++ b/xbr/xbr-lv3-sharp.slangp @@ -0,0 +1,52 @@ +shaders = "8" + +shader0 = shaders/support/linearize.slang +scale_type0 = "source" +scale0 = "1.000000" +filter_linear0 = "false" +alias0 = XbrSource + +shader1 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +filter_linear1 = "false" +scale_type1 = "source" +scale1 = "1.000000" + +shader2 = shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang +filter_linear2 = "false" +scale_type2 = "source" +scale2 = "3.000000" +alias2 = xbr3x + +shader3 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +filter_linear3 = "false" +scale_type3 = "source" +scale3 = "1.000000" + +shader4 = shaders/xbr-lv3-multipass/xbr-lv3-pass1b.slang +filter_linear4 = "false" +scale_type4 = "source" +scale4 = "3.000000" + +shader5 = shaders/support/b-spline-x.slang +filter_linear5 = false +scale_type_x5 = viewport +scale_type_y5 = source +scale5 = 1.0 + +shader6 = shaders/support/b-spline-y.slang +filter_linear6 = false +scale_type6 = viewport +scale6 = 1.0 + + +shader7 = shaders/support/delinearize.slang +scale_type7 = "source" +scale7 = "1.000000" +filter_linear7 = "false" + + +parameters = "SMALL_DETAILS;KA;XBR_EQ_THRESHOLD" + +SMALL_DETAILS = "1.0" +KA = "0.35" +XBR_EQ_THRESHOLD = "0.22" diff --git a/xbr/xbr-lv3.slangp b/xbr/xbr-lv3.slangp index 927572a..623d3e2 100644 --- a/xbr/xbr-lv3.slangp +++ b/xbr/xbr-lv3.slangp @@ -1,10 +1,43 @@ -shaders = 2 +shaders = "6" -shader0 = shaders/xbr-lv3.slang -filter_linear0 = false +shader0 = shaders/support/linearize.slang scale_type0 = "source" -scale0 = "3.000000" +scale0 = "1.000000" +filter_linear0 = "false" +alias0 = XbrSource -shader1 = "shaders/support/b-spline.slang" -filter_linear1 = false +shader1 = shaders/xbr-lv3-multipass/xbr-lv3-pass0.slang +scale_type1 = "source" +scale1 = "1.000000" +filter_linear1 = "false" + +shader2 = shaders/xbr-lv3-multipass/xbr-lv3-pass1.slang +scale_type2 = "source" +scale2 = "3.000000" +filter_linear2 = "false" + + +shader3 = shaders/support/b-spline-x.slang +filter_linear3 = false +scale_type_x3 = viewport +scale_type_y3 = source +scale3 = 1.0 + +shader4 = shaders/support/b-spline-y.slang +filter_linear4 = false +scale_type4 = viewport +scale4 = 1.0 + + +shader5 = shaders/support/delinearize.slang +scale_type5 = "source" +scale5 = "1.000000" +filter_linear5 = "false" + + +parameters = "SMALL_DETAILS;WP4;KA" + +SMALL_DETAILS = "1.0" +WP4 = "0.8" +KA = "0.22"