I’m a complete newbie with shaders, so probably what I’m asking is not the better problem to start with.
Anyway, I was looking for a shader which dithers the darker zones of an object. To better explain, what I’m looking for is something like Midwinter, an old Amiga game:
It’s basically a way of representing specific ranges of color values as a pattern. In the image above there are apparently:
White
White with small blue dots
50/50 White and blue dots
Mostly blue dots
Blue
… similar for blue levels
In a shader one way is to have a pattern texture with one grid cell of pattern for each brightness level, and you can put all of the levels on one texture. Then you just need to take the fragment coordinate (relative to screen coords, not the world coordinate, otherwise the pattern will flicker and shift), use the modulo of those numbers to keep within 1 grid cell, then look up a pixel from the the grid cell. … you select which cell to reference also based on the tone of the color being drawn, falling into a specific bracket. It’s doable.
You’d probably want to create an image effect for that, which creates the illusion of a lower resolution and lower number of available colors. So you’d need to use Unity Pro.
For the dithering itself you can use an existing dithering technique like Floyd-Steinberg, and convert it to work on a GPU. (For example, the pseudo code you can find on Wikipedia assumes you can write to other pixels, which is not how you work in shaders)
I’m not sure if it is something you’d want to do as your first shader, because it is a combination of several different disciplines, but it is certainly doable.