From e2f2a84cc61da49cfb9b2c698abe0bcd39d491aa Mon Sep 17 00:00:00 2001 From: metallic77 <43163462+metallic77@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:47:22 +0300 Subject: [PATCH] update ntsc-simple (#485) * Update ntsc-simple-1.glsl remove c64-low (non existant?) * Update ntsc-simple-2.glsl * Update ntsc-simple-1.glsl * Update ntsc-simple-2.glsl * Update ntsc-simple-1.glsl * Update ntsc-simple-2.glsl * Update ntsc-simple-2.glsl * Update ntsc-simple-2.glsl * Update ntsc-simple-1.glsl * Update ntsc-simple-2.glsl --- ntsc/shaders/ntsc-simple/ntsc-simple-1.glsl | 22 ++++++++----------- ntsc/shaders/ntsc-simple/ntsc-simple-2.glsl | 24 +++++++++------------ 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/ntsc/shaders/ntsc-simple/ntsc-simple-1.glsl b/ntsc/shaders/ntsc-simple/ntsc-simple-1.glsl index 86856da..1ea20bf 100644 --- a/ntsc/shaders/ntsc-simple/ntsc-simple-1.glsl +++ b/ntsc/shaders/ntsc-simple/ntsc-simple-1.glsl @@ -103,18 +103,16 @@ void main() float system_clock = 21.47727273/4.0; // md uses 15*ntsc clock and each pixel has 8 cycles if (system_choose == 1.0) system_clock = NTSC_CLOCK/(15.0*NTSC_CLOCK/8.0); - if (system_choose == 4.0) system_clock = PAL_CLOCK/7.0; - // c64 high - if (system_choose == 5.0) system_clock = PAL_CLOCK/7.882; - // c64 low - if (system_choose == 6.0) system_clock = PAL_CLOCK/7.882/2.0; - // Atari 2600 - if (system_choose == 7.0) system_clock = 1.0; + if (system_choose == 4.0) system_clock = PAL_CLOCK/7.0/2.0; + // c64 runs 4*PAL/NTSC then divides 18 or 14(ntsc), feeds the cpu freq, then runs 8x times of cpu + if (system_choose == 5.0) system_clock = PAL_CLOCK/(PAL_CLOCK*4.0/18.0*8.0); + // Atari 2600 is 1:1 ntsc + if (system_choose == 6.0) system_clock = 3.579545*2.0; // stella outputs double pixels? float phase_alt = NTSC_CLOCK/system_clock; float v_phase_alt = phase_alt; - float timer = mod(float(FrameCount),2.0); + float timer = mod(float(FrameCount/2),2.0); float hue_u = 0.0; float hue_v = 0.0; // md doesn't alternate every line, doesn't animate too @@ -123,13 +121,11 @@ void main() if (system_choose == 2.0) {v_phase_alt = 1.0; timer = 0.0;} if (system_choose == 3.0) {v_phase_alt = 0.0; timer = 0.0;} float altv = 0.0; - if (system_choose == 4.0) {v_phase_alt = 0.0; timer = 0.0;hue_u = -1.4; - hue_v = -1.8; altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} + if (system_choose == 4.0) {v_phase_alt = 0.0; timer = 0.0;hue_u = 1.8; + hue_v = 1.8; altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} if (system_choose == 5.0) {v_phase_alt = 0.0; timer = 0.0;hue_u = -3.2; hue_v = -3.0; altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} - if (system_choose == 6.0) {v_phase_alt = 0.0; timer = 0.0;hue_u = -1.0; - hue_v = -1.3; altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} - if (system_choose == 7.0) {hue_u = 1.6; hue_v = 1.8;v_phase_alt = 0.0; timer = 0.0;} + if (system_choose == 6.0) {hue_u = -1.4;hue_v = -1.3;v_phase_alt = 1.0; timer = 0.0;} if (anim_overr == 1.0) timer = mod(float(FrameCount),2.0); vec3 res = COMPAT_TEXTURE(Source, vTexCoord).rgb*rgb2yuv; diff --git a/ntsc/shaders/ntsc-simple/ntsc-simple-2.glsl b/ntsc/shaders/ntsc-simple/ntsc-simple-2.glsl index 7fc6b35..b338be0 100644 --- a/ntsc/shaders/ntsc-simple/ntsc-simple-2.glsl +++ b/ntsc/shaders/ntsc-simple/ntsc-simple-2.glsl @@ -1,10 +1,10 @@ #if defined(VERTEX) -#pragma parameter bogus "0:nes/snes 1:md 2:pce 3:ms 4:ZXSp 5:c64-high 6:c64-low 7:a2600" 0.0 0.0 0.0 0.0 -#pragma parameter system_choose "System choose" 0.0 0.0 7.0 1.0 +#pragma parameter bogus "0:nes/snes 1:md 2:pce 3:ms/md256 4:ZXSp 5:c64 6:a2600" 0.0 0.0 0.0 0.0 +#pragma parameter system_choose "System choose" 0.0 0.0 6.0 1.0 #pragma parameter steps "Filter Size (faster)" 4.0 1.0 16.0 1.0 #pragma parameter ntsc_sharp "NTSC Sharpness" 0.1 0.0 1.0 0.01 -#pragma parameter ntsc_sat "NTSC Saturation" 2.5 0.0 4.0 0.05 +#pragma parameter ntsc_sat "NTSC Saturation" 2.0 0.0 4.0 0.05 #pragma parameter anim_overr "Force Animate Artifacts" 0.0 0.0 1.0 1.0 #if __VERSION__ >= 130 @@ -108,17 +108,15 @@ void main() float system_clock = 21.47727273/4.0; if (system_choose == 1.0) system_clock = NTSC_CLOCK/(15.0*NTSC_CLOCK/8.0); // ZX Spectrum PAL clock - if (system_choose == 4.0) system_clock = PAL_CLOCK/7.0; - // c64 high - if (system_choose == 5.0) system_clock = PAL_CLOCK/7.882; // 320*200 pal - // c64 low - if (system_choose == 6.0) system_clock = PAL_CLOCK/7.882/2.0; // 160*200 pal - // Atari 2600 - if (system_choose == 7.0) system_clock = 1.0; // A2600 is 1:1 ntsc clock + if (system_choose == 4.0) system_clock = PAL_CLOCK/7.0/2.0; + // c64 runs 4*PAL/NTSC then divides 18 or 14(ntsc), feeds the cpu freq, then runs 8x times of cpu + if (system_choose == 5.0) system_clock = PAL_CLOCK/(PAL_CLOCK*4.0/18.0*8.0); + // Atari 2600 is 1:1 ntsc + if (system_choose == 6.0) system_clock = 3.579545*2.0; // stella outputs double pixels? float phase_alt = NTSC_CLOCK/system_clock; float v_phase_alt = phase_alt; - float timer = mod(float(FrameCount),2.0); + float timer = mod(float(FrameCount/2),2.0); // md doesn't alternate every line, doesn't animate too if (system_choose == 1.0) {v_phase_alt =0.0; timer = 0.0;} @@ -130,9 +128,7 @@ void main() altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} if (system_choose == 5.0 || system_choose == 6.0) {v_phase_alt = 0.0; timer = 0.0; altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} - if (system_choose == 6.0) {v_phase_alt = 0.0; timer = 0.0; - altv = mod(floor(vTexCoord.y * SourceSize.y + 0.5), 2.0) * pi;} - if (system_choose == 7.0) {v_phase_alt = 0.0; timer = 0.0; } + if (system_choose == 6.0) {v_phase_alt = 0.0; timer = 0.0; } if (anim_overr == 1.0) timer = mod(float(FrameCount),2.0);