this issue is driving me crazy. I have this simple node material with a dirt texture (.png) applied to a plane.
In the preview render it works and shows up but as soon as i try to render i get nothing!
Someone can help?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Diffuse shader by default contributes to the final image alpha with a value of 1.
Transparent shader contributes with a alpha value that reflect its colour HSV value's... value. High values corrispond to a low alpha (not in a proportional way).
By using an Add shader you are combining the shaders's alpha info (or you can call it Transparency values) in the final render too. I can't exactly tell you the math between the values combination (see below for some thought about it)... anyway the important thing is that the low values rules!
If the Transparency values would be the imputs of a logical operation, the Add shader node would work quite like an OR operator.
In this particular case, the white transparent shader would bring to an almost completely black alpha channel in the final rendered image. If you examine the composite pass without enabling alpha channel I bet you'll see the image correctly rendered, and the alpha channel almost completely black, resulting in an empty final image.
What about the preview?
The difference from the preview cames from the fact that the preview has no alpha, and the grey checker pattern that looks to us as if there is nothing...it's merely a simple, true, background image! It gives the illusion of transparency but it's not related with the final alpha channel. It's the same result you would get in the final render by adding a checker background.
In fact if you put an object with alpha behind your geometry, it will shows up correctly (same thing if you disable Transparent option in the Film panel).
As the resulting shader bring not exactly to a completely black alpha channel, you can try to exaggerate the difference of the values stored into by adding a Math node set to Greater than as in the following picture:
By the way, the most common way to use alpha from texture in shaders involve using the mix shader node as in the following picture:
So the final alpha will be composed from a mix of values of the diffuse alpha (1) and the values from transparent shader (0) masked by the texture's alpha channel.
Here's a brief analysis of how Add Shader node combines two imput values.
Testing scene setup:
As shown by the blue function in the graphs above, the resulting alpha is quite similar to the sphere sector equation. The difference is probebly due to the use of some dampening factor, anyway there is no doubt that should be something not too far away from:
Alpha = (1-Value1^2-Value2^2)^0.5
As stated before the Diffuse shader gives you an alpha value of 1, so it means it behaves as a black transparent shader, so it's Transparency = 0. By setting a full white Transparent shader (Transparency = 1) and adding the two shaders you'll have:
Alpha = (1-1^2-0^2)^0.5=(1-1-0)^0.5=0
Which means that with that node setup your images will always have an empty alpha channel.
I wasn't able to find any evidence in the documentation of what I said, so consider it as my personal opinion.