Compare commits
No commits in common. "69c14e4151313838b099ff4fef4dd542180d63bf" and "b103d0ca992743351f1c77892c1f5620d5743c87" have entirely different histories.
69c14e4151
...
b103d0ca99
7 changed files with 11 additions and 75 deletions
|
@ -13,34 +13,23 @@ uniform float viewWidth;
|
|||
#include "/module/aberration.frag"
|
||||
#include "/module/horizontal_blur.frag"
|
||||
#include "/module/scanline.frag"
|
||||
#include "/module/signal.frag"
|
||||
|
||||
void main() {
|
||||
vec3 color;
|
||||
|
||||
|
||||
// software post-processing effects
|
||||
#ifdef hBlur
|
||||
color = hblur();
|
||||
#else
|
||||
color = texture2D(gcolor, texcoord).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef aberration
|
||||
color.rb = aberrate().rb;
|
||||
#endif
|
||||
|
||||
#if scanline > 0
|
||||
color = scanlines(color);
|
||||
#endif
|
||||
|
||||
// hardware post-processing effects
|
||||
#if signal == SIGNAL_NTSC
|
||||
color = ntsc(color);
|
||||
#endif
|
||||
|
||||
// physical post-processing effects
|
||||
#ifdef aberration
|
||||
color.rb = aberrate(color).rb;
|
||||
#endif
|
||||
|
||||
|
||||
gl_FragData[0] = vec4(color, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,14 +52,6 @@ suffix.valBits=-bit
|
|||
|
||||
screen.SCREEN=Screen
|
||||
|
||||
option.signal=Signal
|
||||
value.signal.0=RGB (Off)
|
||||
value.signal.1=NTSC
|
||||
|
||||
option.wire=Connector
|
||||
value.wire.0=Composite
|
||||
value.wire.1=S-Video
|
||||
|
||||
option.interlacing=Interlacing
|
||||
|
||||
option.scanline=Scanlines
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0);
|
||||
|
||||
vec3 aberrate(vec3 color) {
|
||||
vec3 aberrate() {
|
||||
vec2 offset = caOffset * abs(cos(texcoord * 3.14));
|
||||
float red = color.r;
|
||||
float blue = color.b;
|
||||
float red = texture2D(gcolor, texcoord - offset).r;
|
||||
float blue = texture2D(gcolor, texcoord + offset).b;
|
||||
|
||||
return vec3(red, 0, blue);
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
#include "/var/signal.glsl"
|
||||
|
||||
#define signal 0 // [0 1]
|
||||
#define wire 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; // 2π * 3.57MHz * x
|
||||
float phase = sin(carrier) * i + cos(carrier) * q;
|
||||
float quad = cos(carrier) * i - sin(carrier) * q;
|
||||
|
||||
// decode faux signal
|
||||
#if wire == WIRE_COMPOSITE
|
||||
float composite = phase + quad + (y * 5.500); // p + q + (y * 5.5MHz)
|
||||
y = round(composite * 5.500) / 30.250;
|
||||
phase = composite - quad - (y * 5.500);
|
||||
quad = composite - phase - (y * 5.500);
|
||||
#endif
|
||||
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 effects
|
||||
screen.SCREEN=signal wire interlacing scanline aberration
|
||||
screen.SCREEN=interlacing scanline aberration
|
||||
|
||||
# console effects
|
||||
screen.CONSOLE.columns=1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#define SCANLINE_SOFT 1
|
||||
#define SCANLINE_HARD 2
|
||||
#define SCANLINE_STRETCH 3
|
||||
#define SCANLINE_SOFT 1
|
||||
#define SCANLINE_HARD 2
|
||||
#define SCANLINE_STRETCH 3
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
#define SIGNAL_RGB 0
|
||||
#define SIGNAL_NTSC 1
|
||||
|
||||
#define WIRE_COMPOSITE 0
|
||||
#define WIRE_SVIDEO 1
|
||||
|
Loading…
Reference in a new issue