Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Record 360° video in unity is not equirectangular

I have a timeline project in Unity 2018.2.10f1. I use the Unity Recorder to export 360° video. This is the settings:

enter image description here

But the output is not equirectangular and cannot be played as 360° video:

enter image description here

What is wrong and how to fix it? Thank you

2:1 video

enter image description here

Free camera settings

enter image description here enter image description here

like image 519
Leos Literak Avatar asked Oct 15 '22 08:10

Leos Literak


1 Answers

Edit3:
Apparantly the issue is caused by the Physical camera setting on the camera component. Turning off Physical Camera will export equirectangular images/movies as expected.

The information below is still relevant, but not the exact solution to this particulair problem.


Your settings do not export an equirectangular image right now but a square image. Equirectangular images require to have an aspect ratio of 2:1. Whereas your current aspect ratio is 1:1.

In the Unity recorder settings you have set "360 view output" to 2048x2048. Resulting in the square image you're seeing. Try setting this to 4096x2048. This will produce a 4k image with an aspect ratio of 2:1, which should work for equirectangular projection.

See this page for more information about how equirectangular projection works. (emphasis mine)

Scanning cameras sometimes cover more than one 360° turn but software often assumes that equirectangular images cover 360° horizontally and 180° vertically, i.e. make sure that your equirectangular image has a proper aspect ratio of 2:1.


Edit:
Looking at the 2:1 picture it seems that Unity your records a cubemap, and not an equirectangular image. You may need to convert the cubemap to equirectangular using RenderTexture.ConvertToEquirect from the docs:

if (renderStereo)
{
    cubemap.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Left);
    cubemap2.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Right);
}

Take a look at this Unity bog which goes into further detail on how unity uses cubemaps/equirectangular projection From the blog:

After stereo cubemaps are generated, we can convert these cubemaps to stereo equirectangular maps which is a projection format used by 360 video players [...] To convert cubemaps to stereo equirectangular maps, call RenderTexture.ConvertToEquirect()

The "Cube map" width parameter on the Recorder may need to be tweaked for the desired result. But not sure which value would work best.

Edit2:
I created a test project (on GitHub here). However I have do not get the same output as you, despite (seemingly) having the same settings. My output looks like a perfectly fine equirectangular image (Without needing to do any conversion as I thought may be required as explained in my first edit).

My settings: Settings of the Unity Recorder

The output: 360 equirectangular output image

like image 141
Remy Avatar answered Oct 21 '22 07:10

Remy