I have recently been working on a project that has a “portal” like effect where one version of the map exists in the shadows, and another in the light. I have so far been successful in using render targets with a camera placed in each copy of the world being able to create the illusion between the two, but now I’ve run into a shader problem. When dealing with lights that may be static or dynamic, some objects fall between both worlds (half of a bookcase may be in the light and the other half in the dark, or a monster may be in the dark but it’s outstretched arms in the light), and I needed to make these objects invisible when they cross over into the light/shadow, but only the parts that are in the realm they shouldn’t be in. To do this, I thought I could employ an opacity mask, but the issue is that UE4 uses deferred lighting, and I need to know how illuminated a certain point is on an object.
So I wanted to ask, is there any way to do this? Is there any way to somehow acquire an illumination map or real time illumination value for both static and dynamic lights so that I could use this for an opacity mask? Or is there any other alternative I could look into for transparency based on illumination?
Thank you ahead of time for your help.
I’ve attached some roughly photoshopped pictures from my current working level to show the effect I’m trying to achieve.
The second part of the level where the scene capture camera resides, and the part that should be shown in the shadows
The goal concept