itch.io Spring Selects Series A
On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Thanks :)

That may sound weird but I was amazed three times when I played my game:

1. when I tried impossible spaces within my bedroom, the smallest playarea there was, 2x1,5m. It felt good.

2. when I bought tpcast and went wireless. 2x2m but it was enough to feel free with no cable.

3. recently, when I played outside with 8x6m. It felt great. The place was huge and seeing a wide corridor going with a slight turn for 5 meters made me run through it.

As for tutorials, how to achieve that. I have no idea if there are any actual tutorials for impossible spaces but I've seen vidoes by people who did portals in their own engines, Unity and Unreal. The most low-level thing you may want to learn is Stencil Buffer. This is a kind of a buffer that allows you to decide where you draw stuff on the screen and where not. I use it to draw portals (increasing stencil value by one with each nested portal). You may also need to use clip-planes to clip objects that are crossing through a portal (to draw a part of an object on one side and then another part on the other side, through a stencil). There is also another way to do portals, it is with a use of rendering to a separate texture. But it is a much slower approach. I'd recommend to stick to Stencil Buffers. Oh, there is also another way, using clip-planes alone but on most of the hardware there is a limit of active clip-planes and it is quite low (6).

The things start to get tricky with physics, sound, interactions and AI.

Hello! 

Thanks for this great project, it's a great inspiration. I'm trying to achieve something similar, and generally the approach of the stencil portals works really well. I only get in trouble when I want to pass a portal and the stencil geoemetry (it is only a simple quad) is cut by the frustrum/near clip plane of the camera. It generates all the time nasty render artifacts :/

Did you run into the same problem and if so, can you give me a hint how you have solved it?

Thank you very much!

What I do is I prepare a front cap. It is a quad that fills the space that is not covered by a clipped portal.

The way I do that is that I calculate a line that is the result of portal clipping the near plane. This gives me a line in 2D. Then I find a point on that line that is closest to the centre (that will be a point that lies on a line perpendicular to the line we've just found, and it goes through 0,0, this makes it a lot easier, and we use that perpendicular dir anyway when constructing the quad). With that point, I am able to construct a quad. One important thing is that I make it a bit wider to cover any artefacts. Only a very little bit wider. I use a constant (0.0001f). I was experimenting with relying on near plane dist and other stuff and this constant turned out to work the best.

When I render the portal, I first render the portal as usual and then I render front cap (with no depth checks - it's near plane, right? but there are usual stencil checks (equal to current stencil depth, I increase it by one). When closing the portal (after interior is drawn) I render it the same way (one important difference is that test for stencil is provided value has to be less than in the buffer and I replace the stencil buffer content). I used to have decrease there, I used to not extend the cap, I was also experimenting with not using near plane. There were lots of odd things happening, sometimes the whole thing disappearing, sometimes there were just very narrow lines that were not covered (you could see stuff behind the portal).

Thank you very much for the help! I will try it as soon as possible!

You're welcome. If you have any questions or issues, let me know and I'll try to help. And if you'd like to show the thing you're working on, I'd be happy to take a look at it :)

Hi!

Thanks for the offer! 
I tried to implement your way of making the cap, but I'm stuck :/  What I did:

1) Getting the intersection between the portal plane and the camera near plane (this is a 2D line on the near plane)
2) get the nearest point to the center of the near plane (which is orthogonal to the "intersection 2D line“ from step 1)
and then I have no idea how to build a useful capping geometry out of this information.


Are you building the capping quad in front of the near plane directly? As soon as my camera has minimal offset to the portal plane, the intersection from portal plane and near clip plane is not in the frustum anymore :/
I could add some screenshots, but I don't think this would really fit into the forum which should be about "tea for god" :)

Thank you very much in advance!

ps: I am doing a pure research project to understand how it works :)

Hey, send me an e-mail to contact@voidroom.com and I will send you drawings of how to build a cap with some source code (although you may need to rewrite it a bit, to match you needs, axes etc)