created signal effect with NTSC emulation
This commit is contained in:
parent
ac6255175c
commit
b73905e8af
5 changed files with 43 additions and 4 deletions
|
@ -52,6 +52,10 @@ suffix.valBits=-bit
|
||||||
|
|
||||||
screen.SCREEN=Screen
|
screen.SCREEN=Screen
|
||||||
|
|
||||||
|
option.signal=Signal
|
||||||
|
value.signal.0=RGB (Off)
|
||||||
|
value.signal.1=NTSC
|
||||||
|
|
||||||
option.interlacing=Interlacing
|
option.interlacing=Interlacing
|
||||||
|
|
||||||
option.scanline=Scanlines
|
option.scanline=Scanlines
|
||||||
|
|
31
shaders/module/signal.frag
Normal file
31
shaders/module/signal.frag
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
#include "/var/signal.glsl"
|
||||||
|
|
||||||
|
#define signal 0 // [0 1]
|
||||||
|
|
||||||
|
vec3 ntsc(vec3 color) {
|
||||||
|
// convert to YIQ
|
||||||
|
float y = dot(color, vec3(0.299, 0.587, 0.114));
|
||||||
|
float i = dot(color, vec3(0.596, -.274, -.322));
|
||||||
|
float q = dot(color, vec3(0.211, -.523, 0.312));
|
||||||
|
|
||||||
|
// faux ntsc signal
|
||||||
|
float carrier = 6.283 * 3.570 * gl_FragCoord.x;
|
||||||
|
float phase = sin(carrier) * i + cos(carrier) * q;
|
||||||
|
float quad = cos(carrier) * i - sin(carrier) * q;
|
||||||
|
|
||||||
|
// decode faux signal
|
||||||
|
i = quad * cos(carrier);
|
||||||
|
q = phase * sin(carrier);
|
||||||
|
|
||||||
|
// convert back to RGB
|
||||||
|
vec3 yiqColor = vec3(y, i, q);
|
||||||
|
|
||||||
|
vec3 outColor = vec3(0);
|
||||||
|
outColor.r = dot(yiqColor, vec3(1, 0.956, 0.619));
|
||||||
|
outColor.g = dot(yiqColor, vec3(1, -.272, -.674));
|
||||||
|
outColor.b = dot(yiqColor, vec3(1, -1.106, 1.703));
|
||||||
|
|
||||||
|
return outColor;
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ screen.COLOR.columns=3
|
||||||
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
||||||
|
|
||||||
# screen effects
|
# screen effects
|
||||||
screen.SCREEN=interlacing scanline aberration
|
screen.SCREEN=signal <empty> interlacing scanline aberration
|
||||||
|
|
||||||
# console effects
|
# console effects
|
||||||
screen.CONSOLE.columns=1
|
screen.CONSOLE.columns=1
|
||||||
|
|
4
shaders/var/signal.glsl
Normal file
4
shaders/var/signal.glsl
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
#define SIGNAL_RGB 0
|
||||||
|
#define SIGNAL_NTSC 1
|
||||||
|
|
Loading…
Reference in a new issue