Compare commits
18 commits
fcd88cd03b
...
4ad3836b84
Author | SHA1 | Date | |
---|---|---|---|
4ad3836b84 | |||
bed3bdc89e | |||
5504d1588d | |||
6fc995e5cb | |||
b9dcdd22d6 | |||
c36e1076f7 | |||
e4c5715b3f | |||
5937638895 | |||
f89d8ac3c9 | |||
981ebea8c8 | |||
6290b0e19e | |||
69c14e4151 | |||
0902b5b835 | |||
b103d0ca99 | |||
fc1c7c7b1a | |||
40111d5e90 | |||
933cb21020 | |||
7668d7a744 |
16 changed files with 229 additions and 49 deletions
|
@ -125,20 +125,20 @@ void main() {
|
|||
#endif
|
||||
vec3 color = texture2D(gcolor, newcoord).rgb;
|
||||
|
||||
#if colorMode == 0
|
||||
#if colorMode == MODE_HSV
|
||||
color = rgb2hsv(color).xyz;
|
||||
#endif
|
||||
|
||||
vec3 final;
|
||||
#ifdef dithering
|
||||
#if colorMode == 0
|
||||
#if colorMode == MODE_HSV
|
||||
vec3 filtered = vec3(dither(color.x, hueMax), dither(color.y, satMax), dither(color.z, valMax)).rgb;
|
||||
final = hsv2rgb(filtered);
|
||||
#else
|
||||
final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z));
|
||||
#endif
|
||||
#else
|
||||
#if colorMode == 0
|
||||
#if colorMode == MODE_HSV
|
||||
vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb;
|
||||
final = hsv2rgb(filtered);
|
||||
#else
|
||||
|
@ -146,9 +146,11 @@ void main() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if colorMode == 1 && colorDepth == 1
|
||||
#if colorMode == MODE_RGB && colorDepth == 1
|
||||
if(final.r == 1)
|
||||
final = monoColor;
|
||||
final = monoHigh;
|
||||
else
|
||||
final = monoLow;
|
||||
#endif
|
||||
|
||||
#ifdef interlacing
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//#define aberration
|
||||
//#define hBlur
|
||||
//#define scanlines
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
|
@ -13,26 +12,37 @@ 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;
|
||||
#if scanline > 0
|
||||
color = scanlines(color);
|
||||
#endif
|
||||
|
||||
#ifdef scanlines
|
||||
if(mod(int(gl_FragCoord.y / (pixelSize * 2)), 2) == 0)
|
||||
color.rgb *= 0.95;
|
||||
else
|
||||
color.rgb /= 0.95;
|
||||
// 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 = (color.rb + aberrate().rb) / 2;
|
||||
#endif
|
||||
|
||||
|
||||
gl_FragData[0] = vec4(color, 1);
|
||||
}
|
||||
|
||||
|
|
10
shaders/gbuffers_damagedblock.fsh
Normal file
10
shaders/gbuffers_damagedblock.fsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 120
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
void main() {
|
||||
gl_FragData[0] = texture2D(texture, texcoord);
|
||||
}
|
||||
|
3
shaders/gbuffers_damagedblock.vsh
Normal file
3
shaders/gbuffers_damagedblock.vsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
#include "/gbuffers_basic.vsh"
|
||||
|
|
@ -3,12 +3,14 @@ profile.DEFAULT=Default
|
|||
profile.AEON=Aeon Upstream
|
||||
profile.DOS=DOS
|
||||
profile.DOTMATRIX=Dot Matrix Game
|
||||
profile.EIGHTBIT=8-bit
|
||||
profile.OBRADINN=Obra Dinn
|
||||
profile.PSX=PSX
|
||||
profile.REALITY=Project Reality
|
||||
profile.SNES=Super Famicom
|
||||
profile.VR32=VR32
|
||||
|
||||
|
||||
option.pixelSize=Downscaling
|
||||
value.pixelSize.1=Off
|
||||
value.pixelSize.2=Low (2x)
|
||||
|
@ -16,11 +18,15 @@ value.pixelSize.4=Medium (4x)
|
|||
value.pixelSize.8=High (8x)
|
||||
value.pixelSize.16=Silly (16x)
|
||||
|
||||
|
||||
screen.COLOR=Color
|
||||
|
||||
option.colorMode=Color Mode
|
||||
value.colorMode.0=HSV
|
||||
value.colorMode.1=RGB
|
||||
|
||||
option.dithering=Dithering
|
||||
|
||||
option.colorDepth=RGB Depth
|
||||
value.colorDepth.1=Monochrome
|
||||
value.colorDepth.3=3-bit
|
||||
|
@ -30,10 +36,13 @@ value.colorDepth.12=12-bit
|
|||
value.colorDepth.15=15-bit
|
||||
value.colorDepth.18=18-bit
|
||||
value.colorDepth.24=Truecolor
|
||||
|
||||
option.monoPalette=Mono Palette
|
||||
value.monoPalette.0=Black & White
|
||||
value.monoPalette.1=Dot Matrix
|
||||
value.monoPalette.2=Paint the Town
|
||||
value.monoPalette.3=Noir
|
||||
|
||||
option.hueBits=Hue Depth
|
||||
suffix.hueBits=-bit
|
||||
option.satBits=Saturation Depth
|
||||
|
@ -41,14 +50,32 @@ suffix.satBits=-bit
|
|||
option.valBits=Value Depth
|
||||
suffix.valBits=-bit
|
||||
|
||||
|
||||
screen.SCREEN=Screen
|
||||
|
||||
option.signal=Encoding
|
||||
value.signal.0=None
|
||||
value.signal.1=NTSC
|
||||
value.signal.2=PAL
|
||||
|
||||
option.wire=Connector
|
||||
value.wire.0=Composite
|
||||
value.wire.1=S-Video
|
||||
|
||||
option.interlacing=Interlacing
|
||||
option.scanlines=Scanlines
|
||||
|
||||
option.scanline=Scanlines
|
||||
value.scanline.0=Off
|
||||
value.scanline.1=Soft
|
||||
value.scanline.2=Hard
|
||||
|
||||
option.aberration=Chromatic Aberration
|
||||
|
||||
|
||||
screen.CONSOLE=Consoles
|
||||
|
||||
screen.PSX=PSX (1994)
|
||||
|
||||
option.vWarp=Vertex Warping
|
||||
option.vWarp.comment=Emulates screen-space vertex snapping responsible for vertex wobble on the Playstation
|
||||
value.vWarp.0=Off
|
||||
|
@ -58,24 +85,30 @@ value.vWarp.4=Medium (4x)
|
|||
value.vWarp.8=High (8x)
|
||||
value.vWarp.16=Extreme (16x)
|
||||
value.vWarp.32=Silly (32x)
|
||||
|
||||
option.tWarp=Texture Warping
|
||||
option.tWarp.comment=Emulates affine texture mapping responsible for warping textures on the Playstation
|
||||
|
||||
|
||||
screen.REALITY=Project Reality (1996)
|
||||
|
||||
option.hBlur=Horizontal Blur
|
||||
option.hBlur.comment=Emulates the blur responsible for reducing LCD clarity on the N64
|
||||
|
||||
|
||||
screen.FX=FX
|
||||
|
||||
option.dof=Depth of Field
|
||||
option.dof.comment=Downscale out-of-focus objects
|
||||
|
||||
option.dofRes=DoF Dither
|
||||
option.dofRes.comment=Whether DoF focus affects dither resolution.
|
||||
value.dofRes.0=Static
|
||||
value.dofRes.1=Dynamic
|
||||
|
||||
option.worldCurvature=World Curvature
|
||||
value.worldCurvature.0=Off
|
||||
value.worldCurvature.1=Cylinder
|
||||
value.worldCurvature.2=Round
|
||||
|
||||
option.worldRadius=Curvature Strength
|
||||
value.worldRadius.1024=Low (1024)
|
||||
value.worldRadius.512=Medium (512)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0);
|
||||
|
||||
vec3 aberrate() {
|
||||
vec2 offset = caOffset * abs(cos(texcoord * 3.14));
|
||||
float red = texture2D(gcolor, texcoord - offset).r;
|
||||
float blue = texture2D(gcolor, texcoord + offset).b;
|
||||
vec2 offset = caOffset * cos(texcoord * 3.14);
|
||||
float red = texture2D(gcolor, texcoord + offset).r;
|
||||
float blue = texture2D(gcolor, texcoord - offset).b;
|
||||
|
||||
return vec3(red, 0, blue);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
#include "/var/color_depth.glsl"
|
||||
|
||||
#define colorMode 0 // [0 1]
|
||||
|
||||
#define hueBits 2 // [1 2 3 4 5 6 7 8]
|
||||
|
@ -6,9 +8,9 @@
|
|||
#define valBits 2 // [1 2 3 4 5 6 7 8]
|
||||
|
||||
#define colorDepth 6 // [1 3 6 8 12 15 18 24]
|
||||
#define monoPalette 0 // [0 1 2]
|
||||
#define monoPalette 0 // [0 1 2 3]
|
||||
|
||||
#if colorMode == 0
|
||||
#if colorMode == MODE_HSV
|
||||
// -- HSV --
|
||||
|
||||
float bit_max(int bits) {
|
||||
|
@ -41,12 +43,18 @@
|
|||
vec3 colormax = vec3(256, 256, 256);
|
||||
#endif
|
||||
|
||||
#if monoPalette == 0
|
||||
vec3 monoColor = vec3(1, 1, 1);
|
||||
#elif monoPalette == 1
|
||||
vec3 monoColor = vec3(0.48, 0.72, 0.28);
|
||||
#elif monoPalette == 2
|
||||
vec3 monoColor = vec3(1, 0, 0);
|
||||
#if monoPalette == MONOCHROME_BW
|
||||
vec3 monoHigh = vec3(1);
|
||||
vec3 monoLow = vec3(0);
|
||||
#elif monoPalette == MONOCHROME_DOTMATRIX
|
||||
vec3 monoHigh = vec3(0.31, 0.40, 0.03);
|
||||
vec3 monoLow = vec3(0.17, 0.29, 0.13);
|
||||
#elif monoPalette == MONOCHROME_MOTIONSICK
|
||||
vec3 monoHigh = vec3(1, 0, 0);
|
||||
vec3 monoLow = vec3(0);
|
||||
#elif monoPalette == MONOCHROME_NOIR
|
||||
vec3 monoHigh = vec3(0.73, 0.67, 0.55);
|
||||
vec3 monoLow = vec3(0.26, 0.23, 0.19);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,21 +8,16 @@ float avg(float l, float c, float r) {
|
|||
vec3 hblur() {
|
||||
vec3 center = texture2D(gcolor, texcoord).rgb;
|
||||
|
||||
vec2 leftPos = texcoord - neighborOffset;
|
||||
vec2 rightPos = texcoord + neighborOffset;
|
||||
vec3 sum = vec3(0);
|
||||
int count = 0;
|
||||
for(int x = -2; x < 2; x++) {
|
||||
vec2 pos = texcoord - (neighborOffset * x);
|
||||
if(pos.x >= 0 && pos.x < viewWidth) {
|
||||
sum += texture2D(gcolor, pos).rgb;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
vec3 left;
|
||||
if(leftPos.x >= 0)
|
||||
left = texture2D(gcolor, leftPos).rgb;
|
||||
else
|
||||
left = center;
|
||||
|
||||
vec3 right;
|
||||
if(rightPos.x >= 0)
|
||||
right = texture2D(gcolor, rightPos).rgb;
|
||||
else
|
||||
right = center;
|
||||
|
||||
return vec3(avg(left.r, center.r, right.r), avg(left.g, center.g, right.g), avg(left.b, center.b, right.b));
|
||||
return sum / count;
|
||||
}
|
||||
|
||||
|
|
18
shaders/module/scanline.frag
Normal file
18
shaders/module/scanline.frag
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
#include "/var/scanline.glsl"
|
||||
|
||||
#define scanline 0 // [0 1 2]
|
||||
|
||||
vec3 scanlines(vec3 color) {
|
||||
#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) == 0)
|
||||
color.rgb *= 0.5;
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
|
69
shaders/module/signal.frag
Normal file
69
shaders/module/signal.frag
Normal file
|
@ -0,0 +1,69 @@
|
|||
|
||||
#include "/var/signal.glsl"
|
||||
|
||||
#define signal 0 // [0 1 2]
|
||||
#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 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 + (y * 5.500); // p + (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);
|
||||
|
||||
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));
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
|
||||
#include "/var/world.glsl"
|
||||
|
||||
#define worldCurvature 0 // [0 1 2]
|
||||
#define worldRadius 512 // [1024 512 256 -256]
|
||||
|
||||
void world_curvature() {
|
||||
#if worldCurvature == 1
|
||||
#if worldCurvature == CURVATURE_CYLINDER
|
||||
float z = gl_Position.z * gl_Position.z;
|
||||
gl_Position.y -= 2 * z / worldRadius;
|
||||
#elif worldCurvature == 2
|
||||
#elif worldCurvature == CURVATURE_ROUND
|
||||
vec2 xz = gl_Position.xz;
|
||||
gl_Position.y -= round(( dot(xz, xz) / worldRadius ) * 8) / 8;
|
||||
#endif
|
||||
|
|
|
@ -5,22 +5,22 @@ profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueBits=2 satBits=2 valBits=2
|
|||
profile.AEON=pixelSize=1 colorMode=0 dithering hueBits=3 satBits=2 valBits=2 vWarp=0 !tWarp !hBlur !interlacing
|
||||
profile.DOS=pixelSize=4 colorMode=1 dithering colorDepth=3 vWarp=1 !tWarp !hBlur !interlacing
|
||||
profile.DOTMATRIX=pixelSize=4 colorMode=1 colorDepth=1 monoPalette=1 dithering vWarp=1 !tWarp !hBlur !interlacing
|
||||
profile.EIGHTBIT=pixelSize=4 colorMode=1 dithering colorDepth=8 vWarp=0 !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=profile.PSX vWarp=0 !tWarp hBlur interlacing
|
||||
profile.SNES=pixelSize=4 colorMode=1 dithering colorDepth=15 vWarp=1 !tWarp !hBlur interlacing
|
||||
profile.REALITY=pixelSize=2 colorMode=1 colorDepth=15 !dithering vWarp=0 !tWarp hBlur interlacing
|
||||
profile.VR32=pixelSize=8 colorMode=1 !dithering colorDepth=1 monoPalette=2 vWarp=1 !tWarp !hBlur !interlacing
|
||||
|
||||
# -- SCREENS --
|
||||
# default
|
||||
screen=<profile> <empty> pixelSize <empty> [COLOR] [SCREEN] [CONSOLE] [FX]
|
||||
screen=<profile> <empty> <empty> <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=interlacing scanlines aberration
|
||||
screen.SCREEN=signal wire interlacing scanline <empty> <empty> aberration
|
||||
|
||||
# console effects
|
||||
screen.CONSOLE.columns=1
|
||||
|
@ -29,7 +29,7 @@ screen.PSX=vWarp tWarp # playstation
|
|||
screen.REALITY=hBlur # nintendo 64
|
||||
|
||||
# custom effects
|
||||
screen.FX=dof dofRes worldCurvature worldRadius
|
||||
screen.FX=dof dofRes <empty> <empty> worldCurvature worldRadius
|
||||
|
||||
# -- CONDITIONALS --
|
||||
gbuffers_hand.enabled=tWarp
|
||||
|
|
11
shaders/var/color_depth.glsl
Normal file
11
shaders/var/color_depth.glsl
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
// color mode IDs
|
||||
#define MODE_HSV 0
|
||||
#define MODE_RGB 1
|
||||
|
||||
// monochrome palette IDs
|
||||
#define MONOCHROME_BW 0
|
||||
#define MONOCHROME_DOTMATRIX 1
|
||||
#define MONOCHROME_MOTIONSICK 2
|
||||
#define MONOCHROME_NOIR 3
|
||||
|
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
|
||||
|
8
shaders/var/signal.glsl
Normal file
8
shaders/var/signal.glsl
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
#define SIGNAL_RGB 0
|
||||
#define SIGNAL_NTSC 1
|
||||
#define SIGNAL_PAL 2
|
||||
|
||||
#define WIRE_COMPOSITE 0
|
||||
#define WIRE_SVIDEO 1
|
||||
|
6
shaders/var/world.glsl
Normal file
6
shaders/var/world.glsl
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
// world curvature IDs
|
||||
#define CURVATURE_OFF 0
|
||||
#define CURVATURE_CYLINDER 1
|
||||
#define CURVATURE_ROUND 2
|
||||
|
Loading…
Reference in a new issue