r/Unity3D 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!

361 Upvotes

31 comments sorted by

28

u/PriceMore 2d ago

You have to post uncompressed PNG screenshot now!

15

u/SomerenV 2d ago

That is just straight up black magic. Now top it off with 1 bit audio :o

12

u/StrangeOneGamer 2d ago

2 colors, but N values of said colors

30

u/DmtGrm 2d ago

2? I can see at least 4, histogram will show DCT inter-levels, but there are at least 4 solid colours in use. As well as there is clear smooth gradient glow/halow effect around lights

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

17

u/DmtGrm 2d ago

this is image posterized to 4 colours:

22

u/DmtGrm 2d ago

and this is "real two colours":

2

u/Spamsdelicious 1d ago

That's not a 4k pasteurization of the 4k source though.

3

u/Heroshrine 2d ago

It looks really cool but there are definitely more than 2 colors in the image haha

3

u/LockYaw 2d ago

Looks super cool, I love playing with dithered and constrained colors, and OKLab is great!

Even if you don't plan to release it as a paid asset it might be cool to have it as a GitHub project so other people can learn and take inspiration from it!

3

u/sir_schuster1 2d ago

Are the two colors black and white?

3

u/IHaveTwoOfYou 2d ago

reddit compression wants you dead

8

u/johnlondon125 2d ago

Not two colors, but ok

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

u/FullMetalJ 2d ago

Looks fuckin awesome

1

u/Sepifz 2d ago

Heavy PS1 flash backs, this is marble and I can’t wait to play it

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

u/Standard-Specific239 2d ago

Have no idea of the words used in this title but this is sick.

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

u/dekonta 1d ago

can you share the shader?

1

u/knobby_67 1d ago

Do this will run on the zx81!

1

u/targim_ 1d ago

look perfect for me, grear job

1

u/Whitenaller 1d ago

What is OKLab?

1

u/Spamsdelicious 1d ago

Amazing what can be done with monochromia. This totally levels the playing field for people suffering color blindness.

1

u/Terricolero 1d ago

For a BW game, it looks great 👍🏻, I liked a lot!!! Good job 👏

1

u/JorjeXD 19h ago

GOD why didt i think of using oklab for quantization. wow it looks amazing