I'm creating ice material, and it works fine, but only in viewport or with background (i.e. disabled Transparent in render). Here is my Nodes with result in the viewport:

But it isn't drawn in render:

Also, as I said, it works fine if I disable Transparent in Film section of Render tab:

But I need transparent background! With all the nodes working. In addition, I figured out that the problem is due to mixing 2 Transparent shaders, they somehow affect not only colours, but the following nodes. But I believe if it works fine in the viewport, it is possible to solve for the render. How can I achieve it?

• I have an HDRi environment.

• I use orthographic projection.

You need to be very careful when using the Add shader as it is not physically accurate and can produce some unexpected results - as you have discovered here. This is actually “expected” behaviour when you understand how the Add and Mix shaders actually operate.

A shader effectively defines how light hitting a surface contributes to the light leaving that surface - some will be absorbed, some will be reflected, some will pass through. This occurs for each of the Red, Green, Blue channels and, also, in the case of ‘transparency’, for Alpha.

The Mix shader takes any teo such shaders and ‘mixes’ them together proportionately. For example 50% of one and 50% of the other, or 30% or one and 70% of the other, etc., but, importantly, always adding up to 100% (an unconnected input socket effectively counts as pure black).

When you use the Add shader the same ‘safeguard’ of only ever having 100% of a shader contributing to a surface no longer applies. This means that you can have more than 100% of any element present in the resultant surface.

In the case of transparent shaders, one could contribute, say, 50% Tranparent and 50% Diffuse at 30% grey - in ‘RGBA’ terms, this would be (0.3, 0.3, 0.3, 0.5) - ie, transparent grey. Mixing between this shader and another would produce consistent results... but, Adding this shader to a sinilar shader would add the corresponding contributions... so this could result in (if the second is also 30% grey to demonstrate) RGBA values of (0.6, 0.6, 0.6, 1.0) - ie, it has now become 100% transparent!! (But only because the shader is infront of a 100% alpha background - ie, the transparent environment).

Using other values can actually result in values that are greater than 100% and this can produce even stranger results when combined with other shaders.

The upshot of all this is that you should be very careful of using the Add shader unless you have a very good reason - for example, adding an emissive glow or combining Scatter and Absorption shaders. Normally just use a Mix shader.

• Thanks a lot for your reply! But I understand how Add and Mix work – I have huge experience of programming OpenGL shaders. And I have already got nice result in the viewport and want to output it. So, I just want to understand and minimize the difference between the viewport and the rendered picture. I even set the same sampling, but it didn’t helped... – AivanF. Aug 13 '18 at 19:38
• @AivanF. I see. I suspect your issue is with the limitations of the Viewer itself - see blender.stackexchange.com/a/44148/29586 and blender.stackexchange.com/a/56986/29586 – Rich Sedman Aug 13 '18 at 20:14