Valve Portals: How its made?

Started by
14 comments, last by niteice 15 years, 8 months ago
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
Advertisement
They render the whole scene again for each portal.
This is your life, and it's ending one minute at a time. - Fight club
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.
Quote:Original post by ToohrVyk
The 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.
Quote:Original post by ToohrVyk
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.


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

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.
Quote:Original post by golgoth13
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.


No cloning—you only exist in one place at a time. However, the topology of the game world is not our usual euclidean topology.
Quote:Original post by ToohrVyk
No 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..

AFAIK, they didn't duplicate objects, the portals actually cut the geometry, which is prety cool, from a physics point of view.
2+2=5, for big values of 2!
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.

This topic is closed to new replies.

Advertisement