I would just like to share my latest experiment, for one of my projects I require the need for portals to simulate Non Euclidean style rendering. I was not happy with the Scene Capture 2D approach as this introduces a bad delay. So I went about modifying to the engine rendering code to support rendering portals directly through the use of the Stencil Buffer. These are my results:
The good thing with the approach is it allows light and shadows to actually pass through the portals. Right now only light does, I have not implemented the portals to the shadow rendering pass as of yet (That is why there is no shadows).
Also as part of the portal rendering, I built a render layering system so that the destination can be completely hidden from the main render and only visible through the portals. The below screenshot shows a shot from in editor where the room is actually placed:
I plan to implement more control over render layers, using volumes to control the render layer of large quantities of objects without having to set it manually. The advantage of the render layers is being able to specify that only certain objects get rendered in Scene Capture 2D render targets (more control than just specifying static meshes, skeletal meshes, etc.)
Below the render targets show only objects in render layer #2 (Portal window in 1st screenshot, and Table and ball in second screenshot). While the main scene shows all layers:
About the delay when using Capture2D:
Tom Looman and I worked on Portalrendering on our own seperately using Capture2D. He told me about the TickGroup, which allows you to specify that an actor ticks AFTER all physic updates have been done. Because before updating the portals viewport, everything else must have moved.
Interesting, altho the issues with portals using scene capture 2d is more than just the update rate, lighting cannot influence the area inside the portal unless its duplicated, with the above method I can place lights that will light up the portal area, as well as cast shadows into it. At the moment its a bit buggy, mainly as I have not changed the code to select which lights belong to which layer. Also theres usually a discontinuity between the two rooms, especially with screen space reflections, with the above method, its seamless.