changed rgb 'steps' to real bit depths

This commit is contained in:
Valerie Wolfe 2024-04-22 22:00:59 -04:00
parent 12fa2ccde8
commit 62a10d890d
4 changed files with 61 additions and 12 deletions

View file

@ -11,13 +11,12 @@ float renderRes = pixelSize;
#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 float viewWidth, viewHeight;
varying vec2 texcoord;
#include "/module/color_depth.frag"
#include "/module/dof.frag"
#include "/module/interlace.frag"
@ -104,8 +103,8 @@ vec3[2] closestColors(float hue) {
}
float lightnessStep(float l, float lightnessSteps) {
/* Quantize the lightness to one of `lightnessSteps` values */
return floor((0.5 + l * (lightnessSteps - 1.0))) / (lightnessSteps - 1.0);
/* Quantize the lightness to one of `lightnessSteps` values */;
return floor((0.5 + l * (lightnessSteps - 1.0))) / (lightnessSteps - 1.0);
}
float dither(float color, float dithersteps) {
@ -141,17 +140,22 @@ void main() {
vec3 filtered = vec3(dither(color.x, hueSteps), dither(color.y, satSteps), dither(color.z, valSteps)).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;
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
#if colorMode == 1 && colorDepth == 1
if(final.r == 1)
final = monoColor;
#endif
#ifdef interlacing
/* DRAWBUFFERS:01 */
// pull previous buffer

View file

@ -2,6 +2,8 @@
profile.DEFAULT=Default
profile.AEON=Aeon Upstream
profile.DOS=DOS
profile.DOTMATRIX=Dot Matrix Game
profile.OBRADINN=Return of the Obra Dinn
profile.PSX=PSX
profile.REALITY=Project Reality
profile.VR32=VR32
@ -18,7 +20,17 @@ option.colorMode=Color Mode
value.colorMode.0=HSV
value.colorMode.1=RGB
option.dithering=Dithering
option.rgbSteps=RGB 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.24=Truecolor
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

View file

@ -0,0 +1,31 @@
#define colorDepth 6 // [1 3 6 8 12 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
// 6-bit is 2:2:2
vec3 colormax = vec3(4, 4, 4);
#elif colorDepth == 8
// 8-bit is 3:3:2
vec3 colormax = vec3(8, 8, 4);
#elif colorDepth == 12
// 12-bit is 4:4:4
vec3 colormax = vec3(16, 16, 16);
#elif colorDepth == 24
// 24-bit is 8:8:8
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

View file

@ -1,12 +1,14 @@
sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp worldRadius
sliders=pixelSize colorDepth hueSteps satSteps valSteps 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.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur !interlacing
profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 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
profile.PSX=pixelSize=2 colorMode=1 !dithering colorDepth=24 vWarp=2 tWarp !hBlur interlacing
profile.REALITY=profile.PSX vWarp=0 !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 colorDepth=1 monoPalette=2 !dithering vWarp=1 !tWarp !hBlur !interlacing
# -- SCREENS --
# default
@ -14,7 +16,7 @@ screen=<profile> <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 hueSteps satSteps valSteps
# screen effects
screen.SCREEN=interlacing scanlines aberration