n00b question regarding post-process portal effect

Howdy and hello,

I’m trying (and failing hard) to implement an effect for a portal. My initial attempt involved a mask material, but the warping effects are somewhat undesirable. I found an example on youtube, but I don’t understand how to wire the post process material as the person suggested.

here’s the links, person replied when I asked,

"Hi. I use two synchronized cameras - character camera and Scene Capture 2D camera, which located in another room. So in post process material I have two images from these cameras. Material color of portal sphere is green. In post process I get image from character camera and check if pixel color is green and if so I use color from Scene Capture 2D camera. When projectile hit the sphere I teleport it to another room. I dont know why, but Scene Capture 2D make more darker image than character camera and so scene get brighter when I walk into the room.

It’s very simple implementation with some defects… just an experimental demo"

Here’s my alternative hacked together solution, using an inverted sphere mesh.

When setting this up, I tried to add a scene capture 2d to the character BP, and pass that targetScene texture. In the material, I have post-process enabled, but how do I check if pixel color is green and if so then use color from scene capture 2d camera?

Can anyone please explain this to me, or point me to a resource?

There’s a CustomDepth in the SceneTexture node that would be much better suited for that. I’ve never used it, so I can’t tell you anything about it, but I know thats what you want to be using for this kind of thing.

Ya I tried that, but for some reason wiring it up doesn’t seem to work as described. I suppose the engine was changed and it no longer works the same way :frowning:

Don’t do it in the post process; just do it in on the sphere object itself and use “ScreenSpaceUVs” instead of the normal TexCoord UVs you’d use on the object.

This creates a screen space “post process” effect that happens only on pixels that the object occupies.

I built this effect a few months ago (I think I’ve gotten it smoother since then); I can send you the .uasset files if you want.

The key thing to remember is that as you enter the surface of one sphere, you come out on the inside surface on the other sphere (so you can’t have two spheres and go two ways); making this effect two way between arbitrary spaces adds a ton of complexity/implausibility.
It looks like you’re mostly interested in spherical microcosms which are actually much simpler :slight_smile:

I touched up the .uasset until I couldn’t detect the portal transition (I had to turn post processes to the lowest quality setting to do it, weirdly enough (gets rid of motion blur and a strange scaling artifact I couldn’t pinpoint)).

Feel free to use this for whatever you want:

Just modify the commented node in the BP to use the Wormhole material, and then set the exit transform to be wherever (and whatever rotation!) you like.

(Made in 4.9; probably still works in 4.10?)

This effect will NOT work in VR; the material/SceneCapture rig would need extra work to be compatible with HMDs, as well as needing some Engine-level C++ modification to make the SceneCapture projection matrices off-axis to match the HMD projection matrices.

Maybe you can get epic to expose low-level frustum modification for SceneCapture2Ds like how it is in Unity…

hey zalo,

I’ve downloaded your files and it’s working fine.
Could you please explain why you put it on a decal material?
And how can I modify it to make it work on a cube for my rectangular portal doors.

Thanks for uploading it!

I managed to get it rectangular, but something’s not quite right about it…
You did set the scale of the Sphere’s and the decal to 128,128,128.
I just changed the spheres to cubes and also replaced your “EventHorizon” sphere collider with a box collider.
Then I set the scales of all of them to 0.0001, 50, 100 (door-like shape) and removed the ‘wobble’ effect from the Wormhole material to make it look static.

My Problem now is that the Decals size is not matching the colliders and cubes sizes, although the scale is the same (0.0001, 50, 100).
Do you got an idea?
Maybe it got something to do with the resolution?