From cce018f62015c126d643aa85248ecb5af2953e54 Mon Sep 17 00:00:00 2001 From: Valerie Date: Sat, 20 Apr 2024 20:47:00 -0400 Subject: [PATCH 1/2] initial implementation of interlace effect --- shaders/composite.fsh | 17 +++++++++++++++-- shaders/lang/en_US.lang | 1 + shaders/module/interlace.frag | 10 ++++++++++ shaders/shaders.properties | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 shaders/module/interlace.frag diff --git a/shaders/composite.fsh b/shaders/composite.fsh index 881cce2..c5e4a7f 100644 --- a/shaders/composite.fsh +++ b/shaders/composite.fsh @@ -14,12 +14,12 @@ float renderRes = pixelSize; #define rgbSteps 4 // the number of rgb values to use [2 4 8 16 32 64] uniform sampler2D gcolor; -uniform sampler2D colortex1; uniform float viewWidth, viewHeight; varying vec2 texcoord; #include "/module/dof.frag" +#include "/module/interlace.frag" // All components are in the range [0…1], including hue. vec3 rgb2hsv(vec3 c) @@ -151,6 +151,19 @@ void main() { final = vec3(lightnessStep(color.r, rgbSteps), lightnessStep(color.g, rgbSteps), lightnessStep(color.b, rgbSteps)).rgb; #endif #endif - gl_FragData[0] = vec4(vec3(final), 1.0); //gcolor + + #ifdef interlacing + /* DRAWBUFFERS:01 */ + // pull previous buffer + vec3 prev = texture2D(colortex1, texcoord).rgb; + // interlace alternates between odd and even lines on world time + if(mod(int(gl_FragCoord.y / pixelSize), 2) == mod(worldTime, 2)) + gl_FragData[0] = vec4(prev, 1); + else + gl_FragData[0] = vec4(final, 1); + gl_FragData[1] = vec4(final, 1); + #else + gl_FragData[0] = vec4(final, 1.0); + #endif } diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang index 52eef69..afaad72 100644 --- a/shaders/lang/en_US.lang +++ b/shaders/lang/en_US.lang @@ -24,6 +24,7 @@ option.satSteps=Saturation Depth option.valSteps=Value Depth screen.SCREEN=Screen +option.interlacing=Interlacing option.aberration=Chromatic Aberration screen.CONSOLE=Consoles diff --git a/shaders/module/interlace.frag b/shaders/module/interlace.frag new file mode 100644 index 0000000..5f7e8b0 --- /dev/null +++ b/shaders/module/interlace.frag @@ -0,0 +1,10 @@ + +//#define interlacing + +#ifdef interlacing + uniform sampler2D colortex1; + const bool colortex1Clear = false; + + uniform int worldTime; +#endif + diff --git a/shaders/shaders.properties b/shaders/shaders.properties index cf3fb46..610c98a 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -17,7 +17,7 @@ screen.COLOR.columns=3 screen.COLOR=colorMode dithering rgbSteps hueSteps satSteps valSteps # screen effects -screen.SCREEN=aberration +screen.SCREEN=interlacing aberration # console effects screen.CONSOLE.columns=1 From d1737aef6b92986ccd976dc9c05f9b06624bd434 Mon Sep 17 00:00:00 2001 From: Valerie Date: Sat, 20 Apr 2024 20:47:45 -0400 Subject: [PATCH 2/2] added interlace to relevant profiles --- shaders/shaders.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 610c98a..1e1cb19 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -1,12 +1,12 @@ sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp # -- PROFILES -- -profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur -profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur -profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur -profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 tWarp !hBlur -profile.REALITY=profile.PSX !tWarp hBlur -profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp !hBlur +profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur !interlacing +profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur !interlacing +profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur !interlacing +profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 tWarp !hBlur interlacing +profile.REALITY=profile.PSX !tWarp hBlur interlacing +profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp !hBlur !interlacing # -- SCREENS -- # default