Rajat Kumar Gupta Rajat is an AR/VR content creator with 1.3k subscribers on YouTube. In his spare time, he writes helpful tutorials for the global AR/VR community. His articles have been published in HackerNoon, LogRocket, FreeCodeCamp, and AR/VR Journey Magazine. To know more about him, visit rajatkumargupta.com.

How to make a 360 VR video in Unity

4 min read 1238

Unity Logo

In this article, I will show you how to create a 360 VR video in Unity with the help of two tools:

  1. Unity Recorder
  2. Google Spatial Media Metadata Injector

This technique can be used to create 360 VR videos for any scene inside Unity. For demonstration purposes, I will be using the free Apartment Kit asset available in the Unity Asset Store, and this is what you will get after following the steps in this article.

Play the YouTube video and swipe across the video player to get a 360 view of the apartment.👇

Let’s get started:

Additionally, here’s the full video tutorial:

Project setup

If you haven’t done so already, create a new Unity 3D project and name it “VR 360 Apartment.”

You can do so by launching Unity Hub on your computer and clicking New Project.

New Project Button Highlighted



After clicking on New Project, the below window pops up. To ensure that we are creating a 3D project, do the following steps:

  1. Select 3D from the templates
  2. Update the Project Name from My Project to VR 360 Apartment
  3. Click the Create Project button

3D Create Project Button

The project will take a few minutes to open up in Unity.

Once the project is open, go to the Unity Asset Store and get the Apartment Kit asset. Instead of the Open in Unity button (in the image below), you will see the Add to my Assets button. After clicking the Add to my Assets button, you will also see the Open in Unity button.

Open in Unity

When the Open in Unity button appears, click on it.

This is what you will see👇:


More great articles from LogRocket:


Apartment Kit Dropdown

This window is called the Package Manager. On the left-hand side, you will see all the assets that you have purchased from the Unity Asset Store. On the right-hand side, you get the description of that asset. Convenient, isn’t it?

Click Download. Once the asset gets downloaded, click Import.

Import Apartment Kit

After clicking on Import, simply click on the Install/Upgrade button if you get a warning. After that, you will see this pop-up:

Import Apartment Kit

N.B., many times when you import a third-party asset like the one above, you need not import all the files of that asset in your project. This is why Unity gives you the option of selecting specific files for your project so that you don’t bloat your project with unnecessary things.

For the purpose of this tutorial, ensure that all the files are checked and then hit Import.

After the asset is imported, you will see a new folder called Brick Project Studio under Assets in the Project Panel on the bottom left-hand side. This means that you have successfully downloaded the Apartment Kit asset. 🎉

Project Assets

💡 If the assets panel looks a bit different for you, you can change the view by dragging the little switch left and right (as demonstrated below). The switch is located on the bottom right-hand side.

Bottom Right Slider

Now click on the Scenes folder located under Assets > Brick Project Studio > Apartment Kit. And now double click to open the Scene_01.unity file.

Double Click Scene

This is what you will see in the Scene panel:

Scene Panel

Try zooming in to get a good view of your apartment:

Looking Around Apartment

In the Scene Hierarchy window, expand the Base Scene Game Object.

Select First Person Player. Reposition this game object so that it is inside the apartment. Here is a quick demo:

First Person Player

We position the First Person Player inside the apartment so that the Camera object (child of the First Person Player game object) is also positioned inside the apartment. We will use this Camera in a later step in this article.

Please make sure that this Camera object is tagged as Main Camera. Here is how you can do so from the Inspector Panel:

Main Camera Inspector Panel

Also, uncheck the Mouse Look Script Component for the Camera game object from the Inspector Panel.

Uncheck Mouse Look

Phew! Now the apartment is set up.

All we have to do now is record a 360 VR video of the apartment.

Let’s go.

Record a 360 VR Video of any scene in Unity

Step 1: Go to Window > Package Manager

Window Package Manager

Step 2: Switch to Unity Registry instead of My Assets

Select Unity Registry

Step 3: Install Recorder by Unity Technologies

Select Recorder

Step 4: Go to Window > General > Recorder > Recorder Window

Recorder Window

Step 5: Add Recorder > Movie

Select Movie

Step 6: In the Movie Settings, keep the following settings (annotated in the image below).

  1. Set Source as 360 View
  2. Set Camera as MainCamera
  3. Set Output Dimensions Width = 4096 & Height = 2048
  4. Set Cube Map Size Width = 2048
  5. Deselect Record In Stereo
  6. Include or exclude audio (personal preference. I am excluding it as we don’t have any sound effects in this project)
  7. Set Output File > File Name to “Apartment 360 Video”
  8. Select Output File > Path. The default path will create a folder called Recordings inside the project itself. If you want, you can set it to a custom destination on your computer by clicking the three dots icon on the right-hand side

Recorder Window Fields

Keep this Recorder window open. We will need it in the next two steps.

Step 7: Click the play button in the Unity Editor.

Play Button

Step 8: While in Play Mode, click Start Recording in the Recorder Panel.

Start Recording

Step 9: After 30 seconds (roughly) stop recording. You can record a longer video based on your requirement. Then go to your Project folder > Recordings. You will find a file called “Apartment 360 Video.mp4.”

Apartment 360 Video Folder

Try playing the above video in any video player such as VLC Media Player. It will appear a bit distorted. It is expected behavior. This happens because the video doesn’t include any data about the 360 support capability. To add this 360 support, you have to inject data, or rather “metadata,” using a tool by Google.

Let’s see how to install Google’s Spatial Media tool and then inject 360 metadata into Apartment 360 Video.mp4.

Add 360 capability to a video using Google’s Spatial Media Meta Data Injector tool

Step 1: Download the Spatial Media Meta Data from their official repository. Scroll down a bit till you see this Assets section in their releases page. Get the “360.Video.Metadata.Tool.win.zip” file.

File for Video

Step 2: Extract the zipped folder anywhere on your computer and then run the Spatial Media Metadata Injector.exe file. You will get this pop-up.

Popup Spatial Media

Step 3: Click Open. Select your Apartment 360 Video.mp4 file and then click Open.

Click Open

Step 4: Finally, click on Inject Metadata. This will create a file called Apartment 360 Video_injected.mp4. That’s it.

Inject Metadata

Now, this video can be easily uploaded to YouTube or you can even try playing it on VLC Media Player. You will be able to pan around the 360 video by holding the left click on your mouse and moving around.

Try it out in the YouTube video player:

Conclusion

You can get the final project here.

Feel free to use other assets from the Unity Asset Store and create your own 360 videos in Unity. You can even create your own environments using different assets, arrange them as you wish, and then record a 360 video of it. Isn’t that amazing?🙂

If you’re exploring AR and VR, get my 100+ AR/VR Resources Pack and save thousands of hours on AR/VR research. Or check out some of my other work here.

: Full visibility into your web and mobile apps

LogRocket is a frontend application monitoring solution that lets you replay problems as if they happened in your own browser. Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay the session to quickly understand what went wrong. It works perfectly with any app, regardless of framework, and has plugins to log additional context from Redux, Vuex, and @ngrx/store.

In addition to logging Redux actions and state, LogRocket records console logs, JavaScript errors, stacktraces, network requests/responses with headers + bodies, browser metadata, and custom logs. It also instruments the DOM to record the HTML and CSS on the page, recreating pixel-perfect videos of even the most complex single-page web and mobile apps.

.
Rajat Kumar Gupta Rajat is an AR/VR content creator with 1.3k subscribers on YouTube. In his spare time, he writes helpful tutorials for the global AR/VR community. His articles have been published in HackerNoon, LogRocket, FreeCodeCamp, and AR/VR Journey Magazine. To know more about him, visit rajatkumargupta.com.

Leave a Reply