Portal 2 Guide

Maps with impossible geometry in Portal 2 for Portal 2

Maps with impossible geometry in Portal 2

Overview

Learn about how world portals / linked_portal_doors work and how to use these things in your maps

Introduction

This guide will explain how seemingly impossible geometry in Portal 2 maps works and how to create maps making use of this trick yourself.
I primarily made this guide because of the many people asking about how my unreal chamber maps work.
So, if you’re interested in the technical aspect of how this works, you’ve come to the right place. If you’re a map maker yourself and want to recreate this effect, I provided an explanation on how to do so below.

What you’ll need

Just a little bit of four-dimensional hyperspace imagination capability 😉
No but for real, if your mind isn’t completely blown by the concept of portals, you’re fine.

If you want to create such a map yourself, I will presuppose a basic knowledge of how to use the hammer editor.
If you don’t know what hammer is (it’s Valves official mapping tool for Source engine games) or never got around to get started with it, check these links.

How it actually works

It’s simple, really. The only thing going on is portals. No, not the blue and orange ones you’re used to but world portals.
World Portals are entities available in the hammer editor. They’re actually called linked_portal_door in hammer but everyone just calls them world portals. There’s a good reason for that actually: These portals are basically identical to the portals you’re used to. The functionality is actually exactly the same. The only difference is that world portals can’t be placed by the player, they don’t have an outline and they’re in a rectangular shape. Yes that’s it.
See the difference for yourself:

An example

In my map the unreal chamber 2 there are actually three seperate rooms
Here’s an overview of the entire thing:


The three arches in the middle of the room just have world portals in them that lead to the other rooms:

Here’s how the rooms are interconnected:


The “unreal effect” here is reinforced by the fact that the rooms are all very similar and have the same size such that it creates the illusion that you’re always in the same room but the testing elements around you change when you walk through the arch.

How to make a map with impossible geometry

Step 1: Place two linked_portal_door entites somewhere in the map.
These two entities will be your two world portals that we are going to connect to each other. You might be asking yourself now why they’re point entities when a portal clearly needs to be a two dimensional surface, but don’t worry. The engine will actually create the portal for you, and this entity just tells it where to put the portal. We’ll now be configuring the size and orientation of the portal in steps 2 and 3.

Step 2: Set the size of your portals.
To do this, change the Width and Height properties of your linked_portal_door entities. Make sure you choose the same values for both portals or else they won’t connect! Also note that you should enter the exact half of the size you want. So if you want a portal that’s 128 units high and 64 units wide, you’re going to want to enter 64 for Height and 32 for Width. The portal will expand 32 units to the left and right and 64 units to the top and bottom, so the linked_portal_door entity is actually the center of the portal.

Step 3: Align the direction your portal is facing.
When you select a linked_portal_door entity in hammer, it will look something like this:

You’ll notice a red, green and a blue line coming out of the entity.
The RED line is the direction your portal is facing. This is the direction you’ll be facing when you’re stepping out of the portal.
The BLUE line is the direction facing up as seen through the portal.
The GREEN line is the direction facing left as seen when coming out of the portal (or facing right if you’re standing in front of the portal, looking at it).
You can rotate your entity with the rotation handles in the 2D views but to align the portals perfectly I’d suggest to use the Transform Menu (Ctrl + M) or setting the roatation angles manually by editing the Pitch Yaw Roll (Y Z X) property of the entity.

Step 4: Connecting the two world portal entites.
This is really simple. Just give both entites a different name. Then, set the Linked Portal property of the first portal to the name of the second portal and vice-versa.

Step 5: Activate the portals
That’s it. You’re done setting up your portals. However, they won’t show up in-game yet. To activate them, you’ll need to either set the Start Active property to Yes on both portals or alternatively fire the Open inputs to both portals to activate them. You can disable active portals by firing the Close inputs on them.

Here are some important things:

  • Depending on the shader detail level in the graphics settings, portals can stop rendering for some players after they’ve moved a certain distance away from them. They’ll just see a white rectangle where the portal should be, which doesn’t look good. So you might not want to use them in big areas if you want to prevent that from happening, or put a notice to players somewhere that they should increase their shader detail level.
  • Due to engine limitations, Source doesn’t allow you to have more than 4 active world portals at any given time. (Well actually you can have more. But the graphics will start to bug out real bad and your console will be spammed with errors so you might not want to do that it’s fun to try tho)
  • Please be aware that world portals cannot be used to create an infinite hallway effect by having two that are facing each other. Depending on your shader settings, after some portal-recursion-madness, the engine will just stop rendering more depth inside the portals and you’ll see a white rectangle where the portal should be. As a rule of thumb, it is generally a good idea to not have world portals that can be seen through other world portals. If you don’t have that, you’re not going to run into this issue anyway.
  • If you want to be able to shine a laser through the world portal or have turrets look and shoot through world portals, you’ll need to add a solid block right behind the world portal or else the laser won’t go through the portal.
  • Sometimes you’ll notice that your world portals won’t appear exactly where you placed them but a little further ahead or behind along the red axis (usually just ~1 unit). This happens especially often if the portal is near a wall or inside a prop model. If the shift in position is consistent across multiple compiles then you can just move it in the other direction in hammer to make up for it. I have no idea what causes that but that’s the way I deal with this issue.

Tl;dr for hammer editor pros:
Just read the linked_portal_door wiki page

How to put this to good use

Of course you can just use world portals to connect two areas in a map that are actually far away from each other. This is especially useful if you’re working on a large project and don’t want to lose the overview over the map so you spatially separate large areas in the editor or if you’re working on a project with multiple people because in this way everyone can just create their part of the map for themselves and then at the end you link them together with world portals without having to worry about the areas not fitting together spatially.
Read about some usages of the entity in Portal 2 here.

Disclaimer: It gets highly subjective now

With world portals, you basically just have access to more portals than usual. Also most of the time people won’t actually know what world portals are or how they work, so that’s something you can work with.
So what I like to do is use them in a way to create the illusion of impossible geometry, for example:

  • Making two hallways that should lead to the same location but don’t
  • Make hallways suddenly change where they’re going
  • Having arches/windows/doors that lead to somewhere else when you look/go through them than when you go around them
  • Flipping gravity by rotating the portals

It’s a little bit of a mindf*ck because it’s something you’re not expecting and you’re not sure how it works even though you’re completely familiar with portals, which can be fun.

Portal outlines

Sometimes, depending on how you place your rooms in your map, this can happen:

Here’s what’s really going on:

You can see the real portal through the world portal but because it is not directly visible to you, the engine thinks you can’t see it and draws the outline for you. This is just confusing.

Luckily, we can disable the portal outlines with the following console command:

portal_draw_ghosting 0

You can put a point_clientcommand and logic_auto entity in your map to run this command at the start of the map.
Name your point_clientcommand whatever you want (I called it ghosting_command in this instance) and then add this output to your logic_auto:

SteamSolo.com