Rendering multiple overlapping scenes in the same location

I am trying to create an effect which requires rendering multiple scenes in the same “place”, so that the geometry sits in the same place in the world, but dependent on some property in the shader or the material settings one or other of the scenes will be rendered. There are a couple of approaches to achieve this:

  • The first, which I have successfully implemented, is to use a Material blueprint to determine whether the fragment should be drawn, and then set its Opacity to 0 or 1 based on that. This is relatively simple and allows me to have the geometry in the same location, but it doesn’t allow me to have different lighting and other effects in the different scenes; it is less “two different scenes” and more “two different sets of geometry within a scene”.
  • The second approach is to have the second scene at some offset, say -10000 in the Z, and use a Scene Capture 2D to get a capture of it rendered to a texture, which I can draw to the screen appropriately. This allows the scenes to be completely different in terms of lighting and so on, but means they are not at the same location.

It would be useful to have the geometry actually physically sit in the same location because there are times I will want to be able to collide with things in either scene and this would be a pain if the scenes are offset from each other (I suppose I would have to have some sort of proxy of the collidable in the other scene and then propagate any collisions back to the original Actor).

Another approach would be as follows:

  • Have two “scenes”, including geometry, lights, and everything else, existing in the same space, and render them both using separate render passes, then composite the images later.

However I don’t know if this is possible in UE4 as it stands. Other posts I’ve found that touch on similar issues seem to imply that the new deferred rendering model makes this difficult. I’d like to avoid having to modify the engine if possible. If it were possible, though, this feels like it would be the ideal solution.

My question then is as follows: Is this two-pass approach possible? If not, is there another approach I haven’t considered?

Incidentally, I did notice this question which looks similar: Rendering two camera-scenes in one framebuffer - Cinematics & Media - Epic Developer Community Forums however the linked forum post seems to have been deleted :frowning: