Recreating UDK's UTPortals?

I recently started using Unreal Engine 4 and was disappointed to see the removal of the UTPortal actor. I’ve tried experimenting with SceneCapture2D and depth buffers to get a similar effect, but the resulting view, while three-dimensional, lacks any sort of perspective detection and the view remains stationary.

I essentially recreated the effect shown in this video

It’s certainly better than just a flat real-time 2d texture, but it is a far cry from what the UTPortal actor could do. Does anybody have any ideas?

Just an idea. Not sure how good it will work.

Setup a camera that points to the destination area. Positioned at the portal exit. Manipulate its properties (FOV, rotation…), based on the original player camaera - entry portal values. Ie if your original camera is at 45 degree angle with the entry portal plane, you adjust your secondary camera to be at 45 degrees with the exit portal plane. Then render the view given by the secondary camera onto a render target and use it to texture the entry portal surface.

I had tried the above method in UDK and got pretty good results. However it was simply a demo I did after playing portal and did not have anything to do with gameplay. SO I cannot say anything about how it will affect performance.

I think it could work. This is my idea which expands upon yours a bit. But it requires culling an area between the SceneCapture camera and the back of the exit portal. Is this possible?

I’m relatively certain this is generally how the original UTPortal actor functioned.

You could adjust the near clip-plane to get the culling…I think

Update: It looks like UE4 does not support custom NearClip Plane for SceneCapture2D component or cameras. UE3 had this feature.

I have created a demo by rotating the scenecapture2d component and adjusting its FOV angle based on distance. The results are far from ideal, but will give the player an illusion of a portal as long as he is not too close to it.

I have managed to recreate my UDK portal in UE4 (kind of). It is not in usable form and is not optimized. But if anyone is interested in creating portals, this might give you some ideas.

Here is the Scene setup and Gameplay demo

  • [Portals using UE4 Blueprint : Scene Setup][1]
  • [Portals using UE4 Blueprint : Gameplay Demo][2]

The blue print is shown below:

Problems:

  • It uses a large Render Target (same as the screen resolution), which results in low FPS.
  • I hardcoded several things like resolution, eye height, active camera into the settings and blueprints
  • I could not find an option to set a near clip plane, so the illusion fails if player is too far away (other stuff will block the portal)

If anyone is interested I will try to make more screenshots of other assetts as well.

Hey everyone,

Why don’t you carry this discussion to the forums so that more people can make use of all the information here? You may also get more participants and maybe even different solutions from others. :slight_smile:

How it is done:

Basically I created 4 things:

  1. A Render Target which has same resolution as main camera output.
  2. An unlit material which uses the above render target. The ‘Screen position’ node is given as input for UV pin. (this will clip-out unwanted areas of the target)
  3. A blueprint named BP_Portal_Entry. This is the door that you want to get into. It is very simple setup. All it has are two static meshes. One is the door frame. Second one is a plane on which the material from step2 is applied,
  4. A blueprint named BP_Portal_Exit. All the logic is done here. It has a DoorFrame as a static mesh component. Under it we have an Arrow (not needed), and the arrow has a SceneRender2D component. This component is set to render to the Target I created in Step1. The Event graph is shown in the image.

Each tick, I calculate the relative position and rotation of the active player and his control rotation with respect to Entry portal. I use these values to set Relative position and rotation of the Arrow component in Exit portal. (the arrow is not needed. I put it there so that I can see if the orientation and position are correct). This in effect moves and orients the SceneCapture compoenent.

This is not an ideal setup. Many things are hardcoded. Ideally the logic should be moved to Entry portal whcih should hold a scenecapture comp. This was we could have multiple Entry portal to be linked to the same Exit portal.

Render target is too big. But only a fraction of it is being used most of the time (only the area within the door frame). Essentially we are rendering everything twice.

I posted it to the forum Recreating UTPortal from UDK in UE4 (the portal effect from Portal in UE4) - Blueprint - Epic Developer Community Forums

Also, is there a way to solve the lag of the portal image? I believe it is due to the use of pure ticks to time the camera movement

Hi Mindfane,

Could you share the blueprint, I would like to investigate this further and see if I can get this to work.

Hello there,

I dont know if I have the blueprints with me anymore. But I will see if I can find it and if I do, I will post it in the fourms:

Please continue the discussions in the forums.

This is not my video, but it shows what you want to do :D.

Don’t ask me how it works, but I think it’s what you’re looking for. Scene Capture Components now have a Clip Plane Base and Clip Plane Normal attribute. Which is “useful for portals”. I’ve tried using them, but couldn’t get the values correct. Might be what you’re looking for.