mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
Update crt-hyllian and variants
- Fix sinc vertical scanlines; - Add curvature-ntsc and dedither presets; - Some param tweaks.
This commit is contained in:
parent
22c21cc56e
commit
ffaf9fe8b7
101
crt/crt-hyllian-curvature-ntsc.slangp
Normal file
101
crt/crt-hyllian-curvature-ntsc.slangp
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
shaders = "7"
|
||||||
|
shader0 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass1.slang"
|
||||||
|
filter_linear0 = "false"
|
||||||
|
wrap_mode0 = "clamp_to_border"
|
||||||
|
frame_count_mod0 = "2"
|
||||||
|
mipmap_input0 = "false"
|
||||||
|
alias0 = ""
|
||||||
|
float_framebuffer0 = "true"
|
||||||
|
srgb_framebuffer0 = "false"
|
||||||
|
scale_type_x0 = "source"
|
||||||
|
scale_x0 = "4.000000"
|
||||||
|
scale_type_y0 = "source"
|
||||||
|
scale_y0 = "1.000000"
|
||||||
|
shader1 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass2.slang"
|
||||||
|
filter_linear1 = "false"
|
||||||
|
wrap_mode1 = "clamp_to_border"
|
||||||
|
mipmap_input1 = "false"
|
||||||
|
alias1 = ""
|
||||||
|
float_framebuffer1 = "false"
|
||||||
|
srgb_framebuffer1 = "true"
|
||||||
|
scale_type_x1 = "source"
|
||||||
|
scale_x1 = "0.500000"
|
||||||
|
scale_type_y1 = "source"
|
||||||
|
scale_y1 = "1.000000"
|
||||||
|
shader2 = "../crt/shaders/hyllian/crt-hyllian-curvature.slang"
|
||||||
|
filter_linear2 = "false"
|
||||||
|
wrap_mode2 = "clamp_to_border"
|
||||||
|
mipmap_input2 = "false"
|
||||||
|
alias2 = "CRTPass"
|
||||||
|
float_framebuffer2 = "false"
|
||||||
|
srgb_framebuffer2 = "true"
|
||||||
|
scale_type_x2 = "viewport"
|
||||||
|
scale_x2 = "1.000000"
|
||||||
|
scale_type_y2 = "viewport"
|
||||||
|
scale_y2 = "1.000000"
|
||||||
|
shader3 = "../crt/shaders/glow/threshold.slang"
|
||||||
|
filter_linear3 = "false"
|
||||||
|
wrap_mode3 = "clamp_to_border"
|
||||||
|
mipmap_input3 = "false"
|
||||||
|
alias3 = ""
|
||||||
|
float_framebuffer3 = "false"
|
||||||
|
srgb_framebuffer3 = "true"
|
||||||
|
shader4 = "../crt/shaders/glow/blur_horiz.slang"
|
||||||
|
filter_linear4 = "true"
|
||||||
|
wrap_mode4 = "clamp_to_border"
|
||||||
|
mipmap_input4 = "true"
|
||||||
|
alias4 = ""
|
||||||
|
float_framebuffer4 = "false"
|
||||||
|
srgb_framebuffer4 = "true"
|
||||||
|
scale_type_x4 = "viewport"
|
||||||
|
scale_x4 = "0.200000"
|
||||||
|
scale_type_y4 = "viewport"
|
||||||
|
scale_y4 = "0.200000"
|
||||||
|
shader5 = "../crt/shaders/glow/blur_vert.slang"
|
||||||
|
filter_linear5 = "true"
|
||||||
|
wrap_mode5 = "clamp_to_border"
|
||||||
|
mipmap_input5 = "false"
|
||||||
|
alias5 = ""
|
||||||
|
float_framebuffer5 = "false"
|
||||||
|
srgb_framebuffer5 = "true"
|
||||||
|
shader6 = "../crt/shaders/glow/resolve.slang"
|
||||||
|
filter_linear6 = "true"
|
||||||
|
wrap_mode6 = "clamp_to_border"
|
||||||
|
mipmap_input6 = "false"
|
||||||
|
alias6 = ""
|
||||||
|
float_framebuffer6 = "false"
|
||||||
|
srgb_framebuffer6 = "false"
|
||||||
|
parameters = "linearize;quality;ntsc_sat;BEAM_PROFILE;HFILTER_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_WIDTH;SCANLINES_STRENGTH;COLOR_BOOST;PHOSPHOR_LAYOUT;MASK_INTENSITY;CRT_ANTI_RINGING;InputGamma;OutputGamma;VSCANLINES;CRT_CURVATURE;CRT_warpX;CRT_warpY;CRT_cornersize;CRT_cornersmooth;GLOW_WHITEPOINT;GLOW_ROLLOFF;BLOOM_STRENGTH;OUTPUT_GAMMA;CURVATURE;warpX;warpY;cornersize;cornersmooth;noise_amt;shadowMask;maskDark;maskLight"
|
||||||
|
BEAM_PROFILE = "0.000000"
|
||||||
|
HFILTER_PROFILE = "1.000000"
|
||||||
|
BEAM_MIN_WIDTH = "1.000000"
|
||||||
|
BEAM_MAX_WIDTH = "1.000000"
|
||||||
|
SCANLINES_STRENGTH = "0.580000"
|
||||||
|
COLOR_BOOST = "1.200000"
|
||||||
|
PHOSPHOR_LAYOUT = "4.000000"
|
||||||
|
MASK_INTENSITY = "0.700000"
|
||||||
|
CRT_ANTI_RINGING = "1.000000"
|
||||||
|
InputGamma = "1.000000"
|
||||||
|
OutputGamma = "1.000000"
|
||||||
|
VSCANLINES = "0.000000"
|
||||||
|
CRT_CURVATURE = "1.000000"
|
||||||
|
CRT_warpX = "0.010000"
|
||||||
|
CRT_warpY = "0.020000"
|
||||||
|
CRT_cornersize = "0.010000"
|
||||||
|
CRT_cornersmooth = "280.000000"
|
||||||
|
GLOW_WHITEPOINT = "0.900000"
|
||||||
|
GLOW_ROLLOFF = "3.000000"
|
||||||
|
BLOOM_STRENGTH = "0.100000"
|
||||||
|
OUTPUT_GAMMA = "2.200000"
|
||||||
|
CURVATURE = "0.000000"
|
||||||
|
warpX = "0.031000"
|
||||||
|
warpY = "0.041000"
|
||||||
|
cornersize = "0.010000"
|
||||||
|
cornersmooth = "1000.000000"
|
||||||
|
noise_amt = "1.000000"
|
||||||
|
shadowMask = "0.000000"
|
||||||
|
maskDark = "0.500000"
|
||||||
|
maskLight = "1.500000"
|
||||||
|
linearize = "1.0"
|
||||||
|
quality = "0.0"
|
||||||
|
ntsc_sat = "1.2"
|
96
crt/crt-hyllian-dedither.slangp
Normal file
96
crt/crt-hyllian-dedither.slangp
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
shaders = "9"
|
||||||
|
|
||||||
|
shader0 = "../crt/shaders/glow/linearize.slang"
|
||||||
|
filter_linear0 = "false"
|
||||||
|
wrap_mode0 = "clamp_to_border"
|
||||||
|
mipmap_input0 = "false"
|
||||||
|
alias0 = "LinearGamma"
|
||||||
|
float_framebuffer0 = "false"
|
||||||
|
srgb_framebuffer0 = "true"
|
||||||
|
|
||||||
|
|
||||||
|
shader1 = ../dithering/shaders/checkerboard-dedither/checkerboard-dedither-pass1.slang
|
||||||
|
filter_linear1 = false
|
||||||
|
scale_type1 = source
|
||||||
|
scale1 = 1.0
|
||||||
|
|
||||||
|
shader2 = ../dithering/shaders/checkerboard-dedither/checkerboard-dedither-pass2.slang
|
||||||
|
filter_linear2 = false
|
||||||
|
scale_type2 = source
|
||||||
|
scale2 = 1.0
|
||||||
|
|
||||||
|
shader3 = ../dithering/shaders/checkerboard-dedither/checkerboard-dedither-pass3.slang
|
||||||
|
filter_linear3 = false
|
||||||
|
scale_type3 = source
|
||||||
|
scale3 = 1.0
|
||||||
|
|
||||||
|
shader4 = "shaders/hyllian/crt-hyllian.slang"
|
||||||
|
filter_linear4 = "false"
|
||||||
|
wrap_mode4 = "clamp_to_border"
|
||||||
|
mipmap_input4 = "false"
|
||||||
|
alias4 = "CRTPass"
|
||||||
|
float_framebuffer4 = "false"
|
||||||
|
srgb_framebuffer4 = "true"
|
||||||
|
scale_type_x4 = "viewport"
|
||||||
|
scale_x4 = "1.000000"
|
||||||
|
scale_type_y4 = "viewport"
|
||||||
|
scale_y4 = "1.000000"
|
||||||
|
shader5 = "../crt/shaders/glow/threshold.slang"
|
||||||
|
filter_linear5 = "false"
|
||||||
|
wrap_mode5 = "clamp_to_border"
|
||||||
|
mipmap_input5 = "false"
|
||||||
|
alias5 = ""
|
||||||
|
float_framebuffer5 = "false"
|
||||||
|
srgb_framebuffer5 = "true"
|
||||||
|
shader6 = "../crt/shaders/glow/blur_horiz.slang"
|
||||||
|
filter_linear6 = "true"
|
||||||
|
wrap_mode6 = "clamp_to_border"
|
||||||
|
mipmap_input6 = "true"
|
||||||
|
alias6 = ""
|
||||||
|
float_framebuffer6 = "false"
|
||||||
|
srgb_framebuffer6 = "true"
|
||||||
|
scale_type_x6 = "viewport"
|
||||||
|
scale_x6 = "0.200000"
|
||||||
|
scale_type_y6 = "viewport"
|
||||||
|
scale_y6 = "0.200000"
|
||||||
|
shader7 = "../crt/shaders/glow/blur_vert.slang"
|
||||||
|
filter_linear7 = "true"
|
||||||
|
wrap_mode7 = "clamp_to_border"
|
||||||
|
mipmap_input7 = "false"
|
||||||
|
alias7 = ""
|
||||||
|
float_framebuffer7 = "false"
|
||||||
|
srgb_framebuffer7 = "true"
|
||||||
|
shader8 = "../crt/shaders/glow/resolve.slang"
|
||||||
|
filter_linear8 = "true"
|
||||||
|
wrap_mode8 = "clamp_to_border"
|
||||||
|
mipmap_input8 = "false"
|
||||||
|
alias8 = ""
|
||||||
|
float_framebuffer8 = "false"
|
||||||
|
srgb_framebuffer8 = "false"
|
||||||
|
parameters = "CD_HUD_DETAILS;INPUT_GAMMA;HFILTER_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_WIDTH;SCANLINES_STRENGTH;COLOR_BOOST;SHARPNESS_HACK;PHOSPHOR_LAYOUT;MASK_INTENSITY;InputGamma;OutputGamma;VSCANLINES;GLOW_WHITEPOINT;GLOW_ROLLOFF;BLOOM_STRENGTH;OUTPUT_GAMMA;CURVATURE;warpX;warpY;cornersize;cornersmooth;noise_amt;shadowMask;maskDark;maskLight"
|
||||||
|
CD_HUD_DETAILS = "5.0"
|
||||||
|
INPUT_GAMMA = "2.000000"
|
||||||
|
HFILTER_PROFILE = "0.000000"
|
||||||
|
BEAM_MIN_WIDTH = "1.000000"
|
||||||
|
BEAM_MAX_WIDTH = "1.000000"
|
||||||
|
SCANLINES_STRENGTH = "0.580000"
|
||||||
|
COLOR_BOOST = "1.300000"
|
||||||
|
SHARPNESS_HACK = "1.000000"
|
||||||
|
PHOSPHOR_LAYOUT = "4.000000"
|
||||||
|
MASK_INTENSITY = "0.700000"
|
||||||
|
InputGamma = "2.400000"
|
||||||
|
OutputGamma = "1.000000"
|
||||||
|
VSCANLINES = "0.000000"
|
||||||
|
GLOW_WHITEPOINT = "0.900000"
|
||||||
|
GLOW_ROLLOFF = "3.000000"
|
||||||
|
BLOOM_STRENGTH = "0.100000"
|
||||||
|
OUTPUT_GAMMA = "2.200000"
|
||||||
|
CURVATURE = "0.000000"
|
||||||
|
warpX = "0.010000"
|
||||||
|
warpY = "0.020000"
|
||||||
|
cornersize = "0.010000"
|
||||||
|
cornersmooth = "280.000000"
|
||||||
|
noise_amt = "1.000000"
|
||||||
|
shadowMask = "0.000000"
|
||||||
|
maskDark = "0.500000"
|
||||||
|
maskLight = "1.500000"
|
|
@ -53,26 +53,26 @@ parameters = "INPUT_GAMMA;BEAM_PROFILE;HFILTER_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_W
|
||||||
INPUT_GAMMA = "2.400000"
|
INPUT_GAMMA = "2.400000"
|
||||||
BEAM_PROFILE = "0.000000"
|
BEAM_PROFILE = "0.000000"
|
||||||
HFILTER_PROFILE = "0.000000"
|
HFILTER_PROFILE = "0.000000"
|
||||||
BEAM_MIN_WIDTH = "0.900000"
|
BEAM_MIN_WIDTH = "1.000000"
|
||||||
BEAM_MAX_WIDTH = "0.900000"
|
BEAM_MAX_WIDTH = "1.000000"
|
||||||
SCANLINES_STRENGTH = "0.500000"
|
SCANLINES_STRENGTH = "0.580000"
|
||||||
COLOR_BOOST = "1.200000"
|
COLOR_BOOST = "1.350000"
|
||||||
SHARPNESS_HACK = "1.000000"
|
SHARPNESS_HACK = "1.000000"
|
||||||
PHOSPHOR_LAYOUT = "12.000000"
|
PHOSPHOR_LAYOUT = "4.000000"
|
||||||
MASK_INTENSITY = "0.700000"
|
MASK_INTENSITY = "0.700000"
|
||||||
CRT_ANTI_RINGING = "1.000000"
|
CRT_ANTI_RINGING = "1.000000"
|
||||||
InputGamma = "1.000000"
|
InputGamma = "1.000000"
|
||||||
OutputGamma = "1.000000"
|
OutputGamma = "1.000000"
|
||||||
VSCANLINES = "0.000000"
|
VSCANLINES = "0.000000"
|
||||||
GLOW_WHITEPOINT = "0.500000"
|
GLOW_WHITEPOINT = "0.900000"
|
||||||
GLOW_ROLLOFF = "1.200000"
|
GLOW_ROLLOFF = "3.000000"
|
||||||
BLOOM_STRENGTH = "0.100000"
|
BLOOM_STRENGTH = "0.100000"
|
||||||
OUTPUT_GAMMA = "2.200000"
|
OUTPUT_GAMMA = "2.200000"
|
||||||
CURVATURE = "0.000000"
|
CURVATURE = "0.000000"
|
||||||
warpX = "0.031000"
|
warpX = "0.010000"
|
||||||
warpY = "0.031000"
|
warpY = "0.020000"
|
||||||
cornersize = "0.030000"
|
cornersize = "0.010000"
|
||||||
cornersmooth = "1000.000000"
|
cornersmooth = "280.000000"
|
||||||
noise_amt = "1.000000"
|
noise_amt = "1.000000"
|
||||||
shadowMask = "0.000000"
|
shadowMask = "0.000000"
|
||||||
maskDark = "0.500000"
|
maskDark = "0.500000"
|
||||||
|
|
|
@ -52,25 +52,25 @@ srgb_framebuffer5 = "false"
|
||||||
parameters = "INPUT_GAMMA;BEAM_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_WIDTH;SCANLINES_STRENGTH;COLOR_BOOST;HFILTER_SHARPNESS;PHOSPHOR_LAYOUT;MASK_INTENSITY;CRT_ANTI_RINGING;InputGamma;OutputGamma;VSCANLINES;GLOW_WHITEPOINT;GLOW_ROLLOFF;BLOOM_STRENGTH;OUTPUT_GAMMA;CURVATURE;warpX;warpY;cornersize;cornersmooth;noise_amt;shadowMask;maskDark;maskLight"
|
parameters = "INPUT_GAMMA;BEAM_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_WIDTH;SCANLINES_STRENGTH;COLOR_BOOST;HFILTER_SHARPNESS;PHOSPHOR_LAYOUT;MASK_INTENSITY;CRT_ANTI_RINGING;InputGamma;OutputGamma;VSCANLINES;GLOW_WHITEPOINT;GLOW_ROLLOFF;BLOOM_STRENGTH;OUTPUT_GAMMA;CURVATURE;warpX;warpY;cornersize;cornersmooth;noise_amt;shadowMask;maskDark;maskLight"
|
||||||
INPUT_GAMMA = "2.400000"
|
INPUT_GAMMA = "2.400000"
|
||||||
BEAM_PROFILE = "0'.000000"
|
BEAM_PROFILE = "0'.000000"
|
||||||
BEAM_MIN_WIDTH = "0.860000"
|
BEAM_MIN_WIDTH = "1.000000"
|
||||||
BEAM_MAX_WIDTH = "1.000000"
|
BEAM_MAX_WIDTH = "1.000000"
|
||||||
SCANLINES_STRENGTH = "0.720000"
|
SCANLINES_STRENGTH = "0.720000"
|
||||||
COLOR_BOOST = "1.250000"
|
COLOR_BOOST = "1.350000"
|
||||||
PHOSPHOR_LAYOUT = "4.000000"
|
PHOSPHOR_LAYOUT = "4.000000"
|
||||||
MASK_INTENSITY = "0.500000"
|
MASK_INTENSITY = "0.700000"
|
||||||
CRT_ANTI_RINGING = "1.000000"
|
CRT_ANTI_RINGING = "1.000000"
|
||||||
InputGamma = "1.000000"
|
InputGamma = "1.000000"
|
||||||
OutputGamma = "1.000000"
|
OutputGamma = "1.000000"
|
||||||
VSCANLINES = "0.000000"
|
VSCANLINES = "0.000000"
|
||||||
GLOW_WHITEPOINT = "0.500000"
|
GLOW_WHITEPOINT = "0.900000"
|
||||||
GLOW_ROLLOFF = "1.200000"
|
GLOW_ROLLOFF = "3.000000"
|
||||||
BLOOM_STRENGTH = "0.100000"
|
BLOOM_STRENGTH = "0.100000"
|
||||||
OUTPUT_GAMMA = "2.200000"
|
OUTPUT_GAMMA = "2.200000"
|
||||||
CURVATURE = "0.000000"
|
CURVATURE = "0.000000"
|
||||||
warpX = "0.031000"
|
warpX = "0.010000"
|
||||||
warpY = "0.031000"
|
warpY = "0.020000"
|
||||||
cornersize = "0.030000"
|
cornersize = "0.010000"
|
||||||
cornersmooth = "1000.000000"
|
cornersmooth = "280.000000"
|
||||||
noise_amt = "1.000000"
|
noise_amt = "1.000000"
|
||||||
shadowMask = "0.000000"
|
shadowMask = "0.000000"
|
||||||
maskDark = "0.500000"
|
maskDark = "0.500000"
|
||||||
|
|
|
@ -27,22 +27,22 @@ layout(push_constant) uniform Push
|
||||||
#pragma parameter HFILTER_PROFILE " HORIZONTAL FILTER PROFILE [ HERMITE | CATMULL-ROM ]" 0.0 0.0 1.0 1.0
|
#pragma parameter HFILTER_PROFILE " HORIZONTAL FILTER PROFILE [ HERMITE | CATMULL-ROM ]" 0.0 0.0 1.0 1.0
|
||||||
#pragma parameter BEAM_MIN_WIDTH " Custom [If BP=0.00] MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
|
#pragma parameter BEAM_MIN_WIDTH " Custom [If BP=0.00] MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter BEAM_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
|
#pragma parameter BEAM_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 0.0 1.0 0.01
|
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.58 0.0 1.0 0.01
|
||||||
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.70 1.0 2.0 0.05
|
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.60 1.0 2.0 0.05
|
||||||
#pragma parameter SHARPNESS_HACK " SHARPNESS_HACK" 1.0 1.0 4.0 1.0
|
#pragma parameter SHARPNESS_HACK " SHARPNESS_HACK" 1.0 1.0 4.0 1.0
|
||||||
#pragma parameter PHOSPHOR_LAYOUT " PHOSPHOR LAYOUT" 4.0 0.0 24.0 1.0
|
#pragma parameter PHOSPHOR_LAYOUT " PHOSPHOR LAYOUT" 4.0 0.0 24.0 1.0
|
||||||
#pragma parameter MASK_INTENSITY " MASK INTENSITY" 0.5 0.0 1.0 0.1
|
#pragma parameter MASK_INTENSITY " MASK INTENSITY" 0.7 0.0 1.0 0.1
|
||||||
#pragma parameter CRT_ANTI_RINGING " ANTI RINGING" 1.0 0.0 1.0 0.2
|
#pragma parameter CRT_ANTI_RINGING " ANTI RINGING" 1.0 0.0 1.0 0.2
|
||||||
#pragma parameter InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
|
#pragma parameter InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
|
||||||
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
||||||
#pragma parameter VSCANLINES " VERTICAL SCANLINES [ OFF | ON ]" 0.0 0.0 1.0 1.0
|
#pragma parameter VSCANLINES " VERTICAL SCANLINES [ OFF | ON ]" 0.0 0.0 1.0 1.0
|
||||||
#pragma parameter CRT_CURVATURE "CRT-Curvature" 1.0 0.0 1.0 1.0
|
#pragma parameter CRT_CURVATURE "CRT-Curvature" 1.0 0.0 1.0 1.0
|
||||||
#pragma parameter CRT_warpX "CRT-Curvature X-Axis" 0.031 0.0 0.125 0.01
|
#pragma parameter CRT_warpX "CRT-Curvature X-Axis" 0.010 0.0 0.125 0.01
|
||||||
#pragma parameter CRT_warpY "CRT-Curvature Y-Axis" 0.041 0.0 0.125 0.01
|
#pragma parameter CRT_warpY "CRT-Curvature Y-Axis" 0.020 0.0 0.125 0.01
|
||||||
vec2 CRT_Distortion = vec2(param.CRT_warpX, param.CRT_warpY) * 15.;
|
vec2 CRT_Distortion = vec2(param.CRT_warpX, param.CRT_warpY) * 15.;
|
||||||
#pragma parameter CRT_cornersize "CRT-Corner Size" 0.01 0.001 1.0 0.005
|
#pragma parameter CRT_cornersize "CRT-Corner Size" 0.01 0.001 1.0 0.005
|
||||||
#define cornersize param.CRT_cornersize
|
#define cornersize param.CRT_cornersize
|
||||||
#pragma parameter CRT_cornersmooth "CRT-Corner Smoothness" 1000.0 80.0 2000.0 100.0
|
#pragma parameter CRT_cornersmooth "CRT-Corner Smoothness" 280.0 80.0 2080.0 100.0
|
||||||
#define cornersmooth param.CRT_cornersmooth
|
#define cornersmooth param.CRT_cornersmooth
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
|
|
@ -2,33 +2,34 @@
|
||||||
|
|
||||||
layout(push_constant) uniform Push
|
layout(push_constant) uniform Push
|
||||||
{
|
{
|
||||||
float BEAM_PROFILE;
|
|
||||||
// float HFILTER_PROFILE;
|
|
||||||
float BEAM_MIN_WIDTH;
|
float BEAM_MIN_WIDTH;
|
||||||
float BEAM_MAX_WIDTH;
|
float BEAM_MAX_WIDTH;
|
||||||
float SCANLINES_STRENGTH;
|
float SCANLINES_STRENGTH;
|
||||||
float COLOR_BOOST;
|
float COLOR_BOOST;
|
||||||
float HFILTER_SHARPNESS;
|
float SHARPNESS_HACK;
|
||||||
float PHOSPHOR_LAYOUT;
|
float PHOSPHOR_LAYOUT;
|
||||||
float MASK_INTENSITY;
|
float MASK_INTENSITY;
|
||||||
float CRT_ANTI_RINGING;
|
|
||||||
float InputGamma;
|
float InputGamma;
|
||||||
float OutputGamma;
|
float OutputGamma;
|
||||||
float VSCANLINES;
|
float VSCANLINES;
|
||||||
|
float CRT_ANTI_RINGING;
|
||||||
} param;
|
} param;
|
||||||
|
|
||||||
#pragma parameter BEAM_PROFILE "BEAM PROFILE (BP)" 0.0 0.0 3.0 1.0
|
#pragma parameter CRT_HYLLIAN_SINC "[CRT-HYLLIAN-SINC PARAMS]" 0.0 0.0 0.0 0.0
|
||||||
#pragma parameter BEAM_MIN_WIDTH " Custom [If BP=0.00] MIN BEAM WIDTH" 0.86 0.0 1.0 0.02
|
#pragma parameter BEAM_MIN_WIDTH " MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter BEAM_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.02
|
#pragma parameter BEAM_MAX_WIDTH " MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 0.0 1.0 0.02
|
#pragma parameter SCANLINES_STRENGTH " SCANLINES STRENGTH" 0.67 0.0 1.0 0.01
|
||||||
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.25 1.0 2.0 0.05
|
#pragma parameter COLOR_BOOST " COLOR BOOST" 1.35 1.0 2.0 0.05
|
||||||
#pragma parameter HFILTER_SHARPNESS " Custom [If HFP=0.00] SHARPNESS" 1.0 0.0 1.0 0.02
|
#pragma parameter SHARPNESS_HACK " SHARPNESS_HACK" 1.0 1.0 4.0 1.0
|
||||||
#pragma parameter PHOSPHOR_LAYOUT "PHOSPHOR LAYOUT" 4.0 0.0 19.0 1.0
|
#pragma parameter PHOSPHOR_LAYOUT " PHOSPHOR LAYOUT" 4.0 0.0 24.0 1.0
|
||||||
#pragma parameter MASK_INTENSITY "MASK INTENSITY" 0.5 0.0 1.0 0.1
|
#pragma parameter MASK_INTENSITY " MASK INTENSITY" 0.7 0.0 1.0 0.1
|
||||||
#pragma parameter CRT_ANTI_RINGING "ANTI RINGING" 1.0 0.0 1.0 0.1
|
#pragma parameter InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
|
||||||
#pragma parameter InputGamma "INPUT GAMMA" 2.4 0.0 5.0 0.1
|
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
||||||
#pragma parameter OutputGamma "OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
#pragma parameter VSCANLINES " SCANLINES DIRECTION" 0.0 0.0 1.0 1.0
|
||||||
#pragma parameter VSCANLINES "SCANLINES DIRECTION" 0.0 0.0 1.0 1.0
|
|
||||||
|
#pragma parameter CRT_ANTI_RINGING "Spline16 Anti-Ringing [ OFF | ON ]" 1.0 0.0 1.0 1.0
|
||||||
|
|
||||||
|
#define CRT_ANTI_RINGING param.CRT_ANTI_RINGING
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
@ -56,9 +57,9 @@ layout(location = 0) out vec4 FragColor;
|
||||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Hyllian's CRT Shader
|
Hyllian's CRT Shader - Sinc/Spline16 version
|
||||||
|
|
||||||
Copyright (C) 2011-2020 Hyllian - sergiogdb@gmail.com
|
Copyright (C) 2011-2022 Hyllian - sergiogdb@gmail.com
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -84,38 +85,52 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
#define GAMMA_IN(color) pow(color, vec3(param.InputGamma, param.InputGamma, param.InputGamma))
|
#define GAMMA_IN(color) pow(color, vec3(param.InputGamma, param.InputGamma, param.InputGamma))
|
||||||
#define GAMMA_OUT(color) pow(color, vec3(1.0 / param.OutputGamma, 1.0 / param.OutputGamma, 1.0 / param.OutputGamma))
|
#define GAMMA_OUT(color) pow(color, vec3(1.0 / param.OutputGamma, 1.0 / param.OutputGamma, 1.0 / param.OutputGamma))
|
||||||
|
|
||||||
|
#define scanlines_strength (2.0*param.SCANLINES_STRENGTH)
|
||||||
#define scanlines_strength (2.0*profile.x)
|
#define beam_min_width param.BEAM_MIN_WIDTH
|
||||||
#define beam_min_width profile.y
|
#define beam_max_width param.BEAM_MAX_WIDTH
|
||||||
#define beam_max_width profile.z
|
#define color_boost param.COLOR_BOOST
|
||||||
#define color_boost profile.w
|
|
||||||
|
|
||||||
vec4 get_beam_profile()
|
|
||||||
{
|
|
||||||
vec4 bp = vec4(param.SCANLINES_STRENGTH, param.BEAM_MIN_WIDTH, param.BEAM_MAX_WIDTH, param.COLOR_BOOST);
|
|
||||||
|
|
||||||
if (param.BEAM_PROFILE == 1) bp = vec4(0.70, 0.58, 1.00, 1.25);
|
|
||||||
if (param.BEAM_PROFILE == 2) bp = vec4(0.70, 1.00, 1.00, 1.25);
|
|
||||||
if (param.BEAM_PROFILE == 3) bp = vec4(0.58, 1.00, 1.00, 1.25);
|
|
||||||
|
|
||||||
return bp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define pi 3.1415926535897932384626433832795
|
#define pi 3.1415926535897932384626433832795
|
||||||
#define wa (0.5*pi)
|
#define wa (0.5*pi)
|
||||||
#define wb (pi)
|
#define wb (pi)
|
||||||
|
|
||||||
vec4 resampler4(vec4 x)
|
//#define CRT_ANTI_RINGING 1.0
|
||||||
|
|
||||||
|
float weight(float x)
|
||||||
{
|
{
|
||||||
vec4 res;
|
x = abs(x);
|
||||||
res.x = (x.x<=0.001) ? wa*wb : sin(x.x*wa)*sin(x.x*wb)/(x.x*x.x);
|
|
||||||
res.y = (x.y<=0.001) ? wa*wb : sin(x.y*wa)*sin(x.y*wb)/(x.y*x.y);
|
if (x < 1.0)
|
||||||
res.z = (x.z<=0.001) ? wa*wb : sin(x.z*wa)*sin(x.z*wb)/(x.z*x.z);
|
{
|
||||||
res.w = (x.w<=0.001) ? wa*wb : sin(x.w*wa)*sin(x.w*wb)/(x.w*x.w);
|
return
|
||||||
return res;
|
(
|
||||||
|
((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)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vec3 resampler3(vec3 x)
|
vec3 resampler3(vec3 x)
|
||||||
{
|
{
|
||||||
vec3 res;
|
vec3 res;
|
||||||
|
@ -127,16 +142,14 @@ vec3 resampler3(vec3 x)
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 profile = get_beam_profile();
|
vec2 TextureSize = mix(vec2(global.SourceSize.x * param.SHARPNESS_HACK, global.SourceSize.y), vec2(global.SourceSize.x, global.SourceSize.y * param.SHARPNESS_HACK), param.VSCANLINES);
|
||||||
|
|
||||||
vec2 TextureSize = vec2(global.SourceSize.x, global.SourceSize.y);
|
|
||||||
|
|
||||||
vec2 dx = mix(vec2(1.0/TextureSize.x, 0.0), vec2(0.0, 1.0/TextureSize.y), param.VSCANLINES);
|
vec2 dx = mix(vec2(1.0/TextureSize.x, 0.0), vec2(0.0, 1.0/TextureSize.y), param.VSCANLINES);
|
||||||
vec2 dy = mix(vec2(0.0, 1.0/TextureSize.y), vec2(1.0/TextureSize.x, 0.0), param.VSCANLINES);
|
vec2 dy = mix(vec2(0.0, 1.0/TextureSize.y), vec2(1.0/TextureSize.x, 0.0), param.VSCANLINES);
|
||||||
|
|
||||||
vec2 pix_coord = vTexCoord*TextureSize + vec2(-0.5, 0.5);
|
vec2 pix_coord = vTexCoord*TextureSize + vec2(-0.5, 0.5);
|
||||||
|
|
||||||
vec2 tc = mix((floor(pix_coord) + vec2(0.5, 0.5))/TextureSize, (floor(pix_coord) + vec2(1.0, -0.5))/TextureSize, param.VSCANLINES);
|
vec2 tc = mix((floor(pix_coord) + vec2(0.5, 0.5))/TextureSize, (floor(pix_coord) + vec2(1.5, -0.5))/TextureSize, param.VSCANLINES);
|
||||||
|
|
||||||
vec2 fp = mix(fract(pix_coord), fract(pix_coord.yx), param.VSCANLINES);
|
vec2 fp = mix(fract(pix_coord), fract(pix_coord.yx), param.VSCANLINES);
|
||||||
|
|
||||||
|
@ -152,8 +165,10 @@ void main()
|
||||||
mat4x3 color_matrix0 = mat4x3(c00, c01, c02, c03);
|
mat4x3 color_matrix0 = mat4x3(c00, c01, c02, c03);
|
||||||
mat4x3 color_matrix1 = mat4x3(c10, c11, c12, c13);
|
mat4x3 color_matrix1 = mat4x3(c10, c11, c12, c13);
|
||||||
|
|
||||||
vec4 weights = resampler4(vec4(1.0+fp.x, fp.x, 1.0-fp.x, 2.0-fp.x));
|
// Get weights for spline16 horizontal filter
|
||||||
|
vec4 weights = weight4(1.0 - fp.x);
|
||||||
|
|
||||||
|
// Spline16 horizontal filter
|
||||||
vec3 color0 = (color_matrix0 * weights)/dot(weights, vec4(1.0));
|
vec3 color0 = (color_matrix0 * weights)/dot(weights, vec4(1.0));
|
||||||
vec3 color1 = (color_matrix1 * weights)/dot(weights, vec4(1.0));
|
vec3 color1 = (color_matrix1 * weights)/dot(weights, vec4(1.0));
|
||||||
|
|
||||||
|
@ -166,24 +181,26 @@ void main()
|
||||||
// Anti-ringing
|
// Anti-ringing
|
||||||
vec3 aux = color0;
|
vec3 aux = color0;
|
||||||
color0 = clamp(color0, min_sample0, max_sample0);
|
color0 = clamp(color0, min_sample0, max_sample0);
|
||||||
color0 = mix(aux, color0, param.CRT_ANTI_RINGING);
|
color0 = mix(aux, color0, CRT_ANTI_RINGING * step(0.0, (c00-c01)*(c02-c03)));
|
||||||
aux = color1;
|
aux = color1;
|
||||||
color1 = clamp(color1, min_sample1, max_sample1);
|
color1 = clamp(color1, min_sample1, max_sample1);
|
||||||
color1 = mix(aux, color1, param.CRT_ANTI_RINGING);
|
color1 = mix(aux, color1, CRT_ANTI_RINGING * step(0.0, (c10-c11)*(c12-c13)));
|
||||||
|
|
||||||
|
// Apply scanlines. Sinc filter vertically.
|
||||||
float pos0 = fp.y;
|
float pos0 = fp.y;
|
||||||
float pos1 = 1 - fp.y;
|
float pos1 = 1 - fp.y;
|
||||||
|
|
||||||
vec3 lum0 = mix(vec3(beam_min_width), vec3(beam_max_width), color0);
|
vec3 lum0 = mix(vec3(beam_min_width), vec3(beam_max_width), color0);
|
||||||
vec3 lum1 = mix(vec3(beam_min_width), vec3(beam_max_width), color1);
|
vec3 lum1 = mix(vec3(beam_min_width), vec3(beam_max_width), color1);
|
||||||
|
|
||||||
vec3 d0 = clamp(scanlines_strength*pos0/(lum0+0.0000001), 0.0, 1.0);
|
vec3 d0 = clamp(scanlines_strength*pos0/(lum0*lum0+0.0000001), 0.0, 1.0);
|
||||||
vec3 d1 = clamp(scanlines_strength*pos1/(lum1+0.0000001), 0.0, 1.0);
|
vec3 d1 = clamp(scanlines_strength*pos1/(lum1*lum1+0.0000001), 0.0, 1.0);
|
||||||
|
|
||||||
d0 = resampler3(d0);
|
d0 = resampler3(d0);
|
||||||
d1 = resampler3(d1);
|
d1 = resampler3(d1);
|
||||||
|
|
||||||
vec3 color = color_boost*(color0*d0+color1*d1)/(wa*wb);
|
// Apply color enhancement, scanlines orientation, mask and gamma.
|
||||||
|
vec3 color = color_boost*(color0*d0+color1*d1)/(wa*wb);
|
||||||
|
|
||||||
vec2 mask_coords = vTexCoord.xy * global.OutputSize.xy;
|
vec2 mask_coords = vTexCoord.xy * global.OutputSize.xy;
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ layout(push_constant) uniform Push
|
||||||
#pragma parameter HFILTER_PROFILE " HORIZONTAL FILTER PROFILE [ HERMITE | CATMULL-ROM ]" 0.0 0.0 1.0 1.0
|
#pragma parameter HFILTER_PROFILE " HORIZONTAL FILTER PROFILE [ HERMITE | CATMULL-ROM ]" 0.0 0.0 1.0 1.0
|
||||||
#pragma parameter BEAM_MIN_WIDTH " Custom [If BP=0.00] MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
|
#pragma parameter BEAM_MIN_WIDTH " Custom [If BP=0.00] MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter BEAM_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
|
#pragma parameter BEAM_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 0.0 1.0 0.01
|
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.58 0.0 1.0 0.01
|
||||||
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.70 1.0 2.0 0.05
|
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.30 1.0 2.0 0.05
|
||||||
#pragma parameter SHARPNESS_HACK " SHARPNESS_HACK" 1.0 1.0 4.0 1.0
|
#pragma parameter SHARPNESS_HACK " SHARPNESS_HACK" 1.0 1.0 4.0 1.0
|
||||||
#pragma parameter PHOSPHOR_LAYOUT " PHOSPHOR LAYOUT" 4.0 0.0 24.0 1.0
|
#pragma parameter PHOSPHOR_LAYOUT " PHOSPHOR LAYOUT" 4.0 0.0 24.0 1.0
|
||||||
#pragma parameter MASK_INTENSITY " MASK INTENSITY" 0.5 0.0 1.0 0.1
|
#pragma parameter MASK_INTENSITY " MASK INTENSITY" 0.7 0.0 1.0 0.1
|
||||||
#pragma parameter CRT_ANTI_RINGING " ANTI RINGING" 1.0 0.0 1.0 0.2
|
#pragma parameter CRT_ANTI_RINGING " ANTI RINGING" 1.0 0.0 1.0 0.2
|
||||||
#pragma parameter InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
|
#pragma parameter InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
|
||||||
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1
|
||||||
|
|
Loading…
Reference in a new issue