Weird, Self-Intersecting Portals (WIP)
Portals are simple in concept; enter one portal, come out the other at the corresponding point. A portal is like a "map", mapping each point on one surface to a point on another. But what if a portal mapped to itself...
Entering this portal causes you exit the same portal at a different location. In this example, entering the left side of the portal causes you to exit the right. Its a similar effect to a mirror, but not mirrored.
At first glance, these portals don't seem very exciting. The whole point of a portal is to travel long distances instantly. However, if we utilize self intersection, we can achive extremely interesting results.
For starters, its acutally possible to connect to completely seperate areas with a single sided portal.
Start with two portals, imagine streching one like its a malluable surface.
Take one end, pass it through itself, and connected it to itself on the other side.
With both sides of the portal connected, we've created a single sided portal.
If that explanation didnt make sense, hopefully my beautiful, mouse-drawn drawings will clear things up.
Start with 2 portals
Strech them a tad bit
Pass each side through itself
Connect blue to orange, creating a closed loop!
This portal topology connect two distant areas while only having a single side. Exploring interesting portal topologies is the main focus of this project.
Many of these interesting topologies can be created from knots. Below is a trefoil portal...
The 3 "leaves" of this trefoil all map to each other in a cyclical fashion. Top maps to right maps to left. Entering a leaf
sends you 60 degrees clockwise.
(Note: to create
this cyclical behaviour, the front and back of each portal need to map to different areas, entering through the back
rotates you 60 degrees counter-clockwise)
The center is the intersection of all 3 leaves. Looking through it has you pass through multiple leaves, rotating you 360 degrees and effectivly doing nothing.
If we map each leave correctly, we can knot together multiple trefoils
At first glance there looks to be 4 seperate trefoils. You'd be correct on the first half, there are 4 portals in this example, but they're intertwined in a intricate way. I'll do my best to highlight them...
Each trefoil is actually made up of 3 of the 4 portals. The portals pass through eachother to create 4 trefoils in different locations.
Im building this is with OpenGL and C++. To render the portals, I use stencils. Each portal draws its mesh to a stencil, and the world geometry is redraw from that portals perspective subject to its stencil. Since many of these portals are non-planar, we also have to add an additional minimum depth check, as oblique projection matriceis are not applicable. Additional stencil layers are generated recursivly to reach an arbitrary level recursion.
This project is currently a work in progress. As of writing this, optimization is my main focus. Rendering time scale exponentially with the number of portals and recursion level. Finding ways to efficiently cull portals is therefore extremely important.