Recreating UTPortal from UDK in UE4 (the portal effect from Portal in UE4)

I’m really curious how it looks.
I’ll try to translate it into C++ when i get it working like I need it :wink:

I think it’s pretty much the same result as in a video, which was posted before ( UE4 Portal Doors - YouTube ) expect mine works both ways… xD

And I did some tests… it really seems like the face the the portal is overlapping with an object (or it seems to be enough to even just be inside the “Bounding Box” of an object) is triggering the multiple teleport…
I don’t know much about that but it still happens when i set that object to BlockAll and untick Generate Overlap Event in the Collision-Tab. I could really need some help with that…

Another thing I just saw that I missed is:

The Resolution of the Texturetarget is constantly at 1080p… If you use a different Viewport Aspect Ration (not 16:9) this causes a distortion on the Portal… there should be a way to set texture size to the viewport size… This way it would also use fewer perfomance (without changing the value by yourself) when you run the game at 720p…

Thanks for mentioning it.
I already blueprinted something that automatically adjusts the resolution to aspect ratio of the Portal mesh :wink:

I’m checking out your work right now…
The teleportation seems completely off, but the visuals are awesome!
Well done!

I’m looking at the teleportation now…

That awkward moment when you have the perfect portal system but the code isn’t yours to share :frowning:

Well… thanks for saying it :smiley: :frowning:

@DennG well I guess what you mean by saying the teleportation is off is the bug i mentioned… I think I added a string value that prints out Entrance when you go through the first portal and Exit when you walk through the 2nd Portal… sometimes the portals get triggered multiple times… and as it seems its caused by the walls… (if the portals are completely free it works perfectly…) I couldn’t yet find a way of fixing it…

@TheJamsh and DennG Thank you both very much :smiley: I appreciate it! Even though it has still things that have to be improved… (the teleporting bug… -.- I need it fixed… it’s really annoying…)
Also… if you want to show it to someone… just post this link… I think the others here did most of the work… the tutorial with the portalgun that I mentioned earlier really helped me getting started in UE4… (it’s actually the first time I’ve been editing anything in the blueprints…)

I’m happy to help where I can, maybe even write some code. In the end we had to use a custom render path (in C++) to get this working, with a different projection matrix on the capture actor. Without it, things would distort and it was practically impossible to make it 100% seamless. It was also quite expensive thanks to the Render Target, but switching off some items like AO and clamping the draw distance helped that a lot. The advantage however, was that in doing so we could also get it working with VR. (I say ‘We’ a lot in this sentence, but in reality it was a super-talented guy from EA who helped us out most of last year).

There’s a very crude example of it working in our Epic Gam Jam submission (Post #138 in the submission thread!) if you want to check it out. But it was kind of hacky in that example thanks to streaming levels etc. I’d like to have a proper go at it myself and see if I can squeeze some more performance out of it.

In order to help make the teleporting more seamless, we also have a ‘Manager’ object that just tracks the players velocity constantly, and when they are ‘just’ close enough to the portal, it teleports them through in such a way that it remains seamless, but it’s a balancing act of the current velocity of the camera and the distance from the portal to get it right.

It’s also first-person only atm, and if a portal tries to render another portal in it’s capture actor, it’ll just be black (as a safety to prevent overflow).

@TheJamsh
I really like to do it in C++ and without SceneCaptures, but I don’t have any experience with graphics programming. I only know a few things about render paths. Do you know tutorials or articles where I can learn things related to that? Or even give me a starting point.

I haven’t got a clue I’m afraid. I also don’t have the source for that to hand atm so I’ll look it over again and try and find the key points and post here!

Thanks for the fast reply. That would be awesome! :slight_smile:

Sorry for double-posting

@TheJamsh
I found some interesting examples of portal rendering. It’s not in Unreal Engine but in theory it should be the same I guess.

OpenGL Portals: OpenGL Programming/Mini-Portal - Wikibooks, open books for an open world (Source included on the bottom)
Unity3D Portals: Unity 3D - Portal Room Cubes via Stencil Buffer - YouTube (source code: http://www.noisecrime.com/unity/packages/PortalRoomCubeViaStencilsExample_u4.2.zip)

Both are using stencil buffers to achieve the effect.
Now it would be good to know how to integrate this into Unreal.

Btw… I’ve tested your Epic Mega Game Jam entry, but unfortunately the portal rendering was not visible :confused:
Other than that it was awesome! respect!

I would be so grateful if you could help me out with this.

I know it’s been a while but I tested your blueprint in a project and found that same problem and managed to come up with a poor man’s fix. It seems the problem has to do with the firspersoncharacter’s capsule component hitting both the wall and teleporter at the same time and at strange angles, so all I did was replace the capsule collision component with a box collision component, and it works flawlessly now.

Probably not ideal for everyone’s purposes but it works for me, and it could shed some light on what exactly is causing the multiple teleport problem.

Video for those interested

Kind of off-topic but how did you change the capsule component to a box? This is essential for my current project.

I just went into the first person character blueprint, removed the capsule collision component and then added a box collision component, giving it roughly the same size and dimensions, as well as the same collision properties.

Hope that helps!

I have researched the method on how to implement this effect myself, and I have finally figured it out. I think I’ve made a breakthrough,
Hope this helps whoever comes across this topic again.

Here’s the tutorial:

Supercalifragilisticexpialadocius! (Think I spelled it correctly… have to pack up and run home from work right now).

It’s SOOOO close to being perfect! Just TWO issues left to solve (aside from physics handling, that’s a different beast)

  1. Culling everything between the virtual camera and the portal plane.
  2. Recursive rendering (probably only possible through trickery and not actual recursion)

My portals in development https://www.youtube.com/watch?v=wdTUT-9EZeI
https://www.youtube.com/watch?v=wdTUT-9EZeI

Far out man! MasterOfDreams That is beautiful! I’ve been trying to get the seamless transitions (animating characters between 2 portals) and can’t find a way to do so… I really have no idea how you got it working like that :frowning:
would it be possible to ask you for a tutorial on how you did it or example files? (if it’s Ok with you ;))
Thanks man!