Prompted by my previous question, I am wondering if (since there is no apparent way to convert a shader to color) there is any (even using post processing) way to mix cycles shaders with blend modes besides Add and Mix.

Is this possible?

I think the answer to this is also negative.

Let me try to explain my understanding of the problem with a different blend mode. To have an example to work with, let's use Multiply:

When Cycles uses the shader, it uses it with exactly one sample. It doesn't know anything about the previous samples, and neither does it know anything about future samples for this pixel and material.

To be able to multiply two shaders with each other, you would need the averages of all samples from one shader and all samples from the other one, as it could happen that for each sample, one of them is 0 and the other one is 1 (with a 50% chance for either one to be 1). In average, both would still be 0.5 in brightness, so the correct Multiply-result would be 0.5 * 0.5 = 0.25, but because Blender only sees one sample at a time, it would always calculate 1 * 0 = 0 or 0 * 1 = 0 and the material would be black. This is why all blend-modes have to be independant of the respective other input to make sense. Add and Mix are pretty much the only two useful blend modes for which the output is only influenced by the two inputs independently.

Any linear modifications that are supposed to happen to either of the inputs or the output can be applied to the color before it even enters the shader, as all shaders are (as far as I know) linear in respect to the input color. Subtracting also works that way, you can replicate it with negative brightness in a Diffuse/Glossy/...-Shader.

This is not the programming explanation for why it doesn't work but only the explanation that I think is correct and describes the problem from a rendering process point of view, please correct me if it's not correct but I hope it helps in some way to understand what works and what doesn't and cannot work.

• Thanks. That makes sense, but wouldn't it be possible to multiply the result of the collective samples? (calculate the color of each shader separately and combine afterwards) I guess you need to be able to convert shader to color to do that though.. :( Aug 8, 2013 at 21:26
• You could only do that at the very end of rendering the image, because you can only then get the collective samples. Because Cycles is also built for real-time display, no such specific filters are applied to the image after rendering. What you can do, of course, is create this processing step after the finished rendering in the Blender compositor. You can absolutely render the image first with one and then with the other shader and then use all the blend-modes you want in postprocessing. Aug 8, 2013 at 21:36

While a shader contains colour information it also contains other information needed by the renderer to calculate the final colour when rendering. A shader is more like "instructions" for the render engine to calculate the final colour.

If you could extract a colour from the shader it wouldn't match the final image unless you also take into account the same calculations the renderer performs to get the final colour, like surrounding objects and lights, the angle of the surface to the camera...

While you can use different methods to mix colours before you pass it to the shader, the render engine is more restrictive as to how it generates the final image.

If you use the same 100% blue colour for a diffuse shader, a glossy shader and a glass shader, each will have variations that make them appear different from each other even though the specified colour in the shader is the same.

• But, if I'm not mistaken it would be possible to have a duplicate of an object on a separate render layer and use ID masks and stuff to do this in compositing? Aug 9, 2013 at 16:30
• +1. The key point here is that the shader is not a color, it's an equation. Aug 9, 2013 at 16:38
• @gandalf3 Compositing can allow you to alter the final colour of the render. That is still different than altering the way the shaders mix together in the material nodes. Aug 10, 2013 at 2:45
• @sambler But it would work for simple things? (e.g. darkening a single object with a AO shader) this would be easier if cycles had texture baking.. Aug 10, 2013 at 2:53
• @WChargin True, but the shader produces colors when you render it. I guess what I'm looking for is a way to effectively setup some sort of compositing system to have different per-object "passes" for different shaders. (these would be fairly limited because you will have to render each one, but for things like AO I think it could work) Aug 10, 2013 at 2:57