Compare commits
No commits in common. "6249bd802b53706bc873368719c9503290bc7620" and "fc7bfab36889f133e1832e47b7387aaf3c86dc82" have entirely different histories.
6249bd802b
...
fc7bfab368
5 changed files with 26 additions and 100 deletions
|
@ -5,7 +5,6 @@ aimed at providing a variety of effects in the vein of its parent project.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Affine Texture Warping
|
|
||||||
- Chromatic Aberration
|
- Chromatic Aberration
|
||||||
- Color depth reduction
|
- Color depth reduction
|
||||||
- Depth of Field
|
- Depth of Field
|
||||||
|
@ -13,13 +12,13 @@ aimed at providing a variety of effects in the vein of its parent project.
|
||||||
- Downscaling
|
- Downscaling
|
||||||
- Horizontal Blur
|
- Horizontal Blur
|
||||||
- Interlacing
|
- Interlacing
|
||||||
- Monochrome Mode & Palettes
|
|
||||||
- Scanlines
|
- Scanlines
|
||||||
- Screen-Space Vertex Warping
|
- Screen-Space Vertex Warping
|
||||||
|
- Affine Texture Warping
|
||||||
- World Curvature
|
- World Curvature
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
- [Alex Charlton's post "Dithering on the GPU"](http://alex-charlton.com/posts/Dithering_on_the_GPU/).
|
- [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/). Combining downscale with dithering is the reason I forked a shader in the first place.
|
- [BSL Shaders by CaptainTatsu](https://bitslablab.com/bslshaders/), whose downscale effect was my inspiration for forking a shader.
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,19 @@
|
||||||
float renderRes = pixelSize;
|
float renderRes = pixelSize;
|
||||||
|
|
||||||
#define dithering // whether or not to apply dithering
|
#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 gcolor;
|
||||||
uniform float viewWidth, viewHeight;
|
uniform float viewWidth, viewHeight;
|
||||||
|
|
||||||
varying vec2 texcoord;
|
varying vec2 texcoord;
|
||||||
|
|
||||||
#include "/module/color_depth.frag"
|
|
||||||
#include "/module/dof.frag"
|
#include "/module/dof.frag"
|
||||||
#include "/module/interlace.frag"
|
#include "/module/interlace.frag"
|
||||||
|
|
||||||
|
@ -98,8 +104,8 @@ vec3[2] closestColors(float hue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float lightnessStep(float l, float lightnessSteps) {
|
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);
|
return floor((0.5 + l * (lightnessSteps - 1.0))) / (lightnessSteps - 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float dither(float color, float dithersteps) {
|
float dither(float color, float dithersteps) {
|
||||||
|
@ -132,25 +138,20 @@ void main() {
|
||||||
vec3 final;
|
vec3 final;
|
||||||
#ifdef dithering
|
#ifdef dithering
|
||||||
#if colorMode == 0
|
#if colorMode == 0
|
||||||
vec3 filtered = vec3(dither(color.x, hueMax), dither(color.y, satMax), dither(color.z, valMax)).rgb;
|
vec3 filtered = vec3(dither(color.x, hueSteps), dither(color.y, satSteps), dither(color.z, valSteps)).rgb;
|
||||||
final = hsv2rgb(filtered);
|
final = hsv2rgb(filtered);
|
||||||
#else
|
#else
|
||||||
final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z));
|
final = vec3(dither(color.r, rgbSteps), dither(color.g, rgbSteps), dither(color.b, rgbSteps));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if colorMode == 0
|
#if colorMode == 0
|
||||||
vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb;
|
vec3 filtered = vec3(lightnessStep(color.x, hueSteps), lightnessStep(color.y, satSteps), lightnessStep(color.z, valSteps)).rgb;
|
||||||
final = hsv2rgb(filtered);
|
final = hsv2rgb(filtered);
|
||||||
#else
|
#else
|
||||||
final = vec3(lightnessStep(color.r, colormax.x), lightnessStep(color.g, colormax.y), lightnessStep(color.b, colormax.z)).rgb;
|
final = vec3(lightnessStep(color.r, rgbSteps), lightnessStep(color.g, rgbSteps), lightnessStep(color.b, rgbSteps)).rgb;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if colorMode == 1 && colorDepth == 1
|
|
||||||
if(final.r == 1)
|
|
||||||
final = monoColor;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef interlacing
|
#ifdef interlacing
|
||||||
/* DRAWBUFFERS:01 */
|
/* DRAWBUFFERS:01 */
|
||||||
// pull previous buffer
|
// pull previous buffer
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
profile.DEFAULT=Default
|
profile.DEFAULT=Default
|
||||||
profile.AEON=Aeon Upstream
|
profile.AEON=Aeon Upstream
|
||||||
profile.DOS=DOS
|
profile.DOS=DOS
|
||||||
profile.DOTMATRIX=Dot Matrix Game
|
|
||||||
profile.OBRADINN=Return of the Obra Dinn
|
|
||||||
profile.PSX=PSX
|
profile.PSX=PSX
|
||||||
profile.REALITY=Project Reality
|
profile.REALITY=Project Reality
|
||||||
profile.SNES=Super Famicom
|
|
||||||
profile.VR32=VR32
|
profile.VR32=VR32
|
||||||
|
|
||||||
option.pixelSize=Downscaling
|
option.pixelSize=Downscaling
|
||||||
|
@ -21,25 +18,10 @@ option.colorMode=Color Mode
|
||||||
value.colorMode.0=HSV
|
value.colorMode.0=HSV
|
||||||
value.colorMode.1=RGB
|
value.colorMode.1=RGB
|
||||||
option.dithering=Dithering
|
option.dithering=Dithering
|
||||||
option.colorDepth=RGB Depth
|
option.rgbSteps=RGB Depth
|
||||||
value.colorDepth.1=Monochrome
|
option.hueSteps=Hue Depth
|
||||||
value.colorDepth.3=3-bit
|
option.satSteps=Saturation Depth
|
||||||
value.colorDepth.6=6-bit
|
option.valSteps=Value Depth
|
||||||
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
|
|
||||||
option.hueBits=Hue Depth
|
|
||||||
suffix.hueBits=-bit
|
|
||||||
option.satBits=Saturation Depth
|
|
||||||
suffix.satBits=-bit
|
|
||||||
option.valBits=Value Depth
|
|
||||||
suffix.valBits=-bit
|
|
||||||
|
|
||||||
screen.SCREEN=Screen
|
screen.SCREEN=Screen
|
||||||
option.interlacing=Interlacing
|
option.interlacing=Interlacing
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
|
|
||||||
#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]
|
|
||||||
|
|
||||||
#if colorMode == 0
|
|
||||||
// -- 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 == 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);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
sliders=pixelSize colorDepth hueBits satBits valBits vWarp worldRadius
|
sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp worldRadius
|
||||||
|
|
||||||
# -- PROFILES --
|
# -- PROFILES --
|
||||||
profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueBits=2 satBits=2 valBits=2 vWarp=0 !tWarp !hBlur !interlacing
|
profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur !interlacing
|
||||||
profile.AEON=pixelSize=1 colorMode=0 dithering hueBits=3 satBits=2 valBits=2 vWarp=0 !tWarp !hBlur !interlacing
|
profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur !interlacing
|
||||||
profile.DOS=pixelSize=4 colorMode=1 dithering colorDepth=3 vWarp=1 !tWarp !hBlur !interlacing
|
profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur !interlacing
|
||||||
profile.DOTMATRIX=pixelSize=4 colorMode=1 colorDepth=1 monoPalette=1 dithering vWarp=1 !tWarp !hBlur !interlacing
|
profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 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.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=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp !hBlur !interlacing
|
||||||
profile.VR32=pixelSize=8 colorMode=1 !dithering colorDepth=1 monoPalette=2 vWarp=1 !tWarp !hBlur !interlacing
|
|
||||||
|
|
||||||
# -- SCREENS --
|
# -- SCREENS --
|
||||||
# default
|
# default
|
||||||
|
@ -17,7 +14,7 @@ screen=<profile> <empty> pixelSize <empty> [COLOR] [SCREEN] [CONSOLE] [FX]
|
||||||
|
|
||||||
# colors
|
# colors
|
||||||
screen.COLOR.columns=3
|
screen.COLOR.columns=3
|
||||||
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
screen.COLOR=colorMode dithering <empty> rgbSteps <empty> <empty> hueSteps satSteps valSteps
|
||||||
|
|
||||||
# screen effects
|
# screen effects
|
||||||
screen.SCREEN=interlacing scanlines aberration
|
screen.SCREEN=interlacing scanlines aberration
|
||||||
|
|
Loading…
Reference in a new issue