
Dither stabilisation - robin_reala
https://forums.tigsource.com/index.php?topic=40832.msg1363742#msg1363742
======
mrob
The dithered highlight on the sphere looks odd because it was calculated in a
non-linear colorspace. You can get better looking results by converting to a
linear colorspace, dithering, then converting back to sRGB. Eg, in
ImageMagick, using the same 8x8 matrix:

convert Dither2-Exp_crop_resize.png -colorspace RGB -ordered-dither o8x8,2
-colorspace sRGB Dither2-Exp_dithered.png

Result: [https://imgur.com/a/81bNg](https://imgur.com/a/81bNg)

~~~
klodolph
Although in this case, the conversion back to sRGB is just the identity…

~~~
amluto
True. But if the dither mask was computed without taking into account sRGB's
nonlinearity (which I assume it was), then the algorithm will have the same
incorrect output.

------
grenoire
I think the problem now is that the dithering is no longer done on the screen
space, but instead looks like a texture slapped on top of the objects in
orthogonal projection. You can easily notice it in the comparison shots;
you'll notice that the sphere projection is angled at around 20-30 degrees,
and it's not pixel-perfect on the screen as the original effect is.

I'm not a fan, to be fair.

~~~
rossy
Yeah, I couldn't agree more. The original effect is really interesting and
evokes nostalgia of old Mac games, as the developer intended. I think he's
reacting too harshly to criticism, or overthinking things, because my reaction
to the pixel swimming effect matched his first assumption: "yeah that's how
dither works."

The screen-space solution for stable dithering looks fine, and I'm glad it
will be an option in the final game, but the sphere mapping looks weird. With
non-screen-aligned "pixels" it looks like it's just a normal 3D game but with
a "dither" texture on every object, rather than a true 1-bit game. I just hope
the aesthetic from the demo isn't watered down too much for the final game.

~~~
KozmoNau7
The original effect is how it's supposed to look and how it would have looked
on an old computer with 1-bit graphics.

If there is an option to choose between the different effects, I would
personally go with the first one, because that's exactly how I remember old
games looking.

------
teej
This post is written by the creator of the wonderful game Papers, Please.

------
tizzdogg
I replied on the original thread too, but I wonder if it’d work to use a
mipmapped dither texture in texture space like this old hatching paper:
[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.28....](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.28.8017&rep=rep1&type=pdf)
It probably won’t give you exact 1 pixel dither without some hacks, but maybe
something along those lines could work.

~~~
kmnt
That is really cool, especially for the time. Only downside is I think some uv
mapping is required to map the hatching onto the models. Here is a video of
the paper
[https://www.youtube.com/watch?v=g6Ta35AiE1I](https://www.youtube.com/watch?v=g6Ta35AiE1I)

------
beeforpork
What a delightful attention to detail! I love this!

It is totally not weird to me to spend time on something with the goal for it
not to be noticed in the end.

------
amai
Related: \-
[http://bisqwit.iki.fi/story/howto/dither/jy/](http://bisqwit.iki.fi/story/howto/dither/jy/)
\- [http://pippin.gimp.org/a_dither/](http://pippin.gimp.org/a_dither/)

------
Franciscouzo
I wonder how using error diffusion on the time axis would look, I guess it
would stabilise the image a bit.

~~~
ttoinou
It would look like sensor noise ?

~~~
thanatropism
Noise has samples that are statistically independent from each other.
Diffusion has samples such that their _increments_ are independent. But it's
path dependent.

------
londons_explore
This is the approach I'd use...

* Take the previous frame.

* Warp to the shape of the new frame using motion vectors.

* Dither the new frame using the warped old frame to modulate the white/black threshold when carrying forward the error to the next pixel.

That will lead to a pixel remaining white/black, and only a minimal number of
pixels changing color between frames.

------
monk_e_boy
I couldn't find out why he wanted a 1 bit image. Was there a reason other than
"it looks cool"?

~~~
jcl
From the first post of the forum thread:

"My first computer was a Mac Plus. I've always had a nostalgia-softened spot
in my heart for 1-bit graphics. I'd like to capture the detailed black & white
look of old Mac games in a realtime 1st person game."

