mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-26 01:11:32 +11:00
fix interlacing shader; i think framecount might be b0rk3n
This commit is contained in:
parent
e060625eef
commit
c1de320e4e
|
@ -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;
|
||||
}
|
6
misc/interlacing.slangp
Normal file
6
misc/interlacing.slangp
Normal file
|
@ -0,0 +1,6 @@
|
|||
shaders = 1
|
||||
|
||||
shader0 = interlacing.slang
|
||||
filter_linear0 = false
|
||||
scale_type_0 = source
|
||||
frame_count_mod0 = 4
|
Loading…
Reference in a new issue