mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 07:41:31 +11:00
fine-tune settings (#473)
* fine-tune settings * add hd version closer to blargg's ntsc * Update ntsc-simple-hd.slangp
This commit is contained in:
parent
727bbf9b11
commit
9ed0fc60ed
19
ntsc/ntsc-simple-hd.slangp
Normal file
19
ntsc/ntsc-simple-hd.slangp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
shaders = "3"
|
||||||
|
feedback_pass = "0"
|
||||||
|
shader0 = "../stock.slang"
|
||||||
|
filter_linear0 = "false"
|
||||||
|
scale_type_x0 = "source"
|
||||||
|
scale_x0 = "2.000000"
|
||||||
|
scale_type_y0 = "source"
|
||||||
|
scale_y0 = "1.000000"
|
||||||
|
shader1 = "shaders/ntsc-simple/ntsc-simple.slang"
|
||||||
|
filter_linear1 = "false"
|
||||||
|
scale_type_x1 = "source"
|
||||||
|
scale_x1 = "0.500000"
|
||||||
|
scale_type_y1 = "source"
|
||||||
|
scale_y1 = "1.000000"
|
||||||
|
shader2 = "../windowed/shaders/lanczos3-x.slang"
|
||||||
|
filter_linear2 = "false"
|
||||||
|
CHR_BLUR = "1.800000"
|
||||||
|
L_BLUR = "6.000000"
|
||||||
|
LANCZOS3_ANTI_RINGING = "0.0"
|
|
@ -14,8 +14,8 @@ layout(push_constant) uniform Push
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma parameter CHR_BLUR "CHROMA RESOLUTION" 4.0 1.0 10.0 0.1
|
#pragma parameter CHR_BLUR "CHROMA RESOLUTION" 2.3 1.0 10.0 0.1
|
||||||
#pragma parameter L_BLUR "LUMA RESOLUTION" 8.0 2.0 10.0 0.25
|
#pragma parameter L_BLUR "LUMA RESOLUTION" 10.5 10.0 20.0 0.5
|
||||||
#pragma parameter CHROMA_SATURATION "CHROMA SATURATION" 5.0 0.0 15.0 0.1
|
#pragma parameter CHROMA_SATURATION "CHROMA SATURATION" 5.0 0.0 15.0 0.1
|
||||||
#pragma parameter BRIGHTNESS "LUMA BRIGHTNESS" 0.55 0.0 2.0 0.01
|
#pragma parameter BRIGHTNESS "LUMA BRIGHTNESS" 0.55 0.0 2.0 0.01
|
||||||
#pragma parameter IHUE "I SHIFT (blue to orange)" 0.0 -1.0 1.0 0.01
|
#pragma parameter IHUE "I SHIFT (blue to orange)" 0.0 -1.0 1.0 0.01
|
||||||
|
@ -67,7 +67,7 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
#define TAU 6.28318530717958647693
|
#define TAU 6.28318530717958647693
|
||||||
#define FSC 3.57945*4.0
|
#define FSC 3.57945
|
||||||
|
|
||||||
// Size of the decoding FIR filter
|
// Size of the decoding FIR filter
|
||||||
#define FIR_SIZE 20
|
#define FIR_SIZE 20
|
||||||
|
@ -81,21 +81,22 @@ const mat3 rgb_to_yiq = mat3(0.299, 0.596, 0.211,
|
||||||
0.587,-0.274,-0.523,
|
0.587,-0.274,-0.523,
|
||||||
0.114,-0.322, 0.312);
|
0.114,-0.322, 0.312);
|
||||||
|
|
||||||
float blackman(float n, float N) {
|
float blackman(float pos, float FIR) {
|
||||||
float a0 = (1.0 - 0.16) / 2.0;
|
float a0 = 0.42;
|
||||||
float a1 = 1.0 / 2.0;
|
float a1 = 0.50;
|
||||||
float a2 = 0.16 / 2.0;
|
float a2 = 0.08;
|
||||||
|
|
||||||
return a0 - (a1 * cos((2.0 * PI * n) / N)) + (a2 * cos((4.0 * PI * n) / N));
|
return a0 - (a1 * cos((2.0 * PI * pos) / FIR)) + (a2 * cos((4.0 * PI * pos) / FIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
// moved due to GLES fix.
|
// moved due to GLES fix.
|
||||||
mat3 mix_mat = mat3(
|
mat3 mix_mat = mat3(
|
||||||
1.0, 0.0, 0.0,
|
1.0, 0.0, 0.0,
|
||||||
IHUE, 1.0, 0.0,
|
IHUE, 1.0, 0.0,
|
||||||
QHUE, 0.0, 1.0
|
QHUE, 0.0, 1.0
|
||||||
);
|
);
|
||||||
|
|
||||||
// Chroma decoder oscillator frequency
|
// Chroma decoder oscillator frequency
|
||||||
float fc = SourceSize.x*TAU;
|
float fc = SourceSize.x*TAU;
|
||||||
|
@ -104,31 +105,35 @@ mat3 mix_mat = mat3(
|
||||||
vec3 yiq = vec3(0.0);
|
vec3 yiq = vec3(0.0);
|
||||||
|
|
||||||
for (int d = -FIR_SIZE; d < FIR_SIZE; d++) {
|
for (int d = -FIR_SIZE; d < FIR_SIZE; d++) {
|
||||||
|
float odd = mod(vTexCoord.y*SourceSize.y,2.0)*SourceSize.z*0.25;
|
||||||
|
float offset = float(d);
|
||||||
|
float phase = fc*vTexCoord.x+11.0*PI/60.0;
|
||||||
// LUMA encode
|
// LUMA encode
|
||||||
vec2 pos = vec2((vTexCoord.x + (float(d)/2.0/L_BLUR)*SourceSize.z), vTexCoord.y);
|
vec2 pos = vec2((vTexCoord.x + (offset/2.0/L_BLUR)*SourceSize.z)+odd, vTexCoord.y);
|
||||||
vec3 s = texture(Source, pos).rgb;
|
vec3 s = texture(Source, pos).rgb;
|
||||||
s = rgb_to_yiq*s;
|
s = rgb_to_yiq*s;
|
||||||
// LUMA encode end
|
// LUMA encode end
|
||||||
|
|
||||||
// LUMA decode
|
// LUMA decode
|
||||||
// Apply Blackman window for smoother colors
|
// Apply Blackman window for smoother colors
|
||||||
float window = blackman(float(d/2 + 5), float(FIR_SIZE/2));
|
float window = blackman((offset/2.0 + 10.0), float(FIR_SIZE/2));
|
||||||
yiq.r += s.r * BRIGHTNESS * window;
|
yiq.r += s.r * BRIGHTNESS * window;
|
||||||
// LUMA decode end!
|
// LUMA decode end!
|
||||||
|
|
||||||
// CHROMA encode
|
// CHROMA encode
|
||||||
pos = vec2(vTexCoord.x + (float(d)/CHR_BLUR)*SourceSize.z, vTexCoord.y);
|
pos = vec2(vTexCoord.x + (offset/CHR_BLUR)*SourceSize.z+odd, vTexCoord.y);
|
||||||
s = texture(Source, pos).rgb;
|
s = texture(Source, pos).rgb;
|
||||||
|
|
||||||
s = rgb_to_yiq*s;
|
s = rgb_to_yiq*s;
|
||||||
s.yz *= vec2(cos(fc*vTexCoord.x+11.0*PI/60.0),sin(fc*vTexCoord.x+11.0*PI/60.0));
|
s.yz *= vec2(cos(phase),sin(phase));
|
||||||
// CHROMA encode end
|
// CHROMA encode end
|
||||||
|
|
||||||
// CHROMA decode
|
// CHROMA decode
|
||||||
// Apply Blackman window for smoother colors
|
// Apply Blackman window for smoother colors
|
||||||
window = blackman(float(d + FIR_SIZE), float(FIR_SIZE * 2 + 1));
|
window = blackman( offset + float(FIR_SIZE), float(FIR_SIZE * 2 + 1));
|
||||||
float wt = fc * (vTexCoord.x - float(d)*SourceSize.z);
|
float wt = fc*(vTexCoord.x + offset*SourceSize.z)+11.0*PI/60.0;
|
||||||
yiq.yz += s.yz * vec2(cos(wt+11.0*PI/60.0), sin(wt+11.0*PI/60.0)) * window;
|
|
||||||
|
yiq.yz += s.yz * vec2(cos(wt), sin(wt)) * window;
|
||||||
// CHROMA decode end!
|
// CHROMA decode end!
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
|
|
Loading…
Reference in a new issue