# Valve Portals: How its made?

This topic is 3752 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone, I ve just started the Valve Portal game and I found it really interesting. I m curious to know how they do the portals mechanism (in Portal or Prey). Any theories would be nice to hear! thx

##### Share on other sites
They render the whole scene again for each portal.

##### Share on other sites
The game logic techniques behind the portals were already available back in Unreal Tournament (or even Unreal, though I can't remember). For rendering, although this is not necessarily how they would do it in Valve, I suspect this is the correct solution: the elementary rendering principle is that once the two portals exist, you render what is next to the player, then you render the portal opening to the stencil buffer, then you render what's outside the other portal (using the transform that maps one portal on top of the other in additional to the correct world transform) to the pixels where the stencil buffer was set, and add some chrome to the opening so that it looks technological-ish. Of course, if the portals can see each other (or if you can see the two openings at once) you can recurse for the rendering until no more portals are visible or a recursion limit is hit.

##### Share on other sites
Quote:
 Original post by ToohrVykThe game logic techniques behind the portals were already available back in Unreal Tournament (or even Unreal, though I can't remember).

The original Unreal had portal rendering. It even had a few "impossible portals" (ie. position warping ones like in Portal) in it's deathmatch levels.

##### Share on other sites
Quote:
 Original post by ToohrVykFor rendering, although this is not necessarily how they would do it in Valve, I suspect this is the correct solution: the elementary rendering principle is that once the two portals exist, you render what is next to the player, then you render the portal opening to the stencil buffer, then you render what's outside the other portal (using the transform that maps one portal on top of the other in additional to the correct world transform) to the pixels where the stencil buffer was set, and add some chrome to the opening so that it looks technological-ish.

Yes this is pretty much exactly how they do it, at least based on what they mention in the developer commentary.

##### Share on other sites
Quote:
 the elementary rendering principle is that once the two portals exist, you render what is next to the player, then you render the portal opening to the stencil buffer, then you render what's outside the other portal (using the transform that maps one portal on top of the other in additional to the correct world transform) to the pixels where the stencil buffer was set, and add some chrome to the opening so that it looks technological-ish. Of course, if the portals can see each other (or if you can see the two openings at once) you can recurse for the rendering until no more portals are visible or a recursion limit is hit.

It does make sense but it seems to have more to it… at least, we have two technological concepts here, teleportation of an object from one place to another and having a viewing window to one place from another… in my opinion, what’s makes the union of those concepts so amazing is that it feels like going through walls instead of jumping from one place to another… so logically, in our case, we’re in both sides of the portals at some point… so the cloning concept has to be involve.

##### Share on other sites
Quote:
 Original post by golgoth13It does make sense but it seems to have more to it… at least, we have two technological concepts here, teleportation of an object from one place to another and having a viewing window to one place from another… in my opinion, what’s makes the union of those concepts so amazing is that it feels like going through walls instead of jumping from one place to another… so logically, in our case, we’re in both sides of the portals at some point… so the cloning concept has to be involve.

No cloning—you only exist in one place at a time. However, the topology of the game world is not our usual euclidean topology.

##### Share on other sites
Quote:
 Original post by ToohrVykNo cloning—you only exist in one place at a time. However, the topology of the game world is not our usual euclidean topology.

AFAIK this isn't correct, for the companion cubes/etc they needed to duplicate the physics so that when holding the cube in the portal it collides with objects on either side of it..

##### Share on other sites
AFAIK, they didn't duplicate objects, the portals actually cut the geometry, which is prety cool, from a physics point of view.

##### Share on other sites
If you have Portal turn on the Developer Commentary and play through the game. At one point they give a nice explanation about on how the portals work object wise. IIRC they have a physics 'bubble' around the portal which has different rules for objects inside of it.

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633269
• Total Posts
3011153
• ### Who's Online (See full list)

There are no registered users currently online

×