• Stars
    star
    251
  • Rank 161,862 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Super small example of using offscreen render targets to achieve a portal effect in Unity

unity-portal-rendering

Overview

Super small example of using off-screen render targets to achieve a portal effect in Unity.

alt text

Info

Please see this accompanying blog post http://tomhulton.blogspot.co.uk/2015/08/portal-rendering-with-offscreen-render.html for an explanation of the techniques involved.

  • UPDATE (2020/07/22,23): Upgraded Unity project, minor desktop camera improvements, fixed minor bug with Teleport.cs, renamed main branch.
  • UPDATE (2019/01/28): Added touch screen camera controls when running on device.
  • UPDATE (2019/01/21): Added teleportation (so moving through a portal will spit you out the other side).

Note: There's an artefact you'll encounter when moving through a portal where the near clip plane of the camera will clip with the portal texture quad. You wouldn't get this if using the portal stencil buffer technique but unfortunately with render buffers there's no clean way around it. The logic can still be applied if you'd like to use it elsewhere.

Controls

Desktop

WASD - Camera forward/backward/strafe
EQ - Camera adjust height
Right Mouse Button + Mouse Move - Look around
C - Cycle between main camera and portal camera views

Device

One Finger, Hold + Move - Look around
One Finger, Double Tap + Hold - Move forward
Two Fingers, Pinch - Move forward/backward
Two Fingers, Pan - Move up/down/left/right (Camera space)
Three Fingers, Tap - Cycle cameras

Extra

I highly recommend checking out this excellent YouTube video on Portals by Sebastian Lague.

It covers quite a few more details that you might need for a full game and also comes with its own GitHub repo.

The video also kindly gives a shout out to the original article posted along with this repo! πŸ˜„

More Repositories

1

cmake-examples

A collection of as simple as possible, modern CMake projects
CMake
1,147
star
2

sdl-bgfx-imgui-starter

A starter project for graphics applications using SDL, bgfx and Dear ImGui
C
299
star
3

cpp-handle-container

An implementation of a weak handle interface to a packed vector in C++
C++
13
star
4

c-handle-container

little test driven handle library in c
C
11
star
5

sokol-experiment

C
8
star
6

as

A header-only linear algebra math library in C++
C++
7
star
7

imgui.cmake

Independently maintained CMake build scripts for Dear ImGui.
CMake
6
star
8

switch-corresponding

Extension for VSCode to switch between interface and implementation file (.h/cpp and .m etc)
TypeScript
5
star
9

pikuma-3d-graphics

Computer graphics programming course
C
4
star
10

clang-tidy-and-clang-format

Document one way of how to setup clang-tidy and clang-format on Windows
C++
4
star
11

sdl-bgfx-imgui-as_1d-nonlinear-transformations

Inspired by "Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations" by Squirrel Eiserloh
C++
3
star
12

opengl-sdl

C++
2
star
13

clang-experiments

Random investigations and experiments using Clang (mostly on Windows)
C++
2
star
14

vulkan-experiments

Test project to learn about Vulkan
C++
2
star
15

cpp-sky-down-example

A simple example using the polymorphic library
C++
1
star
16

cmake-helpers

Reusable, useful CMake utilities
CMake
1
star
17

as-c-math

C
1
star
18

breakout-tdd

C++
1
star
19

cpp-packed-hashtable

Experimental library to combine hash table lookup speed with vector iteration performance
C++
1
star
20

pr0g.github.io

HTML
1
star
21

bit-field-enum-class

A single header to provide bitwise operators for enum class types.
C++
1
star
22

sdl-bgfx-imgui-marching-cubes

Based off of sdl-bgfx-imgui-starter project - random experiments with marching cubes
C++
1
star
23

c-polymorphism

Little experiment to implement polymorphism in C
C
1
star
24

gtest-template

Starting point for a gtest project
CMake
1
star
25

as-camera

A lightweight camera library for simple graphics applications
C++
1
star
26

c-to-cpp-range-compile-times

Comparison of compile times between an C and C++ rangified code
C++
1
star
27

as-camera-input

C++
1
star