Portal Prototype

Project to study portal mechanics

Summary

This is a prototype/proof of concept made to study and try to replicate the portal mechanics from Portal. A number of iterations were done to figure out the best way to render the view of the portal, along with the portal camera movement. I landed on using a series of matrix multiplications to determine the position of the camera, and, for the render, mapping the uv coordinates of the portal mesh (a quad) in screen space to then crop the portal camera view.

This project taught me a lot about camera spaces, coordinate transformation, shaders, camera manipulation, and Unity's Universal Render Pipeline

Responsibilities

  • Developing shader to clip the camera view to match the quad's UVs
  • Figuring the matrix math logic needed to move the opposite portal camera relative to player's position.
  • Developing the logic to render portals recursively.
  • Developing the portal placement system and a system to fix its position when meeting a wall overhang or intersection.
  • Bug Fixing
  • Optimization

Technologies Used

  • Unity Engine
  • Git
  • Universal Render Pipeline

Source Code

Gallery