Merge branch 'libretro:master' into master

This commit is contained in:
DigiDwrf 2022-09-03 22:55:38 -05:00 committed by GitHub
commit 3259885be7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 736 additions and 116 deletions

View 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 = "2.000000"
OutputGamma = "2.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.010000"
warpY = "0.020000"
cornersize = "0.010000"
cornersmooth = "280.000000"
noise_amt = "1.000000"
shadowMask = "0.000000"
maskDark = "0.500000"
maskLight = "1.500000"
linearize = "1.0"
quality = "0.0"
ntsc_sat = "1.2"

View 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"

View file

@ -53,26 +53,26 @@ parameters = "INPUT_GAMMA;BEAM_PROFILE;HFILTER_PROFILE;BEAM_MIN_WIDTH;BEAM_MAX_W
INPUT_GAMMA = "2.400000"
BEAM_PROFILE = "0.000000"
HFILTER_PROFILE = "0.000000"
BEAM_MIN_WIDTH = "0.900000"
BEAM_MAX_WIDTH = "0.900000"
SCANLINES_STRENGTH = "0.500000"
COLOR_BOOST = "1.200000"
BEAM_MIN_WIDTH = "1.000000"
BEAM_MAX_WIDTH = "1.000000"
SCANLINES_STRENGTH = "0.580000"
COLOR_BOOST = "1.350000"
SHARPNESS_HACK = "1.000000"
PHOSPHOR_LAYOUT = "12.000000"
PHOSPHOR_LAYOUT = "4.000000"
MASK_INTENSITY = "0.700000"
CRT_ANTI_RINGING = "1.000000"
InputGamma = "1.000000"
OutputGamma = "1.000000"
VSCANLINES = "0.000000"
GLOW_WHITEPOINT = "0.500000"
GLOW_ROLLOFF = "1.200000"
GLOW_WHITEPOINT = "0.900000"
GLOW_ROLLOFF = "3.000000"
BLOOM_STRENGTH = "0.100000"
OUTPUT_GAMMA = "2.200000"
CURVATURE = "0.000000"
warpX = "0.031000"
warpY = "0.031000"
cornersize = "0.030000"
cornersmooth = "1000.000000"
warpX = "0.010000"
warpY = "0.020000"
cornersize = "0.010000"
cornersmooth = "280.000000"
noise_amt = "1.000000"
shadowMask = "0.000000"
maskDark = "0.500000"

View file

@ -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"
INPUT_GAMMA = "2.400000"
BEAM_PROFILE = "0'.000000"
BEAM_MIN_WIDTH = "0.860000"
BEAM_MIN_WIDTH = "1.000000"
BEAM_MAX_WIDTH = "1.000000"
SCANLINES_STRENGTH = "0.720000"
COLOR_BOOST = "1.250000"
COLOR_BOOST = "1.350000"
PHOSPHOR_LAYOUT = "4.000000"
MASK_INTENSITY = "0.500000"
MASK_INTENSITY = "0.700000"
CRT_ANTI_RINGING = "1.000000"
InputGamma = "1.000000"
OutputGamma = "1.000000"
VSCANLINES = "0.000000"
GLOW_WHITEPOINT = "0.500000"
GLOW_ROLLOFF = "1.200000"
GLOW_WHITEPOINT = "0.900000"
GLOW_ROLLOFF = "3.000000"
BLOOM_STRENGTH = "0.100000"
OUTPUT_GAMMA = "2.200000"
CURVATURE = "0.000000"
warpX = "0.031000"
warpY = "0.031000"
cornersize = "0.030000"
cornersmooth = "1000.000000"
warpX = "0.010000"
warpY = "0.020000"
cornersize = "0.010000"
cornersmooth = "280.000000"
noise_amt = "1.000000"
shadowMask = "0.000000"
maskDark = "0.500000"

View file

@ -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 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 SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 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 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.60 1.0 2.0 0.05
#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 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 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 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_warpX "CRT-Curvature X-Axis" 0.031 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_warpX "CRT-Curvature X-Axis" 0.010 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.;
#pragma parameter CRT_cornersize "CRT-Corner Size" 0.01 0.001 1.0 0.005
#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
layout(std140, set = 0, binding = 0) uniform UBO

View file

@ -2,34 +2,35 @@
layout(push_constant) uniform Push
{
float BEAM_PROFILE;
// float HFILTER_PROFILE;
float BEAM_MIN_WIDTH;
float BEAM_MAX_WIDTH;
float SCANLINES_STRENGTH;
float COLOR_BOOST;
float HFILTER_SHARPNESS;
float SHARPNESS_HACK;
float PHOSPHOR_LAYOUT;
float MASK_INTENSITY;
float CRT_ANTI_RINGING;
float InputGamma;
float OutputGamma;
float VSCANLINES;
float CRT_ANTI_RINGING;
} param;
#pragma parameter BEAM_PROFILE "BEAM PROFILE (BP)" 0.0 0.0 3.0 1.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_MAX_WIDTH " Custom [If BP=0.00] MAX BEAM WIDTH" 1.0 0.0 1.0 0.02
#pragma parameter SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 0.0 1.0 0.02
#pragma parameter COLOR_BOOST " Custom [If BP=0.00] COLOR BOOST" 1.25 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 PHOSPHOR_LAYOUT "PHOSPHOR LAYOUT" 4.0 0.0 19.0 1.0
#pragma parameter MASK_INTENSITY "MASK INTENSITY" 0.5 0.0 1.0 0.1
#pragma parameter CRT_ANTI_RINGING "ANTI RINGING" 1.0 0.0 1.0 0.1
#pragma parameter CRT_HYLLIAN_SINC "[CRT-HYLLIAN-SINC PARAMS]" 0.0 0.0 0.0 0.0
#pragma parameter BEAM_MIN_WIDTH " MIN BEAM WIDTH" 1.0 0.0 1.0 0.01
#pragma parameter BEAM_MAX_WIDTH " MAX BEAM WIDTH" 1.0 0.0 1.0 0.01
#pragma parameter SCANLINES_STRENGTH " SCANLINES STRENGTH" 0.67 0.0 1.0 0.01
#pragma parameter COLOR_BOOST " COLOR BOOST" 1.35 1.0 2.0 0.05
#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 MASK_INTENSITY " MASK INTENSITY" 0.7 0.0 1.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 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
{
mat4 MVP;
@ -56,9 +57,9 @@ layout(location = 0) out vec4 FragColor;
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
of this software and associated documentation files (the "Software"), to deal
@ -84,37 +85,51 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
#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 scanlines_strength (2.0*profile.x)
#define beam_min_width profile.y
#define beam_max_width profile.z
#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 scanlines_strength (2.0*param.SCANLINES_STRENGTH)
#define beam_min_width param.BEAM_MIN_WIDTH
#define beam_max_width param.BEAM_MAX_WIDTH
#define color_boost param.COLOR_BOOST
#define pi 3.1415926535897932384626433832795
#define wa (0.5*pi)
#define wb (pi)
vec4 resampler4(vec4 x)
//#define CRT_ANTI_RINGING 1.0
float weight(float x)
{
vec4 res;
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);
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 res;
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)
);
}
vec3 resampler3(vec3 x)
{
@ -127,16 +142,14 @@ vec3 resampler3(vec3 x)
void main()
{
vec4 profile = get_beam_profile();
vec2 TextureSize = vec2(global.SourceSize.x, global.SourceSize.y);
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 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 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);
@ -152,8 +165,10 @@ void main()
mat4x3 color_matrix0 = mat4x3(c00, c01, c02, c03);
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 color1 = (color_matrix1 * weights)/dot(weights, vec4(1.0));
@ -166,23 +181,25 @@ void main()
// Anti-ringing
vec3 aux = color0;
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;
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 pos1 = 1 - fp.y;
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 d0 = clamp(scanlines_strength*pos0/(lum0+0.0000001), 0.0, 1.0);
vec3 d1 = clamp(scanlines_strength*pos1/(lum1+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*lum1+0.0000001), 0.0, 1.0);
d0 = resampler3(d0);
d1 = resampler3(d1);
// 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;

View file

@ -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 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 SCANLINES_STRENGTH " Custom [If BP=0.00] SCANLINES STRENGTH" 0.72 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 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.30 1.0 2.0 0.05
#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 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 InputGamma " INPUT GAMMA" 2.4 0.0 5.0 0.1
#pragma parameter OutputGamma " OUTPUT GAMMA" 2.2 0.0 5.0 0.1

View file

@ -0,0 +1,20 @@
shaders = 4
shader0 = shaders/checkerboard-dedither/linearize.slang
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
alias0 = LinearGamma
shader1 = shaders/checkerboard-dedither/checkerboard-dedither-pass1.slang
filter_linear1 = false
scale_type1 = source
scale1 = 1.0
shader2 = shaders/checkerboard-dedither/checkerboard-dedither-pass2.slang
filter_linear2 = false
scale_type2 = source
scale2 = 1.0
shader3 = shaders/checkerboard-dedither/checkerboard-dedither-pass3.slang
filter_linear3 = false

View file

@ -0,0 +1,112 @@
#version 450
/*
Checkerboard Dedither - pass1
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 CD_BLEND_OPTION;
float CD_BLEND_LEVEL;
} params;
#pragma parameter CB-DEDITHER "[CHECKERBOARD-DEDITHER PARAMS]" 0.0 0.0 0.0 0.0
#pragma parameter CD_BLEND_OPTION " [ OFF | ON ]" 1.0 0.0 1.0 1.0
#pragma parameter CD_BLEND_LEVEL " Blend Level" 1.0 0.0 1.0 0.1
#define CD_BLEND_OPTION params.CD_BLEND_OPTION
#define CD_BLEND_LEVEL params.CD_BLEND_LEVEL
const vec3 Y = vec3( 0.299, 0.587, 0.114);
vec3 min_s(vec3 central, vec3 adj1, vec3 adj2) {return min(central, max(adj1, adj2));}
vec3 max_s(vec3 central, vec3 adj1, vec3 adj2) {return max(central, min(adj1, adj2));}
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()
{
vec2 dx = vec2(1.0, 0.0)*params.SourceSize.zw;
vec2 dy = vec2(0.0, 1.0)*params.SourceSize.zw;
// Reading the texels.
vec3 C = texture(Source, vTexCoord ).xyz;
vec3 L = texture(Source, vTexCoord -dx).xyz;
vec3 R = texture(Source, vTexCoord +dx).xyz;
vec3 U = texture(Source, vTexCoord -dy).xyz;
vec3 D = texture(Source, vTexCoord +dy).xyz;
vec3 UL = texture(Source, vTexCoord -dx -dy).xyz;
vec3 UR = texture(Source, vTexCoord +dx -dy).xyz;
vec3 DL = texture(Source, vTexCoord -dx +dy).xyz;
vec3 DR = texture(Source, vTexCoord +dx +dy).xyz;
vec3 color = C;
// Get min/max samples
vec3 min_sample = min_s(C, L, R);
vec3 max_sample = max_s(C, L, R);
float diff = dot(max(max(C, L), max(C, R)) - min(min(C, L), min(C, R)), Y);
diff *= (1.0 - CD_BLEND_LEVEL);
if (CD_BLEND_OPTION == 1)
{
min_sample = max(min_sample, min_s(C, U, D));
max_sample = min(max_sample, max_s(C, U, D));
color = 0.5*( 1.0 + diff )*C + 0.125*( 1.0 - diff )*(L + R + U + D);
}
color = clamp(color, min_sample, max_sample);
float luma_diff = abs(dot(C, Y)-dot(color, Y));
FragColor = vec4(color, luma_diff);
}

View file

@ -0,0 +1,122 @@
#version 450
/*
Checkerboard Dedither - pass2
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 CD_BLEND_LEVEL;
} params;
#pragma parameter CD_BLEND_LEVEL " Blend Level" 1.0 0.0 1.0 0.1
#define CD_BLEND_LEVEL params.CD_BLEND_LEVEL
const float Delta = 0.000000001;
const vec3 Y = vec3( 0.299, 0.587, 0.114);
vec3 min_s(vec3 central, vec3 adj1, vec3 adj2) {return min(central, max(adj1, adj2));}
vec3 max_s(vec3 central, vec3 adj1, vec3 adj2) {return max(central, min(adj1, adj2));}
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;
layout(set = 0, binding = 3) uniform sampler2D LinearGamma;
void main()
{
vec2 dx = vec2(1.0, 0.0)*params.SourceSize.zw;
vec2 dy = vec2(0.0, 1.0)*params.SourceSize.zw;
// Reading the texels.
vec4 C = texture(Source, vTexCoord );
vec4 L = texture(Source, vTexCoord -dx );
vec4 R = texture(Source, vTexCoord +dx );
vec4 U = texture(Source, vTexCoord -dy);
vec4 D = texture(Source, vTexCoord +dy);
vec4 UL = texture(Source, vTexCoord -dx -dy);
vec4 UR = texture(Source, vTexCoord +dx -dy);
vec4 DL = texture(Source, vTexCoord -dx +dy);
vec4 DR = texture(Source, vTexCoord +dx +dy);
vec3 color = C.rgb;
vec3 oriC = texture(LinearGamma, vTexCoord ).rgb;
vec3 oriL = texture(LinearGamma, vTexCoord -dx ).rgb;
vec3 oriR = texture(LinearGamma, vTexCoord +dx ).rgb;
vec3 oriU = texture(LinearGamma, vTexCoord -dy).rgb;
vec3 oriD = texture(LinearGamma, vTexCoord +dy).rgb;
float count1 = 0.0;
float count2 = 0.0;
float diff = (1.0 - CD_BLEND_LEVEL);
// UL U UR
// L C R
// DL D DR
count1 += (step(Delta, L.a*D.a*R.a));
count1 += (step(Delta, L.a*U.a*R.a));
count1 += (step(Delta, L.a*UL.a*R.a*UR.a + L.a*DL.a*R.a*DR.a));
count2 += (step(Delta, U.a*L.a*D.a));
count2 += (step(Delta, U.a*R.a*D.a));
count2 += (step(Delta, U.a*UR.a*D.a*DR.a + D.a*DL.a*U.a*UL.a));
if ((count1 * count2) > 0.0)
color = 0.5*(1.0+diff)*oriC + 0.125*(1.0-diff)*(oriL + oriR + oriU + oriD);
else if (count1 > 0.0)
color = 0.5*(1.0+diff)*oriC + 0.25*(1.0-diff)*(oriL + oriR);
else if (count2 > 0.0)
color = 0.5*(1.0+diff)*oriC + 0.25*(1.0-diff)*(oriU + oriD);
float luma_diff = abs(dot(oriC, Y)-dot(color, Y));
FragColor = vec4(color, luma_diff);
}

View file

@ -0,0 +1,121 @@
#version 450
/*
Checkerboard Dedither - pass3
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 CD_HUD_DETAILS;
float CD_ADJUST_VIEW;
} params;
#pragma parameter CD_HUD_DETAILS " Details Threshold" 1.0 0.0 5.0 1.0
#pragma parameter CD_ADJUST_VIEW " Adjust View" 0.0 0.0 1.0 1.0
#define CD_HUD_DETAILS params.CD_HUD_DETAILS
#define CD_ADJUST_VIEW params.CD_ADJUST_VIEW
#define GAMMA_EXP 2.0
#define GAMMA_IN(color) pow(color, vec3(GAMMA_EXP, GAMMA_EXP, GAMMA_EXP))
#define GAMMA_OUT(color) pow(color, vec3(1.0 / GAMMA_EXP, 1.0 / GAMMA_EXP, 1.0 / GAMMA_EXP))
const float Delta = 0.000000001;
const vec3 Y = vec3( 0.299, 0.587, 0.114);
vec3 min_s(vec3 central, vec3 adj1, vec3 adj2) {return min(central, max(adj1, adj2));}
vec3 max_s(vec3 central, vec3 adj1, vec3 adj2) {return max(central, min(adj1, adj2));}
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;
layout(set = 0, binding = 3) uniform sampler2D LinearGamma;
void main()
{
vec2 dx = vec2(1.0, 0.0)*params.SourceSize.zw;
vec2 dy = vec2(0.0, 1.0)*params.SourceSize.zw;
// Reading the texels.
vec4 C = texture(Source, vTexCoord );
vec4 L = texture(Source, vTexCoord -dx );
vec4 R = texture(Source, vTexCoord +dx );
vec4 U = texture(Source, vTexCoord -dy);
vec4 D = texture(Source, vTexCoord +dy);
vec4 UL = texture(Source, vTexCoord -dx -dy);
vec4 UR = texture(Source, vTexCoord +dx -dy);
vec4 DL = texture(Source, vTexCoord -dx +dy);
vec4 DR = texture(Source, vTexCoord +dx +dy);
vec3 color = C.rgb;
vec3 oriC = texture(LinearGamma, vTexCoord ).rgb;
float count = 0.0;
float count2 = 0.0;
// UL U UR
// L C R
// DL D DR
count += step(Delta, L.a);
count += step(Delta, R.a);
count += step(Delta, U.a);
count += step(Delta, D.a);
count += step(Delta, UL.a*UR.a*DL.a*DR.a);
count2 += (step(Delta, L.a*UL.a*U.a + U.a*UR.a*R.a + R.a*DR.a*D.a + D.a*DL.a*L.a));
if ((count < CD_HUD_DETAILS) && (count2 < 1.0))
color = oriC;
float luma_diff = abs(dot(oriC, Y)-dot(color, Y));
color = mix(color, vec3(luma_diff), CD_ADJUST_VIEW);
FragColor = vec4(GAMMA_OUT(color), 1.0);
}

View file

@ -0,0 +1,41 @@
#version 450
layout(push_constant) uniform Push
{
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float InputGamma;
} params;
#define InputGamma 2.0
#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 = vec4(GAMMA_IN(texture(Source, vTexCoord).rgb), 1.0);
}

View file

@ -1,6 +1,6 @@
shaders = 10
shader0 = shaders/glow-trails/glow-trails0.slang
shader0 = ../crt/shaders/glow-trails/glow-trails0.slang
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
@ -18,33 +18,33 @@ scale_type2 = "source"
scale2 = "1.0"
srgb_framebuffer2 = "true"
shader3 = shaders/glow-trails/glow-trails1.slang
shader3 = ../crt/shaders/glow-trails/glow-trails1.slang
shader4 = shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
shader4 = ../crt/shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang
srgb_framebuffer4 = true
alias4 = "ORIG_LINEARIZED"
shader5 = "shaders/crt-easymode-halation/blur_horiz.slang"
shader5 = "../crt/shaders/crt-easymode-halation/blur_horiz.slang"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
srgb_framebuffer5 = "true"
shader6 = "shaders/crt-easymode-halation/blur_vert.slang"
shader6 = "../crt/shaders/crt-easymode-halation/blur_vert.slang"
alias6 = "GlowPass"
filter_linear6 = "true"
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"
shader7 = "shaders/crt-easymode-halation/threshold.slang"
shader7 = "../crt/shaders/crt-easymode-halation/threshold.slang"
srgb_framebuffer7 = "true"
shader8 = "shaders/crt-lottes-multipass/bloompass-glow.slang"
shader8 = "../crt/shaders/crt-lottes-multipass/bloompass-glow.slang"
filter_linear8 = "true"
alias8 = BloomPass
shader9 = "shaders/crt-lottes-multipass/scanpass-glow.slang"
shader9 = "../crt/shaders/crt-lottes-multipass/scanpass-glow.slang"
filter_linear9 = "true"
parameters = "mixfactor;threshold;trail_bright;glowFactor;DIFFUSION;maskLight;maskDark;warpX"

View file

@ -6,11 +6,8 @@ layout(push_constant) uniform Push
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float LUT_Size;
} params;
#pragma parameter LUT_Size "LUT Size" 16.0 1.0 64.0 1.0
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
@ -43,11 +40,12 @@ vec4 mixfix(vec4 a, vec4 b, float c)
void main()
{
vec2 LUT_Size = textureSize(SamplerLUT, 0);
vec4 imgColor = texture(Source, vTexCoord.xy);
float red = ( imgColor.r * (params.LUT_Size - 1.0) + 0.4999 ) / (params.LUT_Size * params.LUT_Size);
float green = ( imgColor.g * (params.LUT_Size - 1.0) + 0.4999 ) / params.LUT_Size;
float blue1 = (floor( imgColor.b * (params.LUT_Size - 1.0) ) / params.LUT_Size) + red;
float blue2 = (ceil( imgColor.b * (params.LUT_Size - 1.0) ) / params.LUT_Size) + red;
float red = ( imgColor.r * (LUT_Size.y - 1.0) + 0.4999 ) / (LUT_Size.y * LUT_Size.y);
float green = ( imgColor.g * (LUT_Size.y - 1.0) + 0.4999 ) / LUT_Size.y;
float blue1 = (floor( imgColor.b * (LUT_Size.y - 1.0) ) / LUT_Size.y) + red;
float blue2 = (ceil( imgColor.b * (LUT_Size.y - 1.0) ) / LUT_Size.y) + red;
float mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
vec4 color1 = texture( SamplerLUT, vec2( blue1, green ));
vec4 color2 = texture( SamplerLUT, vec2( blue2, green ));

View file

@ -1,7 +1,6 @@
#version 450
// A version of the LUT shader that loads 2 LUTs.
// For use with Kurozumi's 64-bit colorspace LUTs.
layout(push_constant) uniform Push
{
@ -12,12 +11,7 @@ layout(push_constant) uniform Push
float LUT_selector_param;
} params;
#pragma parameter LUT_selector_param "Color Temp (1=D65, 2=D93)" 1.0 1.0 2.0 1.0
//#pragma parameter LUT_Size1 "LUT Size 1" 16.0 1.0 64.0 1.0
//#pragma parameter LUT_Size2 "LUT Size 2" 16.0 1.0 64.0 1.0
const float LUT_Size1 = 64.0;
const float LUT_Size2 = 64.0; // hardcode these for Kurozumi's LUTs
#pragma parameter LUT_selector_param "LUT Selector" 1.0 1.0 2.0 1.0
int LUT_selector = int(params.LUT_selector_param);
layout(std140, set = 0, binding = 0) uniform UBO
@ -53,26 +47,24 @@ vec4 mixfix(vec4 a, vec4 b, float c)
void main()
{
float LUT_Size = mix(textureSize(SamplerLUT1, 0).y, textureSize(SamplerLUT2, 0).y, params.LUT_selector_param - 1.0);
vec4 imgColor = texture(Source, vTexCoord.xy);
vec4 color1, color2 = vec4(0.,0.,0.,0.);
float red, green, blue1, blue2, mixer = 0.0;
red = ( imgColor.r * (LUT_Size - 1.0) + 0.4999 ) / (LUT_Size * LUT_Size);
green = ( imgColor.g * (LUT_Size - 1.0) + 0.4999 ) / LUT_Size;
blue1 = (floor( imgColor.b * (LUT_Size - 1.0) ) / LUT_Size) + red;
blue2 = (ceil( imgColor.b * (LUT_Size - 1.0) ) / LUT_Size) + red;
mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
if(LUT_selector == 1)
{
red = ( imgColor.r * (LUT_Size1 - 1.0) + 0.4999 ) / (LUT_Size1 * LUT_Size1);
green = ( imgColor.g * (LUT_Size1 - 1.0) + 0.4999 ) / LUT_Size1;
blue1 = (floor( imgColor.b * (LUT_Size1 - 1.0) ) / LUT_Size1) + red;
blue2 = (ceil( imgColor.b * (LUT_Size1 - 1.0) ) / LUT_Size1) + red;
mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
color1 = texture( SamplerLUT1, vec2( blue1, green ));
color2 = texture( SamplerLUT1, vec2( blue2, green ));
}
if(LUT_selector == 2)
else
{
red = ( imgColor.r * (LUT_Size2 - 1.0) + 0.4999 ) / (LUT_Size2 * LUT_Size2);
green = ( imgColor.g * (LUT_Size2 - 1.0) + 0.4999 ) / LUT_Size2;
blue1 = (floor( imgColor.b * (LUT_Size2 - 1.0) ) / LUT_Size2) + red;
blue2 = (ceil( imgColor.b * (LUT_Size2 - 1.0) ) / LUT_Size2) + red;
mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
color1 = texture( SamplerLUT2, vec2( blue1, green ));
color2 = texture( SamplerLUT2, vec2( blue2, green ));
}