Hi All,
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:
http://i.imgur.com/jFkAH6P.jpg
Movie Clip:
https://youtube.com/watch?v=Of3JcoWrMZs
Various shots from in the editor showing the portal geometry and normals/scene depth:
http://i.imgur.com/CL7fQPm.jpg
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:
http://i.imgur.com/QhcD0n0.jpg
All the objects of that room are in render layer #1, so when changing to Game mode, only render layer #0 is shown, making the room dissapear, but still visible through the portals:
http://i.imgur.com/47117h5.jpg
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:
http://i.imgur.com/3rwolaE.jpg
http://i.imgur.com/H7MU0tB.jpg
Current limitations are:
- Various passes, such as Shadows, Translucency, Particles do not work yet, working on that
- Portals must face the same direction as the destination portal, mainly because Im not very good at rotational math.
- Occlusion culling doesn’t work at all, so is disabled during portal rendering (So only Frustum culling). Working on a solution
- Nested portals do not render yet, once you enter they will render
- Objects can only be in one render layer at a time. Will be improving this to allow objects to be in multiple layers.