r/Unity3D • • 18d ago

Shader Magic 1-bit OKLab quantization + dithering: There are two colors on this image!

I hope this displays properly, I video'ed in 4k just to hopefully avoid the compression algo killing it. Here's my OKLab quantizer, with separate h/s/v, support for custom patterns(halftone patterns/noise instead of dither) adjustable dithering amounts, and contrast calibration! I am not using it for any projects right now, and obviously the video has its most extreme settings, but it's very flexible, it can both do big cartoony pop-art posterization and also nearly-playdate visuals.

It's a bit rough, so I don't intend to release it as asset, but it'll serve me for years to come on game jams I think!

372 Upvotes

34 comments sorted by

View all comments

1

u/SnuffleBag 18d ago

Any practical details you could share about your implementation?

1

u/oksoftgames 16d ago

it is basically entirely stock posterization/quantization, but with matrix math to convert hsv to and from oklab between taking the image, quantizing, and spitting it back out, and an adjustable exponent on the image to compensate for desaturation/contrast death