Cycles Toon shader size effects diffuse direct value Here are three monkeys lit by the same sun lamp. They have only a Toon Diffuse shader set to color of 0.2 value, and size of 0.8, 0.5, and 0.2 respectively. But it can clearly be seen that their lit areas are displaying very different colors. When rendered, the difference shows up in the Diffuse Direct pass.



Does anyone know why this works this way, and what is going on mathematically? I want to make an adjustment to the color going into the shader based on the size to compensate for this and bring them all back to the same level of brightness in their lit area. Is it intended for the Toon shader to behave this way? Is this a bug?
According to the code currently here, and the sample_uniform_cone currently here, without smoothing the resulting diffuse intensity depends on the size of the toon shader node.

So we can compensate this value to invert the calculation:

The size is multiplied by pi/2 (so this is relative to half cone angle).

Then take 1 minus the cosinus of the previous result.

Then divide pi/2 by the previous result.

Last, multiply the intensity value by it.

As this last step is multiplication factor in the shader code, we need to divide by it in the nodes. This is done by this node group:



The result is not exactly perfect (should be some rounding or an error by me). But we obtain this: