# Simple Portals

**URL:** <https://forums.unrealengine.com/t/simple-portals/91190>\
**Category:** Community & Industry Discussion\
**Tags:** unreal-engine\
**Created:** [May 2, 2017, 2:17pm UTC](https://forums.unrealengine.com/t/simple-portals/91190 "2017-05-02T14:17:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [May 2, 2017, 2:17pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/1 "2017-05-02T14:17:26Z")

</div>

Hi!

I see that many people interested portals feature.  
Here is small tutorial for you about.  
Hope it will be helpful.

**New project location:**

> **[GitHub - redcatbox/Portals: Portals feature for UE4](https://github.com/redcatbox/Portals)**
>
> Portals feature for UE4. Contribute to redcatbox/Portals development by creating an account on GitHub.

**New wiki (github):**

> **[Overview](https://github.com/redcatbox/Portals/wiki/Overview)**
>
> Portals feature for UE4. Contribute to redcatbox/Portals development by creating an account on GitHub.

Wiki page (old):

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

Project files (old):  
[https://drive.google.com/file/d/1QFsJCgAroXiFi6H3T37ioSvxz6qsyJSo](https://drive.google.com/file/d/1QFsJCgAroXiFi6H3T37ioSvxz6qsyJSo/view?usp=sharing)

Example project contains:

1. Examples for simple camera-screen setup:  

2. Examples for simple mirrors:  

3. Examples of simple portals:  

Old demonstration video:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/f/52ff93a85ebf74e8d9e8d4b3193df63f91fa2894.jpeg "Simple Portals") ](https://www.youtube.com/watch?v=rjOn1ynsfc0)

**Update 24/05/2017**  
[https://forums.unrealengine.com/comm…876#post992876](https://forums.unrealengine.com/community/community-content-tools-and-tutorials/116726-simple-portals?p=992876#post992876)

**Update 19/07/2018**  
[https://forums.unrealengine.com/comm…76#post1503676](https://forums.unrealengine.com/community/community-content-tools-and-tutorials/116726-simple-portals?p=1503676#post1503676)

**Update 02/02/2020**  
[https://forums.unrealengine.com/comm…27#post1716627](https://forums.unrealengine.com/community/community-content-tools-and-tutorials/116726-simple-portals?p=1716627#post1716627)

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [May 24, 2017, 3:25pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/3 "2017-05-24T15:25:55Z")

</div>

**Update 24/05/2017**

This experimental project went a little further. So, here is small update.

Wiki page:

- Changed some text and pictures.
- Changed description of example project.

Example project (updated to UE 4.15.3):

1. Added blueprint function library with basic math functions for portals operations (BP\_PortalsFunctions).

2. Added PlayerCameraManager class to handle camera transformations.  
Player character:

- Added advanced teleportation example that works smoothly with camera/character transition through portal;
- Added copy of skeletal mesh component, that used to visualize advanced teleportation;
- Added ability to teleport through uniformly scaled portal, but needs to scale some more parameters;
- Added simple PhysicsHandleComponent setup to manipulate physics objects.

1. Added experimental physics actor class (BP\_PhysActor), which can be teleported through portal. It also uses copy of StaticMeshComponent to visualize teleportation. It have few issues but maybe you can make some improvements.

2. Added material function MF\_ClipPlane, that uses world coordinates of specified clip plane to make material clipping through portal. Use it as opacity in masked/translucent material.

3. Added material function MF\_PortalPlane, that used as mask, to replace inner portal surface with color or texture. See material “M\_PortalReplacement”.

4. Portal actor:

- Portals supports any scaling for basic portals math functions.
- Portals supports uniform scaling for rendering portal view.

Note that for now teleportation setup is fully dynamic. So, theoretically, it supports moving/rotating/scaling portals. And it may be unnecessary if your game uses static portals.

Also, I tried to fix problem with portal surface clipping by camera near clip plane, using portal’s render target in post process material.  
I’ve almost find formula for clipping mask, but suddenly I stuck with another problem - render target texture appears darker when used in post process material. I think it related to post process/HDR settings, but I don’t know how to fix it.  
So in example project it’s disabled. You can enable it by connecting IsTrackTeleportation branch to Tick event in PlayerCameraManager class.  
 ![clip_replace.jpg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

---

<div class="post-metadata">

**Author:** ![Staggerlee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Staggerlee](https://forums.unrealengine.com/u/Staggerlee)\
**Post date:** [June 6, 2018, 7:02am UTC](https://forums.unrealengine.com/t/simple-portals/91190/4 "2018-06-06T07:02:54Z")

</div>

This is a fantastic tutorial,  
Any tips to have it work in VR?

---

<div class="post-metadata">

**Author:** ![DennG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DennG](https://forums.unrealengine.com/u/DennG)\
**Post date:** [June 6, 2018, 7:12am UTC](https://forums.unrealengine.com/t/simple-portals/91190/5 "2018-06-06T07:12:16Z")

</div>

Great work redbox 🙂

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [July 19, 2018, 8:02am UTC](https://forums.unrealengine.com/t/simple-portals/91190/6 "2018-07-19T08:02:01Z")

</div>

**Update 19/07/2018**

Somewhere after release of UE4.19, I noticed that mirrors works incorrectly - they become flipped on Z axis.  
It looks that scene capture components no longer supports negative scale. Also I have done few improvements, so here is a new version of example project.

**Project files on google drive**

> **[SimplePortals.zip](https://drive.google.com/file/d/1QFsJCgAroXiFi6H3T37ioSvxz6qsyJSo/view?usp=drive_open)**
>
> Google Drive file.

Example project:

1. Fixed mirrors material.
2. Added base class “BP\_BaseRenderSurface” for all provided actors. It contains basic functions for initialization of scene capture, optimization checks and so on.
3. Fixed rendering lag for Mirrors and Portals. Thanks to @FTC and his Free Portal Mechanics ([Free Portal Mechanics - Released Projects - Unreal Engine Forums](https://forums.unrealengine.com/community/released-projects/119134-free-portal-mechanics))
4. Added “BPC\_SurfaceTracing” component, to hold portals recursive tracing functions.
5. Added new example materials, with distance fade instructions for rendering optimizations.

Wiki page:  
For now, Wiki is disabled for editing due to upgrade process. When it’s done, I will update wiki page according to fixes and improvements in example project.

---

<div class="post-metadata">

**Author:** ![Thunder\_Owl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thunder\_Owl](https://forums.unrealengine.com/u/Thunder_Owl)\
**Post date:** [July 19, 2018, 9:24am UTC](https://forums.unrealengine.com/t/simple-portals/91190/7 "2018-07-19T09:24:18Z")

</div>

Thank You, Redbox 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bf294429](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bf294429](https://forums.unrealengine.com/u/anonymous_user_bf294429)\
**Post date:** [January 2, 2019, 6:15am UTC](https://forums.unrealengine.com/t/simple-portals/91190/8 "2019-01-02T06:15:59Z")

</div>

Has anyone created a VR portal? Any tutorials out there?

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [January 2, 2019, 11:58am UTC](https://forums.unrealengine.com/t/simple-portals/91190/9 "2019-01-02T11:58:54Z")

</div>

> [@anonymous\_user\_bf294429](#):
>
> Has anyone created a VR portal? Any tutorials out there?

Check @FTC Free Portal Mechanics thread [https://forums.unrealengine.com/comm…rtal-mechanics](https://forums.unrealengine.com/community/released-projects/119134-free-portal-mechanics)

---

<div class="post-metadata">

**Author:** ![Fatorice](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fatorice](https://forums.unrealengine.com/u/Fatorice)\
**Post date:** [March 30, 2019, 7:36pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/10 "2019-03-30T19:36:44Z")

</div>

Hello!  
Thanks for sharing your project, really awesome! But I figured out, that there’s a issue when you watch through a portal, which also watches a portal… Is there a possibilty to fix it?  
For example:  
|  
Portal 1 Portal 3  
|

```
                         |

```

Portal 2 Portal 4  
|

The “|” is the Direction of the Portal. And Portal 2 is connected with Portal 4, Portal 1 with Portal 3. When I watch through Portal 2, I don’t see whats infront of Portal 1, I see whats infront of Portal 3, but in the opposite Direction.

Thank you!

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [March 31, 2019, 4:42pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/11 "2019-03-31T16:42:39Z")

</div>

> [@Fatorice](#):
>
> Hello!  
> Thanks for sharing your project, really awesome! But I figured out, that there’s a issue when you watch through a portal, which also watches a portal… Is there a possibilty to fix it?  
> For example:  
> |  
> Portal 1 Portal 3  
> |
> 
> |  
> Portal 2 Portal 4  
> |
> 
> The “|” is the Direction of the Portal. And Portal 2 is connected with Portal 4, Portal 1 with Portal 3. When I watch through Portal 2, I don’t see whats infront of Portal 1, I see whats infront of Portal 3, but in the opposite Direction.
> 
> Thank you!

Hello.  
If you’d read [wiki article](https://wiki.unrealengine.com/Simple_Portals), you should notice this case in [Limitations](https://wiki.unrealengine.com/Simple_Portals#Limitations) section.

It is impossible to show one portal from one pair in another portal from different pair correctly, because all portals calculate their views according to player camera world position. So, portals always “think” that you look at them through player camera. Portal doesn’t know that you look at it through another portal or another camera.

---

<div class="post-metadata">

**Author:** ![FreshDumb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FreshDumb](https://forums.unrealengine.com/u/FreshDumb)\
**Post date:** [May 15, 2019, 5:12pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/12 "2019-05-15T17:12:21Z")

</div>

Hey,

Really nice tutorial you made there. 🙂  
Used it in a project and got it to work pretty fast.

The only problem i encountered is that when you package the project the Portals don’t work any more and i didn’t find anything about that in the thread or in tutorials. ☹  
First i thought the problem was in my implementation, but when i try packaging your example project, it produces the same bug.

Any idea why that may be happening and how i could try to fix it?

Edit: I didn’t really explain what i mean properly i now notice. 😃  
And the Problem also occurs in Standalone mode. The portals show the wrong material and the console doesn’t show errors. It shows only the beige kind of material you see in the browser.

Edit2: Actually found the fix myself, so posting it here to maybe help someone encountering it too. @redbox Maybe it is of help to you too. 🙂  
In the BP\_BaseRenderSurface class, in the function InitSceneCapture you get the Viewport size as a Vector2D. But when the project is packaged or in standalone mode, this function returns 0 because it is executed before the HUD is even registered to the Viewport.  
First of all i changed the function to reference the owning player controller to always get the correct viewport and secondly i made the class delay 0.5 seconds before initializing to make sure the Viewport ist registered correctly. Then everything works perfectly. 🙂  
Hope this helps someone as it was a pretty big pain to find, but i am also pretty new to Unreal and find debugging packaged and standalone pretty tedious. 😛

---

<div class="post-metadata">

**Author:** ![Thunder\_Owl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thunder\_Owl](https://forums.unrealengine.com/u/Thunder_Owl)\
**Post date:** [May 17, 2019, 7:55am UTC](https://forums.unrealengine.com/t/simple-portals/91190/13 "2019-05-17T07:55:00Z")

</div>

@FreshDumb , great work on fixing this! Thank you.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [May 18, 2019, 2:47pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/14 "2019-05-18T14:47:00Z")

</div>

> [@FreshDumb](#):
>
> Hey,
> 
> Really nice tutorial you made there. 🙂  
> Used it in a project and got it to work pretty fast.
> 
> The only problem i encountered is that when you package the project the Portals don’t work any more and i didn’t find anything about that in the thread or in tutorials. ☹  
> First i thought the problem was in my implementation, but when i try packaging your example project, it produces the same bug.
> 
> Any idea why that may be happening and how i could try to fix it?
> 
> Edit: I didn’t really explain what i mean properly i now notice. 😃  
> And the Problem also occurs in Standalone mode. The portals show the wrong material and the console doesn’t show errors. It shows only the beige kind of material you see in the browser.
> 
> Edit2: Actually found the fix myself, so posting it here to maybe help someone encountering it too. @redbox Maybe it is of help to you too. 🙂  
> In the BP\_BaseRenderSurface class, in the function InitSceneCapture you get the Viewport size as a Vector2D. But when the project is packaged or in standalone mode, this function returns 0 because it is executed before the HUD is even registered to the Viewport.  
> First of all i changed the function to reference the owning player controller to always get the correct viewport and secondly i made the class delay 0.5 seconds before initializing to make sure the Viewport ist registered correctly. Then everything works perfectly. 🙂  
> Hope this helps someone as it was a pretty big pain to find, but i am also pretty new to Unreal and find debugging packaged and standalone pretty tedious. 😛

thank you!

---

<div class="post-metadata">

**Author:** ![soylent\_me](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@soylent\_me](https://forums.unrealengine.com/u/soylent_me)\
**Post date:** [February 2, 2020, 10:10pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/15 "2020-02-02T22:10:40Z")

</div>

Awesome work!

> [@](#):
>
> Portal actor:
> 
> - Portals supports any scaling for basic portals math functions.
> - Portals supports uniform scaling for rendering portal view.

Where is this functionality in the BPs? I’d like to adjust how the portals handle scaling and am having a hard time teasing out the dependencies.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [February 3, 2020, 6:43am UTC](https://forums.unrealengine.com/t/simple-portals/91190/16 "2020-02-03T06:43:31Z")

</div>

> [@soylent\_me](#):
>
> Awesome work!
> 
> Where is this functionality in the BPs? I’d like to adjust how the portals handle scaling and am having a hard time teasing out the dependencies.

Hello.  
This is basic behavior of portal functions. How vectors converted into portal space and from it.  
Here is PortalConvertDirection

https://d26ilriwvtzlb.cloudfront.net/7/7a/Pfb\_01.jpg

and PortalConvertLocation fuctions

https://d26ilriwvtzlb.cloudfront.net/c/c7/Pfb\_02.jpg

It using TransformDirection, InverseTransformDirection, TransformLocation and InverseTransformLocation functions that includes scale in new transform calculations.  
There are their analogs in C++ that not using scale.

Additionally, player character handles teleportation itself.  
Blueprint’/Game/GameMode/FirstPerson/BP\_FirstPersonCharacter.BP\_FirstPersonCharacter’  
In function TeleportationAdvanced you can find how it changes self velocity, location, rotation and scale according to portal parameters.  
Well, it is very basic example of how it should be handled, but I hope you will find it useful.

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp\_182748\_1580712331436\_236”,“title”:“20200203\_0844.jpg”}[/ATTACH]

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [February 3, 2020, 4:31pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/17 "2020-02-03T16:31:51Z")

</div>

**Update 02/02/2020**

Hello again.  
Because UE wiki is dead, I’ve uploaded this project to github.

**New project location:**

> **[GitHub - redcatbox/Portals: Portals feature for UE4](https://github.com/redcatbox/Portals)**
>
> Portals feature for UE4. Contribute to redcatbox/Portals development by creating an account on GitHub.

**New wiki (github):**

> **[Overview · redcatbox/Portals Wiki](https://github.com/redcatbox/Portals/wiki/Overview)**
>
> Portals feature for UE4. Contribute to redcatbox/Portals development by creating an account on GitHub.

This is final version of everything I had done in it with blueprints + partially migrated to C++ as plugin. But only partially.  
If you need to use BP version only, just remove

- Plugins
- Source
- SimplePortals.uproject\_cpp\_bkp

---

<div class="post-metadata">

**Author:** ![soylent\_me](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@soylent\_me](https://forums.unrealengine.com/u/soylent_me)\
**Post date:** [February 7, 2020, 3:31am UTC](https://forums.unrealengine.com/t/simple-portals/91190/18 "2020-02-07T03:31:32Z")

</div>

> [@redbox](#):
>
> Hello.  
> This is basic behavior of portal functions. How vectors converted into portal space and from it.  
> Here is PortalConvertDirection
> 
> …
> 
> and PortalConvertLocation fuctions
> 
> …
> 
> It using TransformDirection, InverseTransformDirection, TransformLocation and InverseTransformLocation functions that includes scale in new transform calculations.  
> There are their analogs in C++ that not using scale.
> 
> Additionally, player character handles teleportation itself.  
> Blueprint’/Game/GameMode/FirstPerson/BP\_FirstPersonCharacter.BP\_FirstPersonCharacter’  
> In function TeleportationAdvanced you can find how it changes self velocity, location, rotation and scale according to portal parameters.  
> Well, it is very basic example of how it should be handled, but I hope you will find it useful.
> 
> [ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp\_182748\_1580712331436\_236”,“title”:“20200203\_0844.jpg”}[/ATTACH]

Redbox - Well I feel pretty stupid, it was staring me in the face the whole time. I’d completely forgot that transforms had scale built in. Thank you for taking the time to explain as well as the recent project update.

---

<div class="post-metadata">

**Author:** ![robinwood3d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robinwood3d](https://forums.unrealengine.com/u/robinwood3d)\
**Post date:** [March 6, 2020, 6:56am UTC](https://forums.unrealengine.com/t/simple-portals/91190/19 "2020-03-06T06:56:49Z")

</div>

Friend, have you tried to turn off the **Motion Blur** and Use the **FXAA** instead of **TemporalAA** ，I tried this and the portal looks more smooth now.

 ![Settings.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/f/1fa32c8e51d38a31447bb1ae60023ee25221273f.png)

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [March 7, 2020, 9:36am UTC](https://forums.unrealengine.com/t/simple-portals/91190/20 "2020-03-07T09:36:31Z")

</div>

Good point, but anyway, portals texture must be filtered additionally. Ideally in the same way as original scene.

---

<div class="post-metadata">

**Author:** ![Helghast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Helghast](https://forums.unrealengine.com/u/Helghast)\
**Post date:** [December 29, 2021, 11:35pm UTC](https://forums.unrealengine.com/t/simple-portals/91190/21 "2021-12-29T23:35:56Z")

</div>

Hello, very good plugin.  
How can I use the BP\_Mirror to function as a Window and as a one-way portal, that is, I don’t need any other Target-portal.  
The BP\_Mirror works well when moving the camera, there is no offset, and the environment is scaled well, but if I turn the mirror StaticMeshComponent (Yaw=180) in the opposite direction to the SceneCaptureComponent2D (Yaw=0), I do not get the same effect.

[https://gyazo.com/bb6e8a1233977ae3db634c5df3615c87](https://gyazo.com/bb6e8a1233977ae3db634c5df3615c87)

[https://gyazo.com/2d01178ad71c116838dda7e2be0abd42](https://gyazo.com/2d01178ad71c116838dda7e2be0abd42)

[Next page](https://forums.unrealengine.com/t/simple-portals/91190.md?page=2)
