Compare commits

..

No commits in common. "f89d8ac3c9a63a843ded745ee8634226fd1d5f48" and "69c14e4151313838b099ff4fef4dd542180d63bf" have entirely different histories.

6 changed files with 20 additions and 54 deletions

View file

@ -33,13 +33,11 @@ void main() {
// hardware post-processing effects
#if signal == SIGNAL_NTSC
color = ntsc(color);
#elif signal == SIGNAL_PAL
color = pal(color);
#endif
// physical post-processing effects
#ifdef aberration
color.rb = aberrate().rb;
color.rb = aberrate(color).rb;
#endif

View file

@ -52,10 +52,9 @@ suffix.valBits=-bit
screen.SCREEN=Screen
option.signal=Encoding
value.signal.0=None
option.signal=Signal
value.signal.0=RGB (Off)
value.signal.1=NTSC
value.signal.2=PAL
option.wire=Connector
value.wire.0=Composite

View file

@ -1,10 +1,10 @@
vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0);
vec3 aberrate() {
vec2 offset = caOffset * cos(texcoord * 3.14);
float red = texture2D(gcolor, texcoord - offset).r;
float blue = texture2D(gcolor, texcoord + offset).b;
vec3 aberrate(vec3 color) {
vec2 offset = caOffset * abs(cos(texcoord * 3.14));
float red = color.r;
float blue = color.b;
return vec3(red, 0, blue);
}

View file

@ -1,16 +1,12 @@
#include "/var/signal.glsl"
#define signal 0 // [0 1 2]
#define signal 0 // [0 1]
#define wire 0 // [0 1]
float luminance(vec3 color) {
return dot(color, vec3(0.299, 0.587, 0.114));
}
vec3 ntsc(vec3 color) {
// convert to YIQ
float y = luminance(color);
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));
@ -21,7 +17,7 @@ vec3 ntsc(vec3 color) {
// decode faux signal
#if wire == WIRE_COMPOSITE
float composite = phase + (y * 5.500); // p + (y * 5.5MHz)
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);
@ -32,38 +28,11 @@ vec3 ntsc(vec3 color) {
// convert back to RGB
vec3 yiqColor = vec3(y, i, q);
float r = dot(yiqColor, vec3(1, 0.956, 0.619));
float g = dot(yiqColor, vec3(1, -.272, -.674));
float b = dot(yiqColor, vec3(1, -1.106, 1.703));
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 vec3(r, g, b).rgb;
}
vec3 pal(vec3 color) {
// convert to YUV
float y = luminance(color);
float u = 0.492 * (color.b - y);
float v = 0.877 * (color.r - y);
// faux pal signal
float carrier = 6.283 * 4.434;
float phase = sin(carrier) * u - cos(carrier) * v;
float quad = cos(carrier) * u - sin(carrier) * v;
// decode faux signal
#if wire == WIRE_COMPOSITE
float composite = y + phase;
#endif
u = quad * cos(carrier);
v = phase * sin(carrier);
// convert back to RGB
vec3 yuvColor = vec3(y, u, v);
float r = y + (1.140 * v);
float g = y - (0.395 * u) - (0.581 * v);
float b = y + (2.033 * u);
return vec3(r, g, b).rgb;
return outColor;
}

View file

@ -7,19 +7,20 @@ profile.DOS=pixelSize=4 colorMode=1 dithering colorDepth=3 vWarp=1 !tWarp !hBlur
profile.DOTMATRIX=pixelSize=4 colorMode=1 colorDepth=1 monoPalette=1 dithering vWarp=1 !tWarp !hBlur !interlacing
profile.OBRADINN=pixelSize=2 colorMode=1 colorDepth=1 monoPalette=0 dithering vWarp=0 !tWarp !hBlur !interlacing
profile.PSX=pixelSize=2 colorMode=1 !dithering colorDepth=24 vWarp=2 tWarp !hBlur interlacing
profile.REALITY=pixelSize=2 colorMode=1 colorDepth=15 !dithering vWarp=0 !tWarp hBlur interlacing
profile.REALITY=profile.PSX vWarp=0 !tWarp hBlur interlacing
profile.SNES=pixelSize=4 colorMode=1 dithering colorDepth=15 vWarp=1 !tWarp !hBlur interlacing
profile.VR32=pixelSize=8 colorMode=1 !dithering colorDepth=1 monoPalette=2 vWarp=1 !tWarp !hBlur !interlacing
# -- SCREENS --
# default
screen=<profile> <empty> <empty> <empty> pixelSize <empty> [COLOR] [SCREEN] [CONSOLE] [FX]
screen=<profile> <empty> pixelSize <empty> [COLOR] [SCREEN] [CONSOLE] [FX]
# colors
screen.COLOR.columns=3
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
# screen effects
screen.SCREEN=signal wire <empty> <empty> interlacing scanline <empty> <empty> aberration
screen.SCREEN=signal wire interlacing scanline aberration
# console effects
screen.CONSOLE.columns=1
@ -28,7 +29,7 @@ screen.PSX=vWarp tWarp # playstation
screen.REALITY=hBlur # nintendo 64
# custom effects
screen.FX=dof dofRes <empty> <empty> worldCurvature worldRadius
screen.FX=dof dofRes worldCurvature worldRadius
# -- CONDITIONALS --
gbuffers_hand.enabled=tWarp

View file

@ -1,7 +1,6 @@
#define SIGNAL_RGB 0
#define SIGNAL_NTSC 1
#define SIGNAL_PAL 2
#define WIRE_COMPOSITE 0
#define WIRE_SVIDEO 1