From c1de320e4e21c31e3bb5085d6a6762434f4e4f1c Mon Sep 17 00:00:00 2001 From: hunterk Date: Tue, 19 Jul 2016 16:18:36 -0500 Subject: [PATCH] fix interlacing shader; i think framecount might be b0rk3n --- misc/interlacing.slang | 14 ++++++++------ misc/interlacing.slangp | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 misc/interlacing.slangp diff --git a/misc/interlacing.slang b/misc/interlacing.slang index bd2efbd..fa7e361 100644 --- a/misc/interlacing.slang +++ b/misc/interlacing.slang @@ -11,7 +11,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #define percent 0.0 #define enable_480i 1.0 -#define top_field_first 0.0 +#define top_field_first 1.0 /* Interlacing @@ -42,15 +42,17 @@ void main() { vec4 res = texture(Source, vTexCoord).rgba; float y = 0.0; + float tick = global.FrameCount; // assume anything with a vertical resolution greater than 400 lines is interlaced - if (global.SourceSize.w > 400.0) - {y = global.SourceSize.y * vTexCoord.y + (global.FrameCount * enable_480i) + top_field_first;} + if (global.SourceSize.y > 400.0) + {y = global.SourceSize.y * (vTexCoord.y + 0.5 / global.SourceSize.y) + ((tick * 1.00) * enable_480i) + top_field_first;} else {y = 2.0 * global.SourceSize.y * vTexCoord.y + top_field_first;} - if (mod(y, 2.0) > 0.99999) - {FragColor = res;} + if (mod(y, 1.99999) > 0.99999) + {res = res;} else - {FragColor = vec4(percent) * res;} + {res = vec4(percent) * res;} + FragColor = res; } \ No newline at end of file diff --git a/misc/interlacing.slangp b/misc/interlacing.slangp new file mode 100644 index 0000000..c9f6ec8 --- /dev/null +++ b/misc/interlacing.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = interlacing.slang +filter_linear0 = false +scale_type_0 = source +frame_count_mod0 = 4