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):
-
Added blueprint function library with basic math functions for portals operations (BP_PortalsFunctions).
-
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.
-
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.
-
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.
-
Added material function MF_PortalPlane, that used as mask, to replace inner portal surface with color or texture. See material “M_PortalReplacement”.
-
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.
