By Alex “Chozabu” PB – with some fantastic contributions from Spencer Crapo
See on marketplace here: https://www.unrealengine.com/marketplace/portals-blueprint
These docs are for 4.23+ – if using an older version, please check the old docs
This portal system is designed to allow you to connect two points in space though there are several important limitations, see “Important Notes” at the bottom of the document.
If this doc does not answer your question, you can ask a question on the marketplace page, contact me on discord: https://discord.gg/xeBWY9N or by email ( chozabu+portalsbp@gmail.com).
Usage:
Adding to Your own project
You must enable “Global Clip Plane” in project settings.
Migrate over the PortalBP actor.
Creating a portal:
Place two “PortalBP” actors in your level, select “PortalBP” and in the details panel
Set the “PortalTarget” to “PortalBP2”
Select “PortalBP2” and set its “PortalTarget” to “PortalBP”
Customising Recursion
If you don’t add a PortalRenderManager to a level – one will be created OnBeginPlay.
To change its settings (recursion limit) you can either edit the BP to change globally, or add an instance to the level to change just for that level.
Setting up your Player Pawn
On your player pawn (if 1st person), you should also implement PortalCameraInterface, and return the players camera location.
For a 3rd person pawn, you may still implement, but return the character, or 1st person camera location.
Usually a portal teleports an object when its center enters a portal. The purpose of PortalCameraInterface is so, with a first person setup, the pawn will teleport when the camera crosses the portal.
Additional Setup:
Ensure your project has “Global Clip Plane” enabled.
Also make sure the portals “Near Clip Plane” distance matches your projects “Near Clip Plane” if non-standard.
Anything that should pass through a portal must generate overlap events.
Portal Quality:
-RenderMipScaledownSpeed – set this value closer to 0 to improve portal quality at a distance, bring it closer to 1 to increase performance at the cost of quality
-UseSimpleRenderMethod – disabled optimisations, should give perfect quality portals
Important Notes:
Though an object appears to be on both sides of a portal when touching one – in terms of physics it is only on one side of the portal. This means you may experience physics weirdness when an object is being pushed through a portal. Again, I have plans to change this in the future, but no promises.
Performance – each portal can do a full re-render of the level – I’ve done some work to optimise here, but keep performance in mind, and check you are not going over your frame-budget.
SpringArm will not function well – there is an example of custom 3rd person camera on EPlayer blueprint. Fuzzy Tom also mentions he has had some success with inbuilt spring arm when camera position lag is disabled.
Changelog
v24 (2021/10/15)
- Support UE4.27
- Apply fix back to 4.23 for easier upgrades
v23
- Support UE4.26
v22
- Fix portal traces
v21 (2020/08/17)
- Bi-Directional physics on objects overlapping portals
- Handle higher velocity objects better
- lots of small tweaks, fixes and some optimisation
v20
- fixed/better seamless travel
- can force lower portals quality for performance
- supports more types of objects (and has beter interface+dispatcher)
- various other fixes (custom instance mats on skelmesh, nudge on passing through a portal, PortalLineTrace)
v19
- Fix for some scaled portals not being seamless
- Fix for recursions failing to render near edge of screen
- Demo content Networked (Including Portal guns, and both character types)
- unlinked portals are now see through
- 4.25 support
v18:
- New “PortalRenderManager class by “Spencer Crapo”
- Supports recursion between non-paired portals
- Customisable recursion limit
- Re-Written Fake recursion focused on camera origin instead of portal center
v17:
- Fix portals in packaged builds
- Allow more postprocessing through a portal (persist render state enabled on scenecaptures)
- Improve procmesh, portals should be seamless at smaller scales
v16:
- Portals can now be placed against a wall
- Additional ProcMesh generated to help ensure seamless transition through portal, no need for reducing clip plane
V15 and older:
- Maintain angular momentum through portals
- Handle characters and physicsbody based pawns
- Interface to get camera position for first person pawns
- Tidy up of main BPs
- Generate smaller render targets in addition to main screen-matched target, render at lower res when possible
- Simple portal gun demo
- Fix wall walking pawn, add wizard hat
- Debugging ui
- Real recursion camera
- Third person camera demo & portal trace function
- ~Many other fixes, tweaks and updates