Compare commits
40 commits
Author | SHA1 | Date | |
---|---|---|---|
4ad3836b84 | |||
bed3bdc89e | |||
5504d1588d | |||
6fc995e5cb | |||
b9dcdd22d6 | |||
c36e1076f7 | |||
e4c5715b3f | |||
5937638895 | |||
f89d8ac3c9 | |||
981ebea8c8 | |||
6290b0e19e | |||
69c14e4151 | |||
0902b5b835 | |||
b103d0ca99 | |||
fc1c7c7b1a | |||
40111d5e90 | |||
933cb21020 | |||
7668d7a744 | |||
fcd88cd03b | |||
a2d2fa04d0 | |||
3344d03e60 | |||
6249bd802b | |||
26f163cc60 | |||
605e54a522 | |||
375ccf3621 | |||
fc7bfab368 | |||
984db64c8c | |||
944e474a22 | |||
1506d90dc5 | |||
1351b17f22 | |||
e4b1d8b6f4 | |||
d1737aef6b | |||
cce018f620 | |||
a0dcb98e96 | |||
58cd744a2f | |||
eab55046b8 | |||
13a07850ac | |||
8da7185ead | |||
038ff7f142 | |||
9edd7782c6 |
22 changed files with 409 additions and 72 deletions
15
README.md
15
README.md
|
@ -5,17 +5,28 @@ aimed at providing a variety of effects in the vein of its parent project.
|
|||
|
||||
## Features
|
||||
|
||||
- Affine Texture Warping
|
||||
- Chromatic Aberration
|
||||
- Color depth reduction
|
||||
- Depth of Field
|
||||
- Dithering
|
||||
- Downscaling
|
||||
- Horizontal Blur
|
||||
- Interlacing
|
||||
- Monochrome Mode & Palettes
|
||||
- Scanlines
|
||||
- Screen-Space Vertex Warping
|
||||
- Affine Texture Warping
|
||||
- World Curvature
|
||||
|
||||
## Screenshots
|
||||
|
||||
![2024-04-18_17 04 13](https://github.com/sleeplessval/aeon/assets/73970075/d2022abe-f39a-4e3d-a0d7-5b6d62147d9f)
|
||||
![2024-04-11_12 58 13](https://github.com/sleeplessval/aeon/assets/73970075/7ced7d92-b032-4b5c-b314-d6fce4b0ed41)
|
||||
![2024-04-17_11 09 10](https://github.com/sleeplessval/aeon/assets/73970075/b5c7b217-19de-45ca-8e1c-20002286997e)
|
||||
![2024-04-21_21 16 47](https://github.com/sleeplessval/aeon/assets/73970075/26961585-845d-4054-9b5a-f0158d6fae9c)
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- [Alex Charlton's post "Dithering on the GPU"](http://alex-charlton.com/posts/Dithering_on_the_GPU/).
|
||||
- [BSL Shaders by CaptainTatsu](https://bitslablab.com/bslshaders/), whose downscale effect was my inspiration for forking a shader.
|
||||
- [BSL Shaders by CaptainTatsu](https://bitslablab.com/bslshaders/). Combining downscale with dithering is the reason I forked a shader in the first place.
|
||||
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
#version 120
|
||||
|
||||
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
|
||||
#include "/module/common.glsl"
|
||||
|
||||
float renderRes = pixelSize;
|
||||
|
||||
#define dithering // whether or not to apply dithering
|
||||
#define colorMode 0 // hsv/rgb [0 1]
|
||||
|
||||
#define hueSteps 4 // the number of hues to use [2 4 8 16 32 64]
|
||||
#define satSteps 4 // the number of saturations to use [2 4 8 16 32 64]
|
||||
#define valSteps 4 // the number of lightnesses to use [2 4 8 16 32 64]
|
||||
|
||||
#define rgbSteps 4 // the number of rgb values to use [2 4 8 16 32 64]
|
||||
|
||||
uniform sampler2D gcolor;
|
||||
uniform sampler2D colortex1;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
#include "/module/color_depth.frag"
|
||||
#include "/module/dof.frag"
|
||||
#include "/module/interlace.frag"
|
||||
|
||||
// All components are in the range [0…1], including hue.
|
||||
vec3 rgb2hsv(vec3 c)
|
||||
|
@ -103,7 +98,7 @@ vec3[2] closestColors(float hue) {
|
|||
}
|
||||
|
||||
float lightnessStep(float l, float lightnessSteps) {
|
||||
/* Quantize the lightness to one of `lightnessSteps` values */
|
||||
/* Quantize the lightness to one of `lightnessSteps` values */;
|
||||
return floor((0.5 + l * (lightnessSteps - 1.0))) / (lightnessSteps - 1.0);
|
||||
}
|
||||
|
||||
|
@ -130,26 +125,46 @@ 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
|
||||
vec3 filtered = vec3(dither(color.x, hueSteps), dither(color.y, satSteps), dither(color.z, valSteps)).rgb;
|
||||
#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, rgbSteps), dither(color.g, rgbSteps), dither(color.b, rgbSteps));
|
||||
final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z));
|
||||
#endif
|
||||
#else
|
||||
#if colorMode == 0
|
||||
vec3 filtered = vec3(lightnessStep(color.x, hueSteps), lightnessStep(color.y, satSteps), lightnessStep(color.z, valSteps)).rgb;
|
||||
#if colorMode == MODE_HSV
|
||||
vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb;
|
||||
final = hsv2rgb(filtered);
|
||||
#else
|
||||
final = vec3(lightnessStep(color.r, rgbSteps), lightnessStep(color.g, rgbSteps), lightnessStep(color.b, rgbSteps)).rgb;
|
||||
final = vec3(lightnessStep(color.r, colormax.x), lightnessStep(color.g, colormax.y), lightnessStep(color.b, colormax.z)).rgb;
|
||||
#endif
|
||||
#endif
|
||||
gl_FragData[0] = vec4(vec3(final), 1.0); //gcolor
|
||||
|
||||
#if colorMode == MODE_RGB && colorDepth == 1
|
||||
if(final.r == 1)
|
||||
final = monoHigh;
|
||||
else
|
||||
final = monoLow;
|
||||
#endif
|
||||
|
||||
#ifdef interlacing
|
||||
/* DRAWBUFFERS:01 */
|
||||
// pull previous buffer
|
||||
vec3 prev = texture2D(colortex1, texcoord).rgb;
|
||||
// interlace alternates between odd and even lines on world time
|
||||
if(mod(int(gl_FragCoord.y / pixelSize), 2) == mod(frameCounter, 2))
|
||||
gl_FragData[0] = vec4(prev, 1);
|
||||
else
|
||||
gl_FragData[0] = vec4(final, 1);
|
||||
gl_FragData[1] = vec4(final, 1);
|
||||
#else
|
||||
gl_FragData[0] = vec4(final, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#version 120
|
||||
|
||||
#define pixelSize // [1 2 4 8 16]
|
||||
#include "/module/common.glsl"
|
||||
|
||||
//#define aberration
|
||||
//#define hBlur
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
@ -8,14 +10,39 @@ varying vec2 texcoord;
|
|||
uniform sampler2D gcolor;
|
||||
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
|
||||
vec3 blurred = hblur();
|
||||
gl_FragData[0] = vec4(blurred, 1);
|
||||
color = hblur();
|
||||
#else
|
||||
gl_FragData[0] = texture2D(gcolor, texcoord);
|
||||
color = texture2D(gcolor, texcoord).rgb;
|
||||
#endif
|
||||
|
||||
#if scanline > 0
|
||||
color = scanlines(color);
|
||||
#endif
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#version 120
|
||||
|
||||
#define pixelSize 2 // [1 2 4 8 16]
|
||||
|
||||
#define worldCurvature 0 // [0 1 2]
|
||||
#include "/module/common.glsl"
|
||||
|
||||
varying vec2 texcoord;
|
||||
varying vec4 color;
|
||||
|
@ -13,6 +11,7 @@ uniform float viewWidth, viewHeight;
|
|||
|
||||
#include "/module/vertex_warp.vert"
|
||||
#include "/module/texture_warp.vert"
|
||||
#include "/module/world.vert"
|
||||
|
||||
void main() {
|
||||
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
@ -25,12 +24,16 @@ void main() {
|
|||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
#ifndef NON_WORLD
|
||||
#if worldCurvature > 0
|
||||
world_curvature();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NO_TWARP
|
||||
#ifdef tWarp
|
||||
texture_warp();
|
||||
#endif
|
||||
|
||||
#ifndef NON_WORLD
|
||||
#include "/module/world.vert"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#define NO_TWARP
|
||||
#define NON_WORLD
|
||||
#include "/gbuffers_basic.vsh"
|
||||
|
|
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"
|
||||
|
|
@ -2,10 +2,15 @@
|
|||
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)
|
||||
|
@ -13,21 +18,64 @@ 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.rgbSteps=RGB Depth
|
||||
option.hueSteps=Hue Depth
|
||||
option.satSteps=Saturation Depth
|
||||
option.valSteps=Value Depth
|
||||
|
||||
option.colorDepth=RGB Depth
|
||||
value.colorDepth.1=Monochrome
|
||||
value.colorDepth.3=3-bit
|
||||
value.colorDepth.6=6-bit
|
||||
value.colorDepth.8=8-bit
|
||||
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
|
||||
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.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
|
||||
|
@ -37,22 +85,33 @@ 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)
|
||||
value.worldRadius.256=High (256)
|
||||
value.worldRadius.-256=Inverse (-256)
|
||||
|
||||
|
|
11
shaders/module/aberration.frag
Normal file
11
shaders/module/aberration.frag
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
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;
|
||||
|
||||
return vec3(red, 0, blue);
|
||||
}
|
||||
|
61
shaders/module/color_depth.frag
Normal file
61
shaders/module/color_depth.frag
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
#include "/var/color_depth.glsl"
|
||||
|
||||
#define colorMode 0 // [0 1]
|
||||
|
||||
#define hueBits 2 // [1 2 3 4 5 6 7 8]
|
||||
#define satBits 2 // [1 2 3 4 5 6 7 8]
|
||||
#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 3]
|
||||
|
||||
#if colorMode == MODE_HSV
|
||||
// -- HSV --
|
||||
|
||||
float bit_max(int bits) {
|
||||
return pow(2, bits);
|
||||
}
|
||||
|
||||
float hueMax = bit_max(hueBits);
|
||||
float satMax = bit_max(satBits);
|
||||
float valMax = bit_max(valBits);
|
||||
|
||||
#else
|
||||
// -- RGB --
|
||||
|
||||
#if colorDepth == 1
|
||||
vec3 colormax = vec3(2, 1, 1);
|
||||
#elif colorDepth == 3
|
||||
vec3 colormax = vec3(2, 2, 2);
|
||||
#elif colorDepth == 6
|
||||
vec3 colormax = vec3(4, 4, 4);
|
||||
#elif colorDepth == 8
|
||||
// 8-bit is 3:3:2
|
||||
vec3 colormax = vec3(8, 8, 4);
|
||||
#elif colorDepth == 12
|
||||
vec3 colormax = vec3(16, 16, 16);
|
||||
#elif colorDepth == 15
|
||||
vec3 colormax = vec3(32, 32, 32);
|
||||
#elif colorDepth == 18
|
||||
vec3 colormax = vec3(64, 64, 64);
|
||||
#elif colorDepth == 24
|
||||
vec3 colormax = vec3(256, 256, 256);
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
3
shaders/module/common.glsl
Normal file
3
shaders/module/common.glsl
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
#define pixelSize 2 // [1 2 4 8 16]
|
||||
|
|
@ -10,7 +10,7 @@ const float centerDepthSmoothHalfLife = 16f;
|
|||
vec2 depthOfField() {
|
||||
float depth = texture2D(depthtex1, texcoord).x;
|
||||
float distance = depth - centerDepthSmooth;
|
||||
int stops = max(min(int(distance * 96), 5), 0);
|
||||
int stops = max(min(int(sqrt(distance * 256)), 5), 0);
|
||||
|
||||
#if pixelSize > 1
|
||||
float virtualSize = pow(float(pixelSize), 1 + stops);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
10
shaders/module/interlace.frag
Normal file
10
shaders/module/interlace.frag
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
//#define interlacing
|
||||
|
||||
#ifdef interlacing
|
||||
uniform sampler2D colortex1;
|
||||
const bool colortex1Clear = false;
|
||||
|
||||
uniform int frameCounter;
|
||||
#endif
|
||||
|
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,8 +1,16 @@
|
|||
#if worldCurvature == 1
|
||||
float z = gl_Position.z * gl_Position.z;
|
||||
gl_Position.y -= z / 256;
|
||||
#elif worldCurvature == 2
|
||||
vec2 xz = gl_Position.xz;
|
||||
gl_Position.y -= ceil(( dot(xz, xz) * 5 ) / 512) / 5;
|
||||
#endif
|
||||
|
||||
#include "/var/world.glsl"
|
||||
|
||||
#define worldCurvature 0 // [0 1 2]
|
||||
#define worldRadius 512 // [1024 512 256 -256]
|
||||
|
||||
void world_curvature() {
|
||||
#if worldCurvature == CURVATURE_CYLINDER
|
||||
float z = gl_Position.z * gl_Position.z;
|
||||
gl_Position.y -= 2 * z / worldRadius;
|
||||
#elif worldCurvature == CURVATURE_ROUND
|
||||
vec2 xz = gl_Position.xz;
|
||||
gl_Position.y -= round(( dot(xz, xz) / worldRadius ) * 8) / 8;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp
|
||||
sliders=pixelSize colorDepth hueBits satBits valBits vWarp worldRadius
|
||||
|
||||
# -- PROFILES --
|
||||
profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur
|
||||
profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur
|
||||
profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur
|
||||
profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 tWarp !hBlur
|
||||
profile.REALITY=profile.PSX !tWarp hBlur
|
||||
profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp !hBlur
|
||||
profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueBits=2 satBits=2 valBits=2 vWarp=0 !tWarp !hBlur !interlacing
|
||||
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=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> rgbSteps <empty> <empty> hueSteps satSteps valSteps
|
||||
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
||||
|
||||
# screen effects
|
||||
screen.SCREEN=<empty>
|
||||
screen.SCREEN=signal wire interlacing scanline <empty> <empty> aberration
|
||||
|
||||
# console effects
|
||||
screen.CONSOLE.columns=1
|
||||
|
@ -26,7 +29,7 @@ screen.PSX=vWarp tWarp # playstation
|
|||
screen.REALITY=hBlur # nintendo 64
|
||||
|
||||
# custom effects
|
||||
screen.FX=dof dofRes worldCurvature
|
||||
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