added 'hard' scanline option

This commit is contained in:
Valerie Wolfe 2024-05-03 22:08:09 -04:00
parent 933cb21020
commit 40111d5e90
4 changed files with 28 additions and 6 deletions

View file

@ -4,7 +4,6 @@
//#define aberration
//#define hBlur
//#define scanlines
varying vec2 texcoord;
@ -13,6 +12,7 @@ uniform float viewWidth;
#include "/module/aberration.frag"
#include "/module/horizontal_blur.frag"
#include "/module/scanline.frag"
void main() {
vec3 color;
@ -26,11 +26,8 @@ void main() {
color.rb = aberrate().rb;
#endif
#ifdef scanlines
if(mod(int(gl_FragCoord.y / (pixelSize * 2)), 2) == 0)
color.rgb *= 0.95;
else
color.rgb /= 0.95;
#if scanline > 0
color = scanlines(color);
#endif
gl_FragData[0] = vec4(color, 1);

View file

@ -55,6 +55,9 @@ screen.SCREEN=Screen
option.interlacing=Interlacing
option.scanlines=Scanlines
value.scanlines.0=Off
value.scanlines.1=Soft
value.scanlines.2=Hard
option.aberration=Chromatic Aberration

View file

@ -0,0 +1,17 @@
#include "/var/scanline.glsl"
#define scanline 0 // [0 1 2]
public void scanlines() {
#if scanline == SCANLINE_SOFT
if(mod(int(gl_FragCoord.y) / (pixelSize * 2), 2) == 0)
color.rgb *= 0.95;
else
color.rgb /= 0.95;
#elif scanline == SCANLINE_HARD
if(mod(int(gl_FragCoord.y) / (pixelSize * 2), 2) == 0)
color.rgb *= 0.5;
#endif
}

View file

@ -0,0 +1,5 @@
#define SCANLINE_SOFT 1
#define SCANLINE_HARD 2
#define SCANLINE_STRETCH 3