How can I achieve an effect like in the game "Anti-Shamba"?

Take a look at the screenshot of the game called "Antichamber":

Antichamber screenshot

You can see the frame of the cube, through one face you can see some objects inside the cube, through another face you can see other objects located in the same cube. What confuses me is that you can watch both faces at the same time, and, as you see in the screenshot, objects from both "faces" are visible. In addition, each object seemed to fill the entire space inside the cube.

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

+4
source share
1 answer

This is called portal rendering . It is usually used for low-cost drawing of some classes of the 3D environment, but as you noticed, the contents of the portal need not be associated with the contents of any other portal ...

To achieve the effect, when drawing a portal, he installs a graphic rasterizer to fix the rasterization of objects visible through the portal. To achieve this efficiently, the engine disables occlusion: it only needs to draw those objects that can be seen through the portal.

To make sure your portals can be correctly drawn as “more on the inside than on the outside,” you must make sure to “clear” the visible area inside each portal before drawing it. However, if all your portal scenes guarantee "water resistance", you can only leave by clearing the depth buffer.

+3
source

All Articles