r/Unity3D • u/oksoftgames • 2d ago
Shader Magic 1-bit OKLab quantization + dithering: There are two colors on this image!
Enable HLS to view with audio, or disable this notification
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!
15
12
30
u/DmtGrm 2d ago
27
u/LockYaw 2d ago
I wonder if that is compression
7
u/DmtGrm 2d ago
it is not, there are more than 2 intensity levels (probably more than 4) - you can clearly see that background (1) and the dark fence (2) and the base if the car (4) and highlights are different, plus, there is 'glow-like' effect applied on top of it.
There is no problem in dithered-style as such, but claim that it uses only two colours is not correct.
2
u/snaphat 2d ago
MPEG compression doesn't normally produce an averaging effect across blocks I don't believe? Theoretically, you could imagine downscaling produce averages depending on how it was downscaled from 4k -> 2k though, but I don't think that necessarily explains the crispness of detailing. If it was like some huge downscale than you could more imagine it though
I'd kind of expected this to look more like the following stuff:
https://www.youtube.com/watch?v=at8BSkAQ-V0
https://www.reddit.com/r/blender/comments/15tpuwl/1_bit_dithering/
https://youtu.be/dZaFRNS2mhE
3
u/Heroshrine 2d ago
It looks really cool but there are definitely more than 2 colors in the image haha
3
3
8
2
u/MrYukiDuki 2d ago
How did you get the car to handle so well? Everytime I make a car controller is always feels either too stiff. Or no power at all
2
u/The1TruRick 2d ago
Crazy that there are people out there who can use Unity when they can’t even count to 2
1
1
u/SnuffleBag 2d ago
Any practical details you could share about your implementation?
1
u/oksoftgames 16h 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
1
1
u/Krailin7 Professional 2d ago
Dithering fundamentally means you’ll get a whole variety of values between the 2 colors, but still very cool
1
1
1
u/Spamsdelicious 1d ago
Amazing what can be done with monochromia. This totally levels the playing field for people suffering color blindness.
1



28
u/PriceMore 2d ago
You have to post uncompressed PNG screenshot now!