# 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.

## 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 on other sites
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 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.

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633374
• Total Posts
3011552
• ### Who's Online (See full list)

There are no registered users currently online

×