Problem with Ligh Path Node

So recently I decided that I want to use the light path node… And I did, but I have a problem.
I wanted to make a kind of realistic “portal” that light can go through it (not to be confused with “light portal”, that is NOT the same thing). This is what I did at first:

So this works fine - the circle, that has a transparent material, Is kind of like a “portal” to a world where the red cube doesn’t exist. But I want the opposite - I want the circle to be a portal to a world where the cube DOES exist. So I should do that just by swapping the diffuse material and the transparent material… right? Well, I did, but I didn’t get what I want:

As you can see, I wanted the outside of the cube to be transparent, but it’s black for some reason - like there’s no material In there. Is there any way to fix this? Please Reply if you can help!


portal.blend (516 KB)

Moved from “General Forums > Blender and CG Discussions” to “Support > Materials and Textures”

The transparent depth, gives you the number of times the ray that is hitting the object has already crossed a transparent shader. In your second example, the ray hits the front side of the cube, which is transparent, and continues in tge same direction until hitting the backside of the cube. But now the transparent depth has a value of 1 and the mix shader places a diffuse there. All other bounces will be diffuse also, and the ray is traped inside the cube, and never reach any light, therefore the black color.