there was a gdc talk awhile back where one of the developers of budget cuts talked about how they made portals. I don’t understand how they did it without render targets. Maybe it used some feature exclusive to unity, but if not I would like to figure out how to replicate the effect.
Is this something that would be set up in post processing?
This technique is not limited to Unity, you can do this in UE4 - but this is not something you will be able to do in blueprints, you need to use C++ and renderign hooks, and this technique will work only with forward rendering (and AFAIK you will need to modify UE4 renderer a little, to allow custom sorting of objects);
The outline is as folows:
1] At the start of frame render your portal shape, and in shader write 0 to depth (this will need to be done in c++, to be sure this is the first object drawn in scene)
2] Render scene normally (all things, transparency included)
3] Render your fancy portal outline
4] Now comes the tricky part, you will need to inject into renderer to clear depth buffer to 0.0, and render again your portal shape, this time filling the zbuffer under it to 1.0
5] More trickery will be needed - change camera view to the one of the portal, and issue rendering from there of all things (transparency included)
6] done
if you are familiar with UE4 renderer code, this should be possible in few work-hours, if you are not then well … use RT cand captures.
The solution from budget cuts is not ideal, as it overabuses early-z (so all the vertex/tesselation processing is still there, as well the DP calls), probably well crafted solution that actually renders ONLY what we need into the portal rendertargets (and clips out at geometry level whats outside the portal) would be much faster and less complicated.