Sharing: Eevee Dither Material

Queue the Stranger Things music, we’re going retro.

Continuing from this discussion, the addition of the Shader to RGB node got me interested in the effect again. This node is awesome! I think we are going to see all kinds of cool tricks and hacks thanks to this little fella.

This is more of a proof of concept than anything. You can easily generate dithering in post (photo editor, or compositing), but it’s still fun to play around with in real time, and it gives me an excuse to tool around with nodes.

(Expand to properly see the effect)
The first 3 have 16 total colors, the last has 2.

The material does not use a bayer matrix as in the linked discussion. Instead, I wanted to experiment with creating a matrix procedurally with more control. Bayer patterns do look better though, so I may include some later. I’d also like to create a procedural halftone dither, and replace the half baked fringe thing with proper chromatic aberration.

A few notes:

  • The effect is best viewed through a camera locked to the view with the view zoomed 1:1 (View > Navigation > Zoom Camera 1:1). Otherwise you get a sort of moire effect.

  • Place the ditheree node group at the end of the node chain for each material in the scene.

  • The resolution needs to match the camera/render resolution for pixels to be square.

  • The shader does take a bit to compile the first time around. Changes are quick after that.

  • The node group is nested inside of another node group. No, that’s not a mistake. It’s a material linking trick. It allows you to plug the node group into all of your materials and make changes globally from one place.

Ditheree.blend (391.0 KB)
EDIT: I updated the file with the standard Bayer patterns mentioned above.
There are 4 options: 2x2, 3x3, 4x4, and 8x8. The images are packed and take up about 1KB total.

Enjoy! And I’d love to see some images if anyone plays around with this.


Oh, man!! YOU got it!! It totally looks amazimg! I will test drive it soon!

I’ve updated the file above with the standard Bayer patterns as additional options, and made a few other small tweaks.

Thanks @DavidRivera . The look is there, but I’ve still yet to work out the movement aspect as per our previous discussion on that blog post. I’m thinking drivers are the only way to go on that front.

thanks for sharing!

i did a similar shader a few days ago (see on twitter) but yours is way more flexible. for my shader i used 16 halftone patterns as images and blended them together. never thought of using the bayer matrix (because i didn’t knew it lol)!
but i see there is a small problem in both of our shaders: when you zoom in you can see these half-blended pixels:

i am still lokking for a solution… but still great work man!
thank you very much

Nice! Always cool to see how someone else arrived to the same conclusion.

I also noticed that problem with the half pixels. I believe it’s because while an object’s shading can be quantized, the object itself can’t. So the edge of an object will cut right through the pixels. The issue disappears when rendered.

1 Like