added 'hard' scanline option
This commit is contained in:
parent
933cb21020
commit
40111d5e90
4 changed files with 28 additions and 6 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
17
shaders/module/scanline.frag
Normal file
17
shaders/module/scanline.frag
Normal 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
|
||||
}
|
||||
|
5
shaders/var/scanline.glsl
Normal file
5
shaders/var/scanline.glsl
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
#define SCANLINE_SOFT 1
|
||||
#define SCANLINE_HARD 2
|
||||
#define SCANLINE_STRETCH 3
|
||||
|
Loading…
Reference in a new issue