Skip to content
vr-metaPublic
forked from Gistix/portal2vr

About

Play Portal 2 in VR — a 6DoF SteamVR mod (DXVK-based d3d9.dll). One-line PowerShell setup: downloads, installs & launches for you.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Portal 2 VR

Portal 2 icon Portal 2 VR

Hello Portal gamers! Just like you, I wanted to play Portal 2 in VR — but it simply didn't work. So I took Claude, dug into the code, and tried to fix everything… and it looks like now it actually works. Now you can play too — just follow the instructions below.

Quick version of what this is: it's a single d3d9.dll that does two jobs at once. It's a DXVK-based Direct3D 9 → Vulkan layer and the VR mod itself, so the game runs on Vulkan and sends stereo frames straight to SteamVR. You don't have to understand any of that to play — I just think it's neat.

Important

You have to launch the game with -insecure. Portal 2 has no VAC, so it's safe, but without that option the mod just refuses to start (it'll pop up a message telling you so).

Warning

Heads up: the game has flashing lights and fast motion. And yeah — VR + fast motion can make you queasy, so read the comfort tips below before you faceplant into a wall.

See it in action

Portal 2 VR gameplay video

What actually works

Here's the good stuff you can enjoy right now:

  • The whole singleplayer campaign
  • Real 6DoF VR view — lean around, it tracks your head properly
  • Motion controls: the portal gun points where your hand points, and you can grab and turn cubes
  • Workshop maps
  • Turning your way — snap turns or smooth turns, your call (SnapTurning)
  • A movement speed you can dial down so you don't get sick (MovementSpeed)

Stuff that's still rough

I'm not going to pretend it's perfect. Things I know about:

  • No haptics yet — the controllers don't rumble
  • The HUD and pause menu are janky — the overlay path is still half-disabled, so the HUD is drawn at window size while your eyes see headset size
  • Roomscale walking isn't wired up — that code is currently dead
  • It leans on one CPU core more than it should (the scene gets rendered twice, in a row, and mat_queue_mode 0 is required)
  • A comfort vignette for moving around is on my list but not done yet

The one-liner (download, install and play)

Want zero fuss? Open PowerShell and paste this. It finds your Steam install and Portal 2, downloads the latest release, installs it, starts SteamVR, and launches the game — all by itself:

irm https://raw.githubusercontent.com/vr-meta/portal2vr/main/scripts/Play-Portal2VR.ps1 | iex

Put your headset on and go. To just relaunch later without reinstalling, pass -SkipInstall:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/vr-meta/portal2vr/main/scripts/Play-Portal2VR.ps1))) -SkipInstall

Install only (PowerShell)

If you'd rather install now and launch through Steam yourself, every release ships with Install-Portal2VR.ps1. It hunts down Portal 2 in your Steam libraries, grabs the latest release, backs up any existing d3d9.dll, and leaves your VR\config.txt alone. Just run:

powershell -ExecutionPolicy Bypass -File .\Install-Portal2VR.ps1

A few handy variations if you need them:

.\Install-Portal2VR.ps1 -Portal2Dir "D:\SteamLibrary\steamapps\common\Portal 2"   # point it at the game yourself
.\Install-Portal2VR.ps1 -Tag v1.2.0                                               # pin a specific release
.\Install-Portal2VR.ps1 -Uninstall                                                # take it all back off

Then set the launch options below and you're good.

Prefer to do it by hand?

No problem, it's four steps:

  1. Grab Portal2VR.zip from the releases and extract it into your Portal 2 folder (steamapps\common\Portal 2).

  2. Plug in your headset and start SteamVR first.

  3. In Steam, go to Portal 2 → Properties → Launch Options and paste this in:

    -insecure -window -novid +mat_motion_blur_percent_of_screen_max 0 +mat_queue_mode 0 +mat_vsync 0 +mat_antialias 0 +mat_grain_scale_override 0 -width 1280 -height 720
    
  4. Launch, load a chapter, put the headset on. Press down on the left stick to recenter your height, and aim a controller up or down to peek at the HUD.

For the curious, this is everything the package drops into your game — nothing sketchy:

Portal 2/bin/d3d9.dll          <- the mod itself (DXVK based)
Portal 2/bin/openvr_api.dll
Portal 2/VR/config.txt         <- your settings, re-read live while you play
Portal 2/VR/manifest.vrmanifest
Portal 2/VR/SteamVRActionManifest/

Making it feel right (config)

Open Portal 2/VR/config.txt — you can edit it while the game is running and it'll pick up most changes within a second. No restart, no fuss. The knobs you'll actually care about:

Setting Default What it does
MovementSpeed 1.0 How fast the stick moves you. Turn it down (try 0.6) if moving makes you sick.
SnapTurning false true snaps your view in steps, false turns smoothly.
SnapTurnAngle 45.0 How many degrees each snap turn jumps.
TurnSpeed 0.15 How fast smooth turning goes (when snap is off).
VRScale 43.2 Real-world size vs. in-game size.
IPDScale 1.0 Eye distance scale — nudge it if depth feels off.
6DOF true Positional head tracking (leaning, ducking).
ResetOrientationOnLevelLoad true Face the way each new map wants you to.
AimMode 2 0 none, 1 crosshair (buggy), 2 laser sight.

Feeling queasy? Read this

Fast smooth movement is the usual culprit. If your stomach isn't happy, start here and adjust to taste:

MovementSpeed=0.6
SnapTurning=true
SnapTurnAngle=30.0

Trust me — future you (and your lunch) will thank you.

Taking it back off

Run .\Install-Portal2VR.ps1 -Uninstall, or just delete Portal 2/bin/d3d9.dll, Portal 2/bin/openvr_api.dll and the Portal 2/VR folder yourself, then verify the game files in Steam. One warning: don't delete other stuff in bin/ or Portal 2 won't start — and if that already happened, "verify integrity of game files" in Steam brings it back.

When things go sideways

Been there. Here's what usually fixes it:

Game closes the instant it opens, or won't open at all

  • You forgot -insecure. Add the launch options above — the mod even tells you this now instead of vanishing silently like it used to.
  • Your antivirus ate d3d9.dll. Anything that injects into a game gets flagged; check the quarantine and add an exception if you trust the build.

A box says "Failed to get interface … Is this the right game version?"

  • The mod asked the engine for something this build doesn't hand out — usually a version mismatch. Grab a build that matches your Portal 2.

No sound

  • Run UpdateSoundCache.cmd inside steamapps\common\Portal 2\portal2_dlc3.

It runs but never goes into VR

  • Start SteamVR before the game.
  • Turn off SteamVR theater in Steam settings.

Stuttering

  • Steam → Settings → Shader Pre-Caching → let it process Vulkan shaders in the background.

Crashing

  • Set your video options before you load into VR, and don't change them mid-session.
  • Disable add-ons and verify the game files.

Want to build it yourself?

Go for it:

git clone --recurse-submodules https://github.com/vr-meta/portal2vr.git
  1. Open l4d2vr.sln.
  2. Pick x86, Debug or Release.
  3. Build → Build Solution.

The entire DXVK is compiled right into the project, which is why the one d3d9.dll is both the Vulkan layer and the VR mod.

A couple of tips:

  • Set a Portal2Dir environment variable (like D:\SteamLibrary\steamapps\common\Portal 2) and the build will drop the fresh d3d9.dll straight into Portal2Dir\bin for you.
  • On a newer Visual Studio toolset, pass /p:P2VRPlatformToolset=v143 to msbuild.
  • Or just run scripts\Deploy-LocalBuild.ps1 — it builds this checkout and installs it in one go.

Every push gets built by GitHub Actions (.github/workflows/build.yml); the packaged mod is attached to the run as an artifact, and pushing a v* tag turns it into a release.

Standing on the shoulders of…

This wouldn't exist without:

  • l4d2vr — the mod this is based on

And code borrowed from:

Now go make some portals. See you on the other side. 🧡

About

Play Portal 2 in VR — a 6DoF SteamVR mod (DXVK-based d3d9.dll). One-line PowerShell setup: downloads, installs & launches for you.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages