• Advertisement
Sign in to follow this  

Valve Portals: How its made?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dizzy_exe
AFAIK, they didn't duplicate objects, the portals actually cut the geometry, which is prety cool, from a physics point of view.


Fair enough, you'll still have two separate objects if you cut one in two :)

Share this post


Link to post
Share on other sites
I would suggest everyone who has access to the actual game Portal, particularly original poster, to play the game in developer's commentary mode. They explain how the physics and rendering of portals works.

I recall hearing something about the stencil buffer and not rendering the entire scene but only what the player could see. Please don't quote me on that but definitely check it out!

EDIT: Blegh, just saw a mention of the commentary in a previous reply...

Share this post


Link to post
Share on other sites
OK, the game has a built-in system of commentaries, once you finish it. Play through and check it out on the second time through. They mention something involving the portal process using multiple rendering techniques (similar to the Garry's Mod Real-Time Camera system) and multiple physics meshing for collision and physics detection. Check out the commentary for yourself; I can't really recall exactly what they said.

EDIT: Man, this is getting quite repetitive, isn't it?

Share this post


Link to post
Share on other sites
Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy...

Share this post


Link to post
Share on other sites
Alright, I m going to play the game in developer's commentary mode... since then I ll look for some kind of post mortem on portals...

thx for your inputs gentlemen!

Share this post


Link to post
Share on other sites
I believe the bit on how portals are rendered in in chamber 6, unless I'm confusing it with the physics explanation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement