Camera rendering only selected objects / layers?

Ok, so if I want Camera A to render certain types of objects to the default viewport, and Camera B to render other types of objects to a viewport on top of the default viewport, how can this be done? That is, I want to limit cameras to render only certain objects (mask/layer) and multiple viewports rendered with different cameras stacked over each other. Should be basic stuff.

I don’t know much about UE4’s camera and viewport system but I’m assuming this should be a relatively simple task.

As far as I know, CustomDepth is the only way to achieve this.

Tom Looman’s site has a bunch of great tutorials covering the topic.

Yes you use the custom depth for such thinks. Like when creating portals: - YouTube

The bad think is that it features only one layer of depths, there has been some community efforts to add multiple layers to it: [Odessey] Creating my own G-Buffer in UE4 - C++ Gameplay Programming - Unreal Engine Forums