add sharpsmoother, aa-shader-4.0-level2 shaders and presets

This commit is contained in:
hunterk 2017-06-14 10:26:50 -05:00
parent 046904ea99
commit f0bcd4ad50
6 changed files with 407 additions and 0 deletions

View file

@ -0,0 +1,15 @@
shaders = 2
shader0 = shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass1.slang
filter_linear0 = false
scale_type0 = source
scale0 = 2.0
shader1 = shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass2.slang
filter_linear1 = false
scale_type1 = source
scale1 = 2.0
shader2 = ../sharpen/shaders/adaptive-sharpen.slang
filter_linear2 = false
scale_type_2 = source

View file

@ -0,0 +1,99 @@
#version 450
/*
Copyright (C) 2016 guest(r) - guest.r@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 AAOFFSET;
} params;
#pragma parameter AAOFFSET "AA offset first pass" 1.0 0.25 2.0 0.05
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 * 1.000001;
}
#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()
{
vec2 tex = vTexCoord;
vec2 texsize = params.SourceSize.xy;
float dx = params.AAOFFSET/texsize.x;
float dy = params.AAOFFSET/texsize.y;
vec3 dt = vec3(1.0, 1.0, 1.0);
vec4 yx = vec4 ( dx, dy, -dx, -dy);
vec4 xh = yx*vec4(4.0,1.5,4.0,1.5);
vec4 yv = yx*vec4(1.5,4.0,1.5,4.0);
vec3 c11 = texture(Source, tex ).xyz;
vec3 s00 = texture(Source, tex + yx.zw).xyz;
vec3 s20 = texture(Source, tex + yx.xw).xyz;
vec3 s22 = texture(Source, tex + yx.xy).xyz;
vec3 s02 = texture(Source, tex + yx.zy).xyz;
vec3 h00 = texture(Source, tex + xh.zw).xyz;
vec3 h20 = texture(Source, tex + xh.xw).xyz;
vec3 h22 = texture(Source, tex + xh.xy).xyz;
vec3 h02 = texture(Source, tex + xh.zy).xyz;
vec3 v00 = texture(Source, tex + yv.zw).xyz;
vec3 v20 = texture(Source, tex + yv.xw).xyz;
vec3 v22 = texture(Source, tex + yv.xy).xyz;
vec3 v02 = texture(Source, tex + yv.zy).xyz;
float m1=1.0/(dot(abs(s00-s22),dt)+0.00001);
float m2=1.0/(dot(abs(s02-s20),dt)+0.00001);
float h1=1.0/(dot(abs(s00-h22),dt)+0.00001);
float h2=1.0/(dot(abs(s02-h20),dt)+0.00001);
float h3=1.0/(dot(abs(h00-s22),dt)+0.00001);
float h4=1.0/(dot(abs(h02-s20),dt)+0.00001);
float v1=1.0/(dot(abs(s00-v22),dt)+0.00001);
float v2=1.0/(dot(abs(s02-v20),dt)+0.00001);
float v3=1.0/(dot(abs(v00-s22),dt)+0.00001);
float v4=1.0/(dot(abs(v02-s20),dt)+0.00001);
vec3 t1 = 0.5*(m1*(s00+s22)+m2*(s02+s20))/(m1+m2);
vec3 t2 = 0.5*(h1*(s00+h22)+h2*(s02+h20)+h3*(h00+s22)+h4*(h02+s20))/(h1+h2+h3+h4);
vec3 t3 = 0.5*(v1*(s00+v22)+v2*(s02+v20)+v3*(v00+s22)+v4*(v02+s20))/(v1+v2+v3+v4);
float k1 = 1.0/(dot(abs(t1-c11),dt)+0.00001);
float k2 = 1.0/(dot(abs(t2-c11),dt)+0.00001);
float k3 = 1.0/(dot(abs(t3-c11),dt)+0.00001);
FragColor = vec4((k1*t1 + k2*t2 + k3*t3)/(k1+k2+k3),1.0);
}

View file

@ -0,0 +1,74 @@
#version 450
/*
Copyright (C) 2007 guest(r) - guest.r@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 AAOFFSET2;
} params;
#pragma parameter AAOFFSET2 "AA offset second pass" 0.5 0.25 2.0 0.05
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 * 1.00001;
}
#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()
{
vec2 texsize = params.SourceSize.xy;
float dx = pow(texsize.x, -1.0) * params.AAOFFSET2;
float dy = pow(texsize.y, -1.0) * params.AAOFFSET2;
vec3 dt = vec3(1.0, 1.0, 1.0);
vec2 UL = vTexCoord.xy + vec2(-dx,-dy);
vec2 UR = vTexCoord.xy + vec2(dx,-dy);
vec2 DL = vTexCoord.xy + vec2(-dx, dy);
vec2 DR = vTexCoord.xy + vec2(dx, dy);
vec3 c00 = texture(Source, UL).xyz;
vec3 c20 = texture(Source, UR).xyz;
vec3 c02 = texture(Source, DL).xyz;
vec3 c22 = texture(Source, DR).xyz;
float m1=dot(abs(c00-c22),dt)+0.001;
float m2=dot(abs(c02-c20),dt)+0.001;
FragColor = vec4((m1*(c02+c20)+m2*(c22+c00))/(2.0*(m1+m2)),1.0);
}

112
blurs/sharpsmoother.slang Normal file
View file

@ -0,0 +1,112 @@
#version 450
/*
Sharpsmoother shader
Copyright (C) 2005-2017 guest(r) - guest.r@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 max_w;
float min_w;
float smoot;
float lumad;
float mtric;
} params;
#pragma parameter max_w "Max filter weight" 0.10 0.00 0.20 0.01
#pragma parameter min_w "Min filter weight" -0.07 -0.15 0.05 0.01
#pragma parameter smoot "Smoothing strength" 0.55 0.00 1.50 0.01
#pragma parameter lumad "Effects smoothing" 0.30 0.10 5.00 0.10
#pragma parameter mtric "The metric we use" 0.70 0.10 2.00 0.10
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
} global;
vec3 dt = vec3(1.0, 1.0, 1.0);
float wt(vec3 A, vec3 B)
{
return clamp(params.smoot - ((6.0+params.lumad)/pow(3.0,params.mtric))*pow(dot(pow(abs(A-B),vec3(1.0/params.mtric)),dt),params.mtric)/(dot(A+B,dt)+params.lumad), params.min_w, params.max_w);
}
#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;
float x = 1.0 * (1.0 / params.SourceSize.x);
float y = 1.0 * (1.0 / params.SourceSize.y);
vec2 dg1 = vec2( x, y);
vec2 dg2 = vec2(-x, y);
vec2 dx = vec2(x, 0.0);
vec2 dy = vec2(0.0, y);
t1 = vec4(vTexCoord.xy-dg1,vTexCoord.xy-dy);
t2 = vec4(vTexCoord.xy-dg2,vTexCoord.xy+dx);
t3 = vec4(vTexCoord.xy+dg1,vTexCoord.xy+dy);
t4 = vec4(vTexCoord.xy+dg2,vTexCoord.xy-dx);
}
#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 c00 = texture(Source, t1.xy).xyz;
vec3 c10 = texture(Source, t1.zw).xyz;
vec3 c20 = texture(Source, t2.xy).xyz;
vec3 c01 = texture(Source, t4.zw).xyz;
vec3 c11 = texture(Source, vTexCoord.xy).xyz;
vec3 c21 = texture(Source, t2.zw).xyz;
vec3 c02 = texture(Source, t4.xy).xyz;
vec3 c12 = texture(Source, t3.zw).xyz;
vec3 c22 = texture(Source, t3.xy).xyz;
float w10 = wt(c11,c10);
float w21 = wt(c11,c21);
float w12 = wt(c11,c12);
float w01 = wt(c11,c01);
float w00 = wt(c11,c00)*0.75;
float w22 = wt(c11,c22)*0.75;
float w20 = wt(c11,c20)*0.75;
float w02 = wt(c11,c02)*0.75;
FragColor = vec4(w10*c10+w21*c21+w12*c12+w01*c01+w00*c00+w22*c22+w20*c20+w02*c02+(1.0-w10-w21-w12-w01-w00-w22-w20-w02)*c11, 1.0);
}

View file

@ -0,0 +1,60 @@
shaders = 10
shader0 = ../windowed/shaders/jinc2.slang
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
shader1 = ../scalefx/shaders/scalefx-pass0.slang
filter_linear1 = false
scale_type1 = source
scale1 = 1.0
float_framebuffer1 = true
shader2 = ../scalefx/shaders/scalefx-pass1.slang
filter_linear2 = false
scale_type2 = source
scale2 = 1.0
float_framebuffer2 = true
shader3 = ../scalefx/shaders/scalefx-pass2.slang
filter_linear3 = false
scale_type3 = source
scale3 = 1.0
shader4 = ../scalefx/shaders/scalefx-pass3.slang
filter_linear4 = false
scale_type4 = source
scale4 = 1.0
shader5 = ../scalefx/shaders/scalefx-pass4.slang
filter_linear5 = false
scale_type5 = source
scale5 = 3.0
shader6 = ../blurs/sharpsmoother.slang
filter_linear6 = false
scale_type6 = source
scale6 = 1.0
shader7 = ../stock.slang
filter_linear7 = false
scale_type7 = source
scale7 = 2.0
shader8 = ../anti-aliasing/shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass1.slang
filter_linear8 = true
scale_type8 = source
scale8 = 1.0
shader9 = ../anti-aliasing/shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass2.slang
filter_linear9 = true
scale_type9 = source
scale9 = 1.0
parameters = "JINC2_AR_STRENGTH;JINC2_WINDOW_SINC;JINC2_SINC;SFX_SAA;SFX_CLR"
JINC2_AR_STRENGTH = 0.30
JINC2_WINDOW_SINC = 0.55
JINC2_SINC = 0.95
SFX_SAA = 0.00
SFX_CLR = 0.60

View file

@ -0,0 +1,47 @@
shaders = 8
shader0 = ../scalefx/shaders/scalefx-pass0.slang
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
float_framebuffer0 = true
shader1 = ../scalefx/shaders/scalefx-pass1.slang
filter_linear1 = false
scale_type1 = source
scale1 = 1.0
float_framebuffer1 = true
shader2 = ../scalefx/shaders/scalefx-pass2.slang
filter_linear2 = false
scale_type2 = source
scale2 = 1.0
shader3 = ../scalefx/shaders/scalefx-pass3.slang
filter_linear3 = false
scale_type3 = source
scale3 = 1.0
shader4 = ../scalefx/shaders/scalefx-pass4.slang
filter_linear4 = false
scale_type4 = source
scale4 = 3.0
shader5 = ../stock.slang
filter_linear5 = false
scale_type5 = source
scale5 = 2.0
shader6 = ../anti-aliasing/shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass1.slang
filter_linear6 = true
scale_type6 = source
scale6 = 1.0
shader7 = ../anti-aliasing/shaders/aa-shader-4.0-level2/aa-shader-4.0-level2-pass2.slang
filter_linear7 = true
scale_type7 = source
scale7 = 1.0
parameters = "SFX_CLR;SFX_SAA"
SFX_SAA = 0.00
SFX_CLR = 0.60