1
$\begingroup$

In my scene, I needed to hide a group of elements from the camera, so I hid them behind a simple plane with a holdout shader and as expected, the objects were invisible to the camera.

But here is the interesting part, later the client asked for some modifications and one of them required the scene to be seen behind a glass. So naturally I added the glass element - it was an automatic door - and to my surprise found a strange black square out of nowhere. Analyzing my scene I finally found that the problem was in the combination of the holdout material and the glass shader.

So the holdout shader works fine when seen directly throw the camera, but if I add a glass element between the camera and the holdout, then the holdout element becomes visible as black to the camera.

I tried switching off the transmission property on the cycles settings of the object but the result was that the holdout element became invisible to the camera BUT it stops hiding the elements behind it.

I finally resolved it in practical or artistic ways, like moving the objects away from the field of view or just changing the perspective of the camera. But the problem remained.

To clarify I attach some pics and a blend file to test the effect. BLEND FILE: you will see two views of camera. Switch one of them to renderview and play in the outliner, hiding or showing the elements to see what I mean.

Apparently I can't post more than two links so I had to put everything into a RAR to share only one link.

To clarify let's see what you will find on the pics:

  1. We have a simple cube: H01.JPG

  2. We want to hide it so we add a plane with holdout material: H02.JPG

  3. The cube becomes invisible to the camera. Now let's add a glass object in front of them to see what happen: H03.JPG

Houston! Now the holdout element, which was supposed to be invisible is visible to the camera and looks black as the night!

  1. Let's try to turn off the transmission property of the holdout element to see what happen...: H04.JPG

As you can see the holdout element becomes invisible to the camera through the glass but is not a holdout element anymore! Now we can see the cube...!!!

IMAGES + BLENDFILE:

https://we.tl/GVfLvxqWPg

Any idea is welcome!

$\endgroup$
  • $\begingroup$ Why not to hide it like this: blender.stackexchange.com/questions/17910/… ? $\endgroup$ – Jaroslav Jerryno Novotny Oct 5 '16 at 12:54
  • $\begingroup$ Yeah Glass shader does have that kind of problem. Can't test right now but it might work slightly better if you use a Glossy + Transparent shader instead of glass directly. $\endgroup$ – Duarte Farrajota Ramos Oct 5 '16 at 13:18
  • $\begingroup$ I will try this and let you know... thanks for responding! $\endgroup$ – Lalegion Oct 5 '16 at 17:21
2
$\begingroup$

The Holdout shader is a non-realistic shader that acts much like a black hole. From a data perspective, it really is exactly that.

The glass shader receives information (in the form of ray casts) about what's behind it, and what can be reflected in it. If that information is coming from a holdout shader, it will be null/black/empty/World/Sky. A glass shader that tries to refract, reflect, or transmit a holdout shader will produce some strange results.

For this reason, a holdout shader is really only useful for compositing.

If you want to have objects in your scene that don't render, there are a number of better ways to do this.

For one, you can disable "renderable" for each object in the outliner by toggling the camera button. This doesn't render the object at all in any regard. I think it still participates in simulations, but it won't be visible, nor cast shadows, nor participate in any other render calculations. This will work with both render engines:

Renderability

Another option (specific to Cycles) is to turn off visibility for specific types of rays (Properties panel -> Cycles Settings -> Ray Visibility). This can be a really fun thing to play with. For example, if you uncheck only "Camera" then you will see the object's shadow, it will appear in reflections, and it will appear through glass, but it won't be visible if it's directly viewed by the camera.

Ray visibility

A third (somewhat more complicated) option is Render Layers. You can put those objects on another layer, and not render that layer. Note: there are some constraints, modifiers, and simulations that don't like having their participants on different layers.

Render Layers Layer Settings

$\endgroup$
  • 1
    $\begingroup$ First of all I want to thank you Matt for taking the time to respond! Now, I am aware of the different ways you mentioned as I have used every one of them in this last job. One extra detail of my animation I did not mention is: In my original scene the holdout element is a floor. So as the camera fly into the scene, those objects come into the scene passing through the floor as a ghost would do... If you want I can upload a blend file with my animation to clarify better why those options where not , as far as I understand, applicable. Thanks again for your time! $\endgroup$ – Lalegion Oct 5 '16 at 17:55
  • $\begingroup$ Lol! So many things that aren't quite what you're looking for. Well, that's why B.SE exists, to answer really nuanced questions like this ;-) Yes, uploading your blend file would be a good idea, though I won't be able to look at it anytime soon. It'd certainly be worth your time to drum up some interest in the chat, people there are usually willing to help when you've put in the effort on a question like this one. $\endgroup$ – Matt Oct 7 '16 at 14:49

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.