reoriented HSV around bit depth rather than steps

This commit is contained in:
Valerie Wolfe 2024-04-23 00:14:28 -04:00
parent e99cde4ca9
commit 7007052618
4 changed files with 59 additions and 40 deletions

View file

@ -5,11 +5,6 @@
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]
uniform sampler2D gcolor;
uniform float viewWidth, viewHeight;
@ -137,14 +132,14 @@ void main() {
vec3 final;
#ifdef dithering
#if colorMode == 0
vec3 filtered = vec3(dither(color.x, hueSteps), dither(color.y, satSteps), dither(color.z, valSteps)).rgb;
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
vec3 filtered = vec3(lightnessStep(color.x, hueSteps), lightnessStep(color.y, satSteps), lightnessStep(color.z, valSteps)).rgb;
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, colormax.x), lightnessStep(color.g, colormax.y), lightnessStep(color.b, colormax.z)).rgb;

View file

@ -34,9 +34,12 @@ option.monoPalette=Mono Palette
value.monoPalette.0=Black & White
value.monoPalette.1=Dot Matrix
value.monoPalette.2=Paint the Town
option.hueSteps=Hue Depth
option.satSteps=Saturation Depth
option.valSteps=Value Depth
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.interlacing=Interlacing

View file

@ -1,32 +1,53 @@
#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 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);
#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
#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

View file

@ -1,8 +1,8 @@
sliders=pixelSize colorDepth hueSteps satSteps valSteps vWarp worldRadius
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 !interlacing
profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur !interlacing
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.OBRADINN=pixelSize=2 colorMode=1 colorDepth=1 monoPalette=0 dithering vWarp=0 !tWarp !hBlur !interlacing
@ -17,7 +17,7 @@ screen=<profile> <empty> pixelSize <empty> [COLOR] [SCREEN] [CONSOLE] [FX]
# colors
screen.COLOR.columns=3
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueSteps satSteps valSteps
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
# screen effects
screen.SCREEN=interlacing scanlines aberration