About Portal effect: who did they keep it playable with so many renders of the same scene?

Hi,

In this screenshot extracted from Portal 1, the scene seems rendered multiple times.

Assuming there is no doubled geometry to fake a render somewhere, I would say there is:

  • One render for the player camera.
  • One render for the orange portal on the foreground.
  • One render for the orange portal on the background.
  • One render for the blue portal.
    So: 4 renders to composite this shot.
    In UE4 terms, you would need 1 main camera and 3 scenecapture2D actors with same resolution or a bit lower.

When you use just 1 scenecapture this way, in UE4, framerate drops.
This game is from 2007 and it supposed to be made with a 3D engine from previous generation, so less performant than UE4.
So: if such a scene need 4 renders, how did they keep it playable?
Did they really use a render each time it seems so or did they combine renders and doubled geometry?

And how would you keep it playable in UE4?

Hi,

Unfortunately I cannot answer your question but I have read an article ages ago about this and the devs said that solving this and solving the physics was the hardest part for them, so I can imagine it required some magic from the programmers.

Yes, I guess so.
If a magician read this post, I’d like to have the basic concepts behind his tricks.

As much as I would like to be, I am not a magician either. I did find an page which explains the basics behind rendering the portals, (it’s basically developer comments and a few people expanding on them)

https://www.reddit.com/r/Portal/comments/2z5j7z/how_are_portals_in_portal_actually_coded/

haha I was literally talking about this nice find :smiley:

I did implement portals in UE4 a while ago using the same technique (Stencil Buffer) but did not get recursion going. The interesting part there is

Once I get my portal code back to where it was before I misplaced the code, I will implement the above.

Portal Videos:

@outrospection: thanks, very interesting.
Exactly the kind of informations I was looking for.

@: pretty cool videos!
You think recursion effect could be achieved in UE4?
Reading comments and your answers on your videos, I’m not sure your were using a scencapture actor to do it. Did you?

Hi ,

would be awesome if you could help us with the source code modification.
I really need this for our current project.

ps. I’ve sent you a message on skype yesterday