graphics3d3d-engine

How can I achieve the effect like the one in "Antichamber" game?


Look at the screenshot of game named "Antichamber":

Antichamber screenshot

You can see a cube frame, through one face you can see some objects located inside the cube, through other face you can see other objects located in the same cube too. The thing confusing me is that you can watch both faces simultaneously and as you see on screenshot the objects from both "faces" are visible. Also, every object seemed to fill entire space inside the cube.

My question is general - how can I achieve the same effect? Maybe there is something with 3d engine that allows it?


Solution

  • This is called "portal rendering". It is conventionally used to do inexpensive drawing of some classes of 3D environment -- but as you note, the contents of a portal need not be related to those of any other portal...

    To achieve the effect, when drawing a portal, the engine sets the graphics rasterizer to clip the rasterization of objects visible through the portal. To achieve it efficiently, the engine does occlusion culling: it only needs to draw those objects that might be visible through the portal.

    To make sure that your portals can be correctly drawn as "larger on the inside than the outside", you should make sure to "clear" the visible region inside each portal before drawing it. If all your portal scenes are guaranteed "watertight", however, you may be able to get away with only clearing the depth buffer.