Skip to main content
1 of 3

What's a proper way to clamp dither noise?

When reducing color depth and dithering with a 2 bit noise (with n=-0.5 -> 1.5 and output=floor(input*(2^bits-1) + n)), the ends of the value range (inputs 0.0 and 1.0) are noisy. It would be desirable to have them to be solid color.

Example: https://www.shadertoy.com/view/llsfz4

The problem can be of course solved by just compressing the value range so that the ends get always rounded to single values. This feels bit of a hack though, and I'm wondering if there's a way to implement this "properly"?