informa
3 min read
Featured Blog

Implementing VR Scene Transitions

Scene transitions are difficult in VR because loading new assets on the fly can slash your frame rates. Check out FusedVR's tips on one way to transition between scenes.

A few months ago we made a video on how to properly transition scenes using SteamVR and we figured we might as well do a written version of it, so here it is :)

Traditionally in Unity, whenever you are trying to load a level, there is a very handy API call for SceneManager.LoadLevel(string levelname). Assuming you make sure to add the scenes to your project build settings, you will then transition to the scene that you name.

Build Settings in Unity

For mobile devices and sometimes PCs, during a scene transition, you may suffer a few frame drops as your device will be swapping a lot of things in memory. For such devices, it is generally not a big deal and barely noticeable to the end user. And if needed, for long transitions, you can easily add the infamous loading screen….

You know we all LOVE these….

However, for VR, a few frame drops is NEVER acceptable even for 0.5 seconds. For users who suffer from simulator sickness, a choppy experience is never a good time and will constantly remind your user that they are in a simulated experience, thus reducing presence. In fact, if it is SO bad that a VR headset detects you are dropping frames, it will eject you out of our current app until it starts rendering up to snuff.

An easy way to solve this problem is by fading the current scene to black and then transitioning as FPS drops would be unnoticeable in pitch dark. However, there is a better way for SteamVR developers!

Implementation

As part of SteamVR, there is a C# script called SteamVR_LoadLevel.cs. To test this script, you can add it as a component on any GameObject, enable Auto Trigger, and when you hit play, you will then transition to scene that you specify. In our video (link at the bottom), we talk a bit more about all the properties, so we will defer to it if you want more details.

As you may have guessed, this is a script you can use to load levels without directly incurring an FPS drop. The trick here is that SteamVR will transition you to the Compositor while you are loading the scene in memory and then will transition you back into your new scene when its ready.

This is Real!!

The Compositor is a background process that acts as a “hub” world while you are in VR. You can get notifications from it, transition to different applications, or add drivers to it like ReVive. In computer terms, think of the Compositor as your VR Desktop.

By using the Compositor, you are effectively going to a custom low-power consumption desktop as you load the level and that saves you from suffering any major FPS drops. This is THE RECOMMENDED way to transition between scenes and while it is not obviously stated in the documentation, it will save you a lot of confusion on why you are dropping frames.

Future Improvements

As it is right now, the SteamVR_LoadLevel script is not extremely flexible and a bit confusing to use. Luckily, it is an open source project and anyone can contribute to it. One thing I would love to see is CubeMap support for the Skybox and other customizations like playing a video during a transition. If someone gets to it before I do, I’ll be thrilled!

To Conclude

If you are developing VR, especially, for SteamVR, make sure to use SteamVR_LoadLevel. That’s all. If you want to see how to use it in more detail, check out our short video on the topic!

Happy Building!

Latest Jobs

Treyarch

Playa Vista, California
6.20.22
Audio Engineer

Digital Extremes

London, Ontario, Canada
6.20.22
Communications Director

High Moon Studios

Carlsbad, California
6.20.22
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
6.20.22
Lead UI Programmer
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more