2
$\begingroup$

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?

enter image description here

$\endgroup$
  • $\begingroup$ Show us the camera view. $\endgroup$ – atomicbezierslinger Aug 29 '15 at 19:27
  • $\begingroup$ Try using a mix shader to mix between the diffuse and transparent, using the alpha channel of the image as the factor. That's the traditional method, although in theory I can see using the add method working. Also check out this answer about objects not rendering. If neither of those work, could you please upload your .blend (or stripped down .blend that shows the same issues) to BlendExchange? $\endgroup$ – TARDIS Maker Aug 29 '15 at 19:35
  • $\begingroup$ That is an unconventional way to make a transparent shader. See this answer for the normal setup. $\endgroup$ – David Aug 29 '15 at 20:17
  • $\begingroup$ btw, could you post a result of a normal render? I think it's quite possible that the add shader is messing it up, but I still think that something would show up in the render. $\endgroup$ – TARDIS Maker Aug 30 '15 at 2:46
2
$\begingroup$

Because transparent shader brings alpha channel information.

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.

enter image description here

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).

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

Some values:

enter image description here

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

enter image description here enter image description here

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.

$\endgroup$
  • $\begingroup$ Thank so much to all of you for all this great information. Now i have more clear some basic but very important aspects in Blender nodes. $\endgroup$ – SottoZen Aug 30 '15 at 13:10
  • $\begingroup$ Thanks so much for the great info you wrote here. I didn't know that the checker map in teh preview window was not a real transparency! Unfortunately, i tried different way to get the PNG work as i wish but i give up. Instead i render it as a normal texture and then, as you can see in the picture, in POST i put a simple multiply mode to the layer.. and it works fine. ( the problem was to add a "dirt layer" between the character an the real footage because in the original footage it seems like there's no window at all) Now, after reading all your info i will try again with the mix node more in $\endgroup$ – SottoZen Aug 30 '15 at 13:50
  • $\begingroup$ I'm afraid to be not able (yet!) to give a look at the source code to check the truthfulness of my opinions. I hope somebody with more knowledge can correct me about it. I've added some thought about how the Add shader combine imput values. $\endgroup$ – Carlo Aug 30 '15 at 23:41
0
$\begingroup$

Techniques

  • Use a mix shader not a add shader
  • Know the user view and camera view are two different concepts
  • Press 0 repeatedly to alternate between camera view and user view
  • Place a light and more objects in the scene to check for render visibility
  • Check the render enable state of your object in the outliner view
  • Check Cycles Camera Ray Visibility State
  • Check Render Layer Settings
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.