Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
September 19, 2017
arrowPress Releases






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Implementing VR Scene Transitions

by FusedVR Team on 06/13/17 11:38:00 am   Featured Blogs

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

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!


Related Jobs

DigitalFish, Inc.
DigitalFish, Inc. — San Mateo, California, United States
[09.18.17]

Software Engineer - Mechanical Learning
DigitalFish, Inc.
DigitalFish, Inc. — Mountain View, California, United States
[09.18.17]

Software Engineer - AR/VR
DigitalFish, Inc.
DigitalFish, Inc. — Mountain View, California, United States
[09.18.17]

Senior Software Engineer - Unity/VR
Insomniac Games
Insomniac Games — Burbank, California, United States
[09.15.17]

Mid to Sr Gameplay Programmer





Loading Comments

loader image