Ever since student project Narbacular Drop was adopted by Valve and spun into seminal puzzle-platformer Portal in 2007, the idea of mind-bending physics in games has captured the imaginations of players and developers alike; games that have followed it such as Antichamber and recent release Manifold Garden demonstrate that there is still unexplored space in the “brain-tickling physics” genre. The question I’ve always asked myself is: how could I create Portal’s portals from scratch?
Image from Portal 2.
This series will explore several complicated concepts: shaders, physics, maths. Portal isn’t the only game to feature portals, of course - the first article will act as a taster and will feature a portal effect similar to classic Spyro - in those games, portals were, visually, just a glimpse at the skybox of another level. Then, we’ll ramp things up and move onto constructing Portal-style portals piece by piece, starting with non-recursive portals seen in games like Manifold Garden and building up to recursion-based portals, as seen in Portal. I’ll do my best to explain each step in full.
Check out my recreation of the portal effect in URP over on YouTube too!
The posting schedule for this series is as follows:
Part 1: Spyro Skyboxes | Out now! | Spyro-style Portals |
Part 2: Portal Rendering | Out now! | Camera Positioning , Stencil Rendering |
Part 3: Matrix Clipping | Out now! | Oblique Near-Plane Projection |
Part 4: Portal Momentum | Out now! | Physics |
Part 5: Placing Portals | Out now! | Raycasting , Rotations |
Part 6: Portal Recursion | Out now! | Recursion , Screen-space Sampling |
As always, there is a GitHub repository for the series. Feel free to poke around while development is ongoing.
Acknowledgements
Assets
This tutorial series uses the following asset packs from various sources:
“Skybox Volume 2 (Nebula)” | Hedgehog Team |
“Robot Sphere” | Razgrizzz Demon |
“Low Poly Hand Painted Dungeon Arch” | BitGem |
Supporters
Support me on Patreon or buy me a coffee on Ko-fi for PDF versions of each article and to access certain articles early!
Special thanks to my Patreon backers:
- Gemma Louise Ilett
- Jack Dixon
- Christopher Pereira
And a shout-out to my top Ko-fi supporters:
- Hung Hoang