Edge Blend and Colour Rounding

Edge Blend and Colour Rounding

In our main article on the edge blend function we mentioned that the best way to create two toned cartoons from edge blend was to feed it through a blender node, rather than attempt to use the colour maths node. Here we will attempt to explain why.

Toon edges with edge blend are created by passing the results of the edge blend node through one of the rounding maths functions. In figure one I have plugged an edge blend into a Color_Math round node. Value 2 is set to a middle gray. Already we can see that the results are somewhat unexpected.

Fig 1: Edge blend and colour round

Figure two shows what happens when we render this.

Fig 2: The result of edge blend and colour round

Figure three explains why. Our outer colour is shown on the left (R:80, G:60, B:40). Our outer colour is shown on the right (R:180, G:140, B:120). As we move across the sphere the result of the edge blend fades gradually from one to the other. However, when we plug that into our Round function each channel is rounded separately. Towards the edge red, green and blue are all rounded down. As we move towards the centre of the sphere (facing towards the camera), each channel in turn rises above the line of our gray rounding control. First red, then red and green (thus the yellow) and finally all three channels are rounded up. This gives us four colour bands.

Fig 3: The maths behind edge blend and colour round

Of course this node setup could be useful, but it has two main limits. First, each colour channel is at either zero or 100% strength, when fed by an edge blend using standard colours, so it will only ever produce black, white, red, green, blue, yellow, cyan and magenta (the primary colours plus the colours produced by combining two of those colours). Second, it is quite hard to predict which combination of colours you will produce, especially if you don't use gray to control the rounding.