Jump to content
  • Advertisement
Sign in to follow this  
psycoding

space warp portals like in prey

This topic is 3616 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

I want to implement such portals as they were used in Prey, now my approach would be, for each space warping portal, create a copy of the cell (and its nodes/triangles) where the portal leads to and rotate it so that the portal in this cell angularly maches the portal in the "current" cell, then translate that cell to mach both parts of the portal (current cell + cell that the portal leads to);. if the player crosses the portal, the normal, not rotated geometry of the cell is used and instead, the camera is rotated. now, i think this would work but would be slow because i have to copy some cells, could you think of a faster algorithm for doing space warps ?

Share this post


Link to post
Share on other sites
Advertisement
I can't really answer your question, but seeing as you haven't had any replies you could have a look at Portalized. I believe they are doing some tricks with Render To Texture, but you can try asking on their forums?

Share this post


Link to post
Share on other sites
(nullsquared here, agi_shi was my first nick on here)

In Portalized we just use the stencil buffer.

Take the current camera, and find out where it is in portal A's local space (just cameraTransformationMatrix * inverse(portalATransformationMatrix)). Then multiply this by portal B's transformation matrix, and you've go the camera where it should be as if it traveled through the portal (you'll need to rotate it by 180 degrees, actually, so you look 'out' of the portal, and not into it).

Render the portal itself as geometry into the stencil buffer. This is where the 'portal scene' is. Then just rerender the scene from the new camera position, only where the stenciled portal is.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!