How to make anything within object invisible (without boolean)?

Hey guys,
So I have an object, and I want to mask out a portion of it. How do I do that? I’m hoping it will also work with collections, and I also don’t want to use boolean.
I decided to make a small .blend file to demonstrate what im trying to do: project.blend
I want to mask out everything behind the portal, so I can see the red cube through it.
Any help would be appreciated!

There is a mask modifier.

I would also like it work with collections, since thats what I’m primarily working with.

Sorry, I didn’t notice that… What do you mean? You want to mask elements of a collection, or mask parts of geometry that are in collection instances?

You can make a holdout for a particular object that you want to mask out for a render.
I recommend you watch this video if you are interested in something related to collections and view layers. Let me know if it helps!

i would like to mask out elements of a collection.

i dont think people understand what i’m trying to do, so i made a small blend file to demonstrate what im trying to do.
project.blend (964.8 KB)
i want to mask out everything behind the portal, so i can see the red cube through it.

Check this out, I saw this somewhere here (blenderartists). Move the cube towards the plane and through it.

collision-detection-mat.blend (798.0 KB)

EDIT: Is that what you want, to make a transparent circle in the box?

Make a collection and a view layer for each world and one for the portal, then compose them like this:

Here’s the blend file too:
portal-between-2-worlds-compositing.blend (875.4 KB)

I feel like people still don’t understand, so here’s a crappy diagram:
this is how the mask is:

and this is how I would like it:

how do i do that?

i think what you need is an option called HOLDOUT

I don’t think I understand either. You want the object “cut off” at the portal? Do you want the geometry eliminated or the object to be invisible at that point. In other words do you care if you just don’t see it (transparent). Another approach to what it seems you are asking is that you could generate the geometry below using the knife project tool. This will not work with shade smooth.

Do u want to mask it in the final render or just for viewport?

final render.

but im using collections, so that won’t work.

i tried that, but that just made EVERYTHING invisible.

Well it will be helpful if u share the screenshot of the actual project

i posted a link to the project, if you need it

I think I get it now. so u want the portal to make a hole in the cube beneath it without boolean, and you don’t want to make the whole cube invisible, am I right?
One way can be to make a procedural material for the object to create a mask.

Other than that I don’t think what you want to mask out is possible without adding a boolean modifier or adding an extrusion. With collections, you can only mask out the whole object and not the actual geometry.