Using and object as matte for another object ? (at render, not compositing)

Dear all,

I’m trying to replicate something I’ve been able to do in C4D for a long time, but I can’t seem to find the way to do this in Blender, I’m currently using 2.81a.

In a nutshell, what I want to achieve is the following:

  • First object (glass) is in front of the camera.
  • A second object is behind the first object.

I would like the second object to be ONLY visible when it’s behind the first object, but otherwise to be invisible. This would allow me to use the first object as a “revealer” when the camera’s angle is the right one.

Is there any way to do this in Blender ? I’ve been looking around but I only find tutorials about holdout, but the effect I’m trying to achieve is kind of the opposite ^_^.

Thank you for you time.

Alright,

Seems I found a solution, I will leave it here in case it can help someone:

First object (the one in front), should be of course some type of glass (so it transmits rays).

For the second object in a nutshell what you have to do is to have your shader whatever it is piped into a mix shader, and having as a mix a transparent shader. You should then use a Light Path node drive the factor with the “is Transmission Ray” option.

Than and only then the object will be visible the rays have passed through glass or something transmissive:

Hope this helps.

Ark.

Here is a poorly sample render test to illustrate the purpose:

Little follow-up on this, so you can grasp what I was after (WIP):