Download

Seamless Portals

Hello !

I wrote a new tutorial, this time about creating seamless portals. :slight_smile:
I cover how I did it as well as some issues I encountered and how I managed to fix them. You can read the article over here : https://www.froyok.fr/blog/2019-03-c…nreal-engine-4

Here is a little demo of the final result :

Let me know what you think or if you have questions !

The clarity of the blog post is impressive. I recognized your user name, but couldn’t remember from where. After reading this article, I realized I also read the “True First Person Camera” one a while ago. Easily one of the most professionally written blogs I came across.

Bookmarked.

Awesome! Thanks!

Thank you very much, I really appreciate your comment. :o

Good tutorial!

I’ve used custom PlayerCameraManager for my portals system, to calculate camera updates with overriding UpdateCamera() in it.
It was useful because you can set bGameCameraCutThisFrame right there to handle culling issues, without creating custom LocalPlayer class.

Hooo ! That’s good to know !
I guess I went too deep too soon when I started looking into the culling issue. :slight_smile:

Bookmarked, very well done!

Juste had a very quick look at your Tuto.
Very nice work and well explained.

Thank you very much !

Hi!

Very nice Tutorial, thank you very much for it… I’m a beginner in UE4, so I’ve some question and I hope you can help me out:

  • You used a C++ PlayerCharacter/PlayerController. Can I also implement your system with a Blueprint PlayerCharacter?
  • How exactly did you set up the mesh? I tried it, but only the centered “point” offsets, not like yours…

I’m looking forward to hearing from you!
Best regards

Sorry for the late reply.
It’s likely possible with a blueprint Character, you will just have to be sure everything ticks in the right order. For the mesh, do you mean the portal mesh ? You have to make sure the vertices of the mesh are in the right position in the UVs, otherwise the masking (and therefor the offset) won’t work properly.

Hey Froyok. Tried accessing your tutorial for the portals but the link is broken. Getting site can’t be reached errors :confused:

Everything seems to works fine on my end and my website host is not known to have downtime or traffic limitations. I would suggest to try again.

Okay thank you! But I’m not sure how to cast to a blueprint Character within a C++ Class, maybe you can give me an example or an code snippet? With the mesh I will check it out, thank you very much for your great tutorial and your help! :slight_smile:

You don’t need to, just access the Character that is spawned by your Gamemode. You just need to be sure your Blueprint class is based on the C++ class that defined the few function necessary for the Portals. (C++ can’t call Blueprint functions that it doesn’t know, as far I know.)

Great tutorial. Thank you.

Thanks Froyok for sharing this amazing work!
Can you share a small example project?

Merci pour ce tuto! Un bel exemple de partage constructif!:slight_smile:
Est il possible de que tu partage un petit projet modèle sur ton site, ce qui permettra de mieux appréhender le tutoriel pour ceux qui ne maitrise pas encore bien le code mais seulement les blueprints?

I won’t share any files, only the written tutorial. The main reason is because it’s too much mixed with my own project, it would take quit ea bit of time to create a clean and simple sample project.

Is it possible, that you share the Portal Mesh with us? We can’t create it, that it looks like you provided. When I test it with the Material, it looks very confusing (see attachements).
I don’t know, what we are doing wrong… I can’t find the “SplitComponent V2” so I used “Mask Component” with Channel set to ‘G’.

It’s doesn’t work because the UVs are incorrect. I added to the article the following image which hopefully will clarify how the mesh works :

https://www.froyok.fr/blog/wp-content/uploads/2019/03/portal_uvs.gif

There was as well an error in the way I described the the mesh UVs in the article, so I fixed that as well (I inverted what was at the top or the bottom for the UVs).

SplitComponent is a custom node that I made, it works the same as the Component Mask node indeed. I added a mention about it in the article.

@Froyok Interesting stuff! And fantastic write up, I generally prefer a well-written doc to a video.

I have a fairly simple but solid portal system on the marketplace - pure BP, but looks like it works on a fairly similar set of principiles to your tutorial, with a few pros and cons.

Your jump-cut soultion to the incorrect frame after exiting a portal is fantastic - my solution is indeed to disable occlusion culling. As you mention, there does not seem to be a command for it, but there is an option in the project settings, which requires restarting the editor. This, along with enabling the global clip plain, is the reason I distrib as a project instead of asset set.

Also interesting to notice bGameCameraCutThisFrame in the player camera manager is BP readonly, but the bCameraCutThisFrame in capture2d is BP R/W…

It’s also good to see the extra attention you are taking to minimise the performance impact on scenecapture, and using the players projection matrix (where I only grab the players FOV)

Also interesting to see your setup with the portal mesh and offset shader, I have an “inverted box” with “internal fins”

On the upside of my setup, it is fairly generalised, and will create a “visual clone” at the other end of the portal for an actor containing static/skel meshs

I hope I am wrong, but think we are both not quite far from VR portals without 1-frame lag - have a look at the rendering section of the engine, the HMD motion is done as late as possible, it seems planar reflections are a “special case” in being performed after HMD motion, and some engine modification is needed to get around this…

Right now I’m starting to look more seriously into a setup more along the lines of portal/portal2, using stencil buffer to lower both processing and ram requirements - which would also make recursive rendering more practical.

I have some ideas on how to do a decent physics setup, allowing portals to be placed against a wall, and for the “visual clones” at the other end of a portal to have functional physics interactions, but really need to do more research in this area. With luck, it could end up as a more general system than in the portal games - but I don’t expect so.

edit: I just submitted PR to allow setting cameracut in BP https://github.com/EpicGames/UnrealEngine/pull/5823 :slight_smile: