reoriented HSV around bit depth rather than steps

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

View file

@ -5,11 +5,6 @@
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]
uniform sampler2D gcolor; uniform sampler2D gcolor;
uniform float viewWidth, viewHeight; uniform float viewWidth, viewHeight;
@ -137,14 +132,14 @@ void main() {
vec3 final; vec3 final;
#ifdef dithering #ifdef dithering
#if colorMode == 0 #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); 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, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z));
#endif #endif
#else #else
#if colorMode == 0 #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); 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, 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.0=Black & White
value.monoPalette.1=Dot Matrix value.monoPalette.1=Dot Matrix
value.monoPalette.2=Paint the Town value.monoPalette.2=Paint the Town
option.hueSteps=Hue Depth option.hueBits=Hue Depth
option.satSteps=Saturation Depth suffix.hueBits=-bit
option.valSteps=Value Depth 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

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 colorDepth 6 // [1 3 6 8 12 15 18 24]
#define monoPalette 0 // [0 1 2] #define monoPalette 0 // [0 1 2]
#if colorDepth == 1 #if colorMode == 0
vec3 colormax = vec3(2, 1, 1); // -- HSV --
#elif colorDepth == 3
vec3 colormax = vec3(2, 2, 2); float bit_max(int bits) {
#elif colorDepth == 6 return pow(2, bits);
vec3 colormax = vec3(4, 4, 4); }
#elif colorDepth == 8
// 8-bit is 3:3:2 float hueMax = bit_max(hueBits);
vec3 colormax = vec3(8, 8, 4); float satMax = bit_max(satBits);
#elif colorDepth == 12 float valMax = bit_max(valBits);
vec3 colormax = vec3(16, 16, 16);
#elif colorDepth == 15 #else
vec3 colormax = vec3(32, 32, 32); // -- RGB --
#elif colorDepth == 18
vec3 colormax = vec3(64, 64, 64); #if colorDepth == 1
#elif colorDepth == 24 vec3 colormax = vec3(2, 1, 1);
vec3 colormax = vec3(256, 256, 256); #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 #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 -- # -- PROFILES --
profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 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 hueSteps=8 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.DOS=pixelSize=4 colorMode=1 dithering colorDepth=3 vWarp=1 !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.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.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 # colors
screen.COLOR.columns=3 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 effects
screen.SCREEN=interlacing scanlines aberration screen.SCREEN=interlacing scanlines aberration