# How to posterize a texture in cycles proceduraly?

How to posterize a texture in cycles render procedurally like photoshop "posterize" filter. Thanks. And sorry for my bad English:)

I think six math nodes do the trick.

• I separate the image texture into R, G and B
• Then I use a math node to perform a modulo division. It divides the input by a value and keeps the rest. 100 modulo 30 = 10. Here, 0.845 modulo 0.1 is 0.045
• Next step, I subtract the result from the original value with another set of math nodes: 0.845 - 0.045 = 0.800
• I join the RGB values and feed them into the shader.

• I added a value node that tells all 3 modulo nodes which value to use. 0.0 means the original image, 0.1 uses ten steps, 0.2 uses 5 steps.

Not totally happy with the result though. I bet there'll be a better answer soon. Below has a value of 0.2

I made two improvements afterwards. I packed it into a node group which means the value node isn't necessary anymore. The input of the group does it nicely.

Under the hood I divided the factor in half and added it to the RGB values to simulate rounding. That should result in a brighter image closer to the original.

Collapsed it turns into this:

I think a simpler way to do it is a Color ramp node.

The color ramp node has pins set at equal distances and each pin has a color Value equal to its' distance. I wanted a detail level of 5, so I used 5 pins and spaced them out in increments of .200 . This is th result. To get a result with more levels, you'd need to add more pins and space them out accordingly. Hope this helps!

• If Color Ramps only had a step value... Feb 25, 2018 at 21:18

This method works both in Cycles and in EEVEE.

It is similar to Haunt_House's approach, but using the Greater Than nodes.

Separate RGB into 3 Greather Than nodes, then connect one Value node to those Math nodes.

Basically you're telling Blender to draw a hard line where R, G or B is greater than X. Where that hard line is exactly, is defined by the Value node. (I multiplied the value by $$0.1$$ just so I don't have to Shift-drag)

I used an Emission Shader for this example, but you could use any other shader.