# How to create portals like in game Portal?

**URL:** <https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662>\
**Category:** Feedback & Requests\
**Tags:** space, portal, engine, unreal-engine, FeatureRequest, feedback, question\
**Created:** [March 24, 2016, 9:06pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662 "2016-03-24T21:06:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [March 24, 2016, 9:06pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/1 "2016-03-24T21:06:47Z")

</div>

Can this feature be released in Unreal Engine?  
But only TRUE portals (worm-holes), not a render target circle from other camera?  
Any ideas for this?

Thanks.

---

<div class="post-metadata">

**Author:** ![Dan72](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dan72](https://forums.unrealengine.com/u/Dan72)\
**Post date:** [May 3, 2016, 2:22am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/2 "2016-05-03T02:22:58Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/2/f026df35e01f345a9cff78833d716a94e185a814.jpeg "Unreal Engine 4 Portal Gun 01 Intro") ](https://www.youtube.com/watch?v=KulKG5zsuxQ)

But I would suggest having render target circle with a trigger box on one side that teleports the player to the other side if they walk “into” the portal.

---

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [May 3, 2016, 6:22am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/3 "2016-05-03T06:22:43Z")

</div>

Thank you for answer.  
It’s not just render target. Render target will be looks like flat “video lcd” on surface. It’s not good.  
In Portal game scene object copied to other portal side… I think… Probably there are no same features in UE4…

---

<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:** [May 11, 2016, 7:29am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/4 "2016-05-11T07:29:07Z")

</div>

did you find a solution for this?

---

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [May 11, 2016, 7:55am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/5 "2016-05-11T07:55:12Z")

</div>

Still no…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_66b7957b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_66b7957b](https://forums.unrealengine.com/u/anonymous_user_66b7957b)\
**Post date:** [December 12, 2016, 12:02am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/6 "2016-12-12T00:02:41Z")

</div>

> **[YouTube](https://www.youtube.com/watch?v=)**
>
> Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

> **[YouTube](https://www.youtube.com/watch?v=)**
>
> Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

---

<div class="post-metadata">

**Author:** ![guachitonico](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guachitonico](https://forums.unrealengine.com/u/guachitonico)\
**Post date:** [October 21, 2018, 11:14am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/7 "2018-10-21T11:14:34Z")

</div>

There are several tricks to achieve that “wormhole effect”, which mainly consist on changing what the render target output is depending on where the player is/is looking. The videos showcase the use of screenalignedUVs on the material, but that still requires some logic so the effect looks good.

What I ended up doing is a simpler approach (albeit not as perfect as portal).  
Your portal is a rendertarget mesh, connected to a SceneCapture2D component which would be the other portal or whatever you want the portal to look like. Then, calculate the angle between the player-portal vector (literally portal.position - player.position) and the normal vector of the portal surface (the forward vector). Do that for every axis (be careful because the angles we’re looking for are not in 3D space but 2D - i.e XY angle, XZ angle, etc).

With that information, rotate the SceneCapture2D component (either the portal or a secondary, invisible capture object), with the angles you’ve already calculated.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_66b7957b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_66b7957b](https://forums.unrealengine.com/u/anonymous_user_66b7957b)\
**Post date:** [October 21, 2018, 11:32am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/8 "2018-10-21T11:32:08Z")

</div>

Hey, thanks for the reply dude. I happened to actually get what I wanted in the end, as you can see here:

---

<div class="post-metadata">

**Author:** ![broly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@broly](https://forums.unrealengine.com/u/broly)\
**Post date:** [November 9, 2018, 12:13pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/9 "2018-11-09T12:13:34Z")

</div>

Sounds good, thanks! But now I want to know how do that with VR. Two cameras? And what about material in VR mode? 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_66b7957b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_66b7957b](https://forums.unrealengine.com/u/anonymous_user_66b7957b)\
**Post date:** [November 9, 2018, 7:05pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/10 "2018-11-09T19:05:17Z")

</div>

Oh man, I’m really not sure. I don’t think the way I set up my portals would work because the fix for the camera frustrum clipping through the portal plane was quite dependant on an average camera set up for the first person, and the teleporting system similarly was set up entirely around an average player pawn. Sorry I can’t be of more help.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_195613a7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_195613a7](https://forums.unrealengine.com/u/anonymous_user_195613a7)\
**Post date:** [February 2, 2019, 11:30am UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/11 "2019-02-02T11:30:15Z")

</div>

Hey for VR its not hugely difficult if your not too scared of C++ their are probably ways in blueprint but i hage no idea how youd go about doing it. What you want to do is modify the scene capture 2d to work for stereo rendering exporting two textures for left and right. Then you just have to set up the portal material as a stereo material by lerping between 0-1 depending on the device being the left or right eye. (Just search stereo material).

Finally as for the camera clipping through the portal plane, use a box with flipped normals instead of a pane and with one of the faces removed. Scale it to 0 along the axis with the open face to turn it into a pane. Now depending on when the vr headset is moving into the portal extend that box until the head is past the teleportation point then teleport when they are deeping inside for a more seemless effect, one teleporting on the same frame set the portal box back to normal.

But theres another problem like hands going through before the head, for this you just create a copy of object and place it their, you could also add some sort of stencil mask to the back of the portal also to prevent objects being seen from the other side while the player is not yet teleported.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Timothy\_LeBlanc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Timothy\_LeBlanc](https://forums.unrealengine.com/u/Timothy_LeBlanc)\
**Post date:** [February 21, 2019, 5:03pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/12 "2019-02-21T17:03:23Z")

</div>

@Afro_viking how did you do this? I want to recreate what you did in your video, but I don’t know how. Do you have a tutorial anywhere?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_66b7957b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_66b7957b](https://forums.unrealengine.com/u/anonymous_user_66b7957b)\
**Post date:** [February 21, 2019, 5:06pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/13 "2019-02-21T17:06:49Z")

</div>

read the video description…

---

<div class="post-metadata">

**Author:** ![Timothy\_LeBlanc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Timothy\_LeBlanc](https://forums.unrealengine.com/u/Timothy_LeBlanc)\
**Post date:** [February 21, 2019, 5:10pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/14 "2019-02-21T17:10:00Z")

</div>

I didn’t have access to the description when I watched it. I’ll go back and read it. Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_66b7957b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_66b7957b](https://forums.unrealengine.com/u/anonymous_user_66b7957b)\
**Post date:** [February 21, 2019, 5:10pm UTC](https://forums.unrealengine.com/t/how-to-create-portals-like-in-game-portal/351662/15 "2019-02-21T17:10:35Z")

</div>

No worries 🙂 Hope you find what you are looking for.  
Edit: Also, there is now a superior portal system on the marketplace, so look to that for better answers possibly.
