Holdout shader mixed with other shader looks great in Viewport not in Rnder!?

I want a holdout shader to to punch a hole in my render, but I also want some highlights from another shader to be miixed over the top.

I get exactly what I want in Render Viewport (hole punched but with highlights from Diffuse shader over the top), but not in the render itself (all of the cube becomes a hole and Diffuse shader highlights are absent). Any ideas why please?


Holdout Shader sets the Alpha to 0. The full render is rendering correctly. If you want, you can choose to display only the color channels and ignore alpha with the settings in the UV/Image Editor main bar. You’ll see that the color of the cube is still there, but because it’s alpha is 0 it doesn’t appear normally.


The Viewport render doesn’t seem to support render alpha, instead taking the checker background and using that in it’s next operation. I feel like that might be a bug.

I assume you want to use this for some kind of compositing?
If so, did you try to actually alpha-over this on a background color or image? You might find that the “vanished” parts reappear.

I remember a discussion about this some time ago. This is a quote from Sergey Sharybin (one of the developers):

It’s not bug with cycles, it’s a specific of visualizing premultiplied image in viewport and image editor. Viewport is like compositing the render result on the checker, image editor converts image to straight alpha first (because ogl is set up in a way it expects straight alpha in blender atm). In order to make it look in more expected way you actually need to alpha-over it on some background.

Alpha-over does indeed reveal the ‘vanished’ parts, but it also makes anti-aliased edges steppy, presumably because antialiasing is also coloured pixels made transparent. It also fills in all the transparency - i want it to remain transparent as a PNG.


“Mix shader” node instead of “add”?


Mix will apply shadow as well as highlights, but nothing will be fully transparent! The whole point is that I want highlights to be opaque and wherever there are no highlights to be totally transparent. In other words, how it looks in the viewport is how i’d like it to render!