add Hyllian's fast-bilateral-3d shader and presets

This commit is contained in:
hunterk 2017-08-24 16:48:58 -05:00
parent d9c8bc4f7c
commit fb8ded7660
7 changed files with 372 additions and 0 deletions

View file

@ -0,0 +1,46 @@
shaders = "6"
shader0 = "shaders/fast-bilateral.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_edge"
scale_type_x2 = "source"
scale_x2 = "2.000000"
scale_type_y2 = "source"
scale_y2 = "2.000000"
shader3 = "../xbr/shaders/super-xbr/super-xbr-pass2.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_edge"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../windowed/shaders/jinc2.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_edge"
float_framebuffer4 = "false"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "0.500000"
shader5 = "../crt/shaders/crt-hyllian.slang"
filter_linear5 = "false"
wrap_mode5 = "clamp_to_edge"
float_framebuffer5 = "false"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,37 @@
shaders = "5"
shader0 = "shaders/fast-bilateral-3d.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../xbr/shaders/super-xbr/super-2xbr-3d-pass0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../xbr/shaders/super-xbr/super-2xbr-3d-pass1.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_edge"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "../xbr/shaders/super-xbr/super-2xbr-3d-pass2.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_edge"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../windowed/shaders/jinc2.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_edge"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,46 @@
shaders = "6"
shader0 = "shaders/fast-bilateral.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_edge"
scale_type_x2 = "source"
scale_x2 = "2.000000"
scale_type_y2 = "source"
scale_y2 = "2.000000"
shader3 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_edge"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_edge"
scale_type_x4 = "source"
scale_x4 = "2.000000"
scale_type_y4 = "source"
scale_y4 = "2.000000"
shader5 = "../windowed/shaders/jinc2.slang"
filter_linear5 = "false"
wrap_mode5 = "clamp_to_edge"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,61 @@
shaders = "8"
shader0 = "shaders/fast-bilateral.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_edge"
scale_type_x2 = "source"
scale_x2 = "2.000000"
scale_type_y2 = "source"
scale_y2 = "2.000000"
shader3 = "../xbr/shaders/super-xbr/super-xbr-pass2.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_edge"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_edge"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear5 = "false"
wrap_mode5 = "clamp_to_edge"
scale_type_x5 = "source"
scale_x5 = "2.000000"
scale_type_y5 = "source"
scale_y5 = "2.000000"
shader6 = "../xbr/shaders/super-xbr/super-xbr-pass2.slang"
filter_linear6 = "false"
wrap_mode6 = "clamp_to_edge"
scale_type_x6 = "source"
scale_x6 = "1.000000"
scale_type_y6 = "source"
scale_y6 = "1.000000"
shader7 = "../windowed/shaders/jinc2.slang"
filter_linear7 = "false"
wrap_mode7 = "clamp_to_edge"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,44 @@
shaders = "6"
shader0 = "shaders/fast-bilateral.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../misc/natural-vision.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
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_edge"
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_edge"
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_edge"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "../windowed/shaders/jinc2.slang"
filter_linear5 = "false"
wrap_mode5 = "clamp_to_edge"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,37 @@
shaders = "5"
shader0 = "shaders/fast-bilateral.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_edge"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../xbr/shaders/super-xbr/super-xbr-pass0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_edge"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../xbr/shaders/super-xbr/super-xbr-pass1.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_edge"
scale_type_x2 = "source"
scale_x2 = "2.000000"
scale_type_y2 = "source"
scale_y2 = "2.000000"
shader3 = "../xbr/shaders/super-xbr/super-xbr-pass2.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_edge"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../windowed/shaders/jinc2.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_edge"
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.42
JINC2_SINC = 0.92
JINC2_AR_STRENGTH = 0.8

View file

@ -0,0 +1,101 @@
#version 450
layout(push_constant) uniform Push
{
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float FB_RES;
float SIGMA_R;
float SIGMA_D;
} params;
#pragma parameter FB_RES "Bilateral Internal Res" 2.0 1.0 8.0 1.0
#pragma parameter SIGMA_R "Bilateral Blur" 0.4 0.0 2.0 0.1
#pragma parameter SIGMA_D "Bilateral Space" 3.0 0.0 10.0 0.2
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;
#define GET(M,K) (texture(Source,tc+M*dx+K*dy).xyz)
#define BIL(M,K) {\
col=GET(M,K);\
ds=M*M+K*K;\
weight=exp(-ds/sd2)*exp(-(col-center)*(col-center)/si2);\
color+=(weight*col);\
wsum+=weight;\
}
void main()
{
float ds, sd2, si2;
float sigma_d = params.SIGMA_D;
float sigma_r = params.SIGMA_R*0.04;
vec3 color = vec3(0.0, 0.0, 0.0);
vec3 wsum = vec3(0.0, 0.0, 0.0);
vec3 weight;
vec2 dx = vec2(params.FB_RES, 0.0) * params.SourceSize.zw;
vec2 dy = vec2(0.0, params.FB_RES) * params.SourceSize.zw;
sd2 = 2.0 * sigma_d * sigma_d;
si2 = 2.0 * sigma_r * sigma_r;
vec2 tc = vTexCoord;
vec3 col;
vec3 center = GET(0,0);
// center = sqrt(center);
BIL(-2,-2)
BIL(-1,-2)
BIL( 0,-2)
BIL( 1,-2)
BIL( 2,-2)
BIL(-2,-1)
BIL(-1,-1)
BIL( 0,-1)
BIL( 1,-1)
BIL( 2,-1)
BIL(-2, 0)
BIL(-1, 0)
BIL( 0, 0)
BIL( 1, 0)
BIL( 2, 0)
BIL(-2, 1)
BIL(-1, 1)
BIL( 0, 1)
BIL( 1, 1)
BIL( 2, 1)
BIL(-2, 2)
BIL(-1, 2)
BIL( 0, 2)
BIL( 1, 2)
BIL( 2, 2)
// Weight normalization
color /= wsum;
FragColor = vec4(color, 1.);
}