Unity's ODS Test

2018/12/11 Update.

It is for testing panoramic VR images on Unity's ODS (Google's Omni-directional Stereo).
Reference : https://blogs.unity3d.com/jp/2018/01/26/stereo-360-image-and-video-capture/

The scene size is as follows.

This scene will verify the appearance of stereoscopic viewing when changing the camera position.
Click on the thumbnail below, the WebVR screen will be displayed.
Rendering Unity 2018.2.18f1
Resolution 4096 x 4096 pixel
Panorama equirectangular
Top and Bottom
IPD 64mm
Camera Clipping Planes Near : 0.03
Far : 1000

Rendering script

CameraRendering.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
				
[RequireComponent(typeof(Camera))]
public class CameraRendering : MonoBehaviour {
	public RenderTexture cubemap_left;
	public RenderTexture cubemap_right;
	public RenderTexture equirect;
				
	public float stereoSeparation = 0.064f;		// IPD.
				
	private bool m_firstF = true;
				
	// Use this for initialization
	void Start () {
		Camera camera = this.GetComponent<Camera>();
		camera.stereoSeparation = stereoSeparation; // Eye separation (IPD) of 64mm.
	}
					
	// Update is called once per frame
	void Update () {
		if (cubemap_left == null || cubemap_right == null) return;
				
		// RenderTexture (cube) Rendering.
		Camera camera = this.GetComponent<Camera>();
		camera.RenderToCubemap(cubemap_left, 63, Camera.MonoOrStereoscopicEye.Left); 
		camera.RenderToCubemap(cubemap_right, 63, Camera.MonoOrStereoscopicEye.Right); 
				
		// left and right cubemap to Equirecangular.
		if (equirect == null) return;
		cubemap_left.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Left);
		cubemap_right.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Right);		
				
		if (m_firstF) {
			m_firstF = false;
			savePng();		// save png file.
		}
	}
				
	void savePng () {
		if (equirect == null) return;
		Texture2D tex = new Texture2D(equirect.width, equirect.height, TextureFormat.RGB24, false);
		RenderTexture.active = equirect;
		tex.ReadPixels(new Rect(0, 0, equirect.width, equirect.height), 0, 0);
		tex.Apply();

		byte[] bytes = tex.EncodeToPNG();
		Object.Destroy(tex);
				 
		File.WriteAllBytes(Application.dataPath + "/../Unity_SavedScreen.png", bytes);
	}	
}
	

Render with different camera height

2018/12/11 Update.
Camera Y 0.25 m


Camera Y 0.5 m


Camera Y 0.75 m


Camera Y 0.95 m


Even changing the height, the size of the room appears bigger than it actually is,
and the sense of grounding of the sphere is weak.

Render by changing the Z position of the camera

2018/12/11 Update.
Validation when lowering the camera.
Camera Y 0.5 m
Camera Position Z -0.2


Camera Y 0.5 m
Camera Position Z -0.4


Camera Y 0.5 m
Camera Position Z -0.6


When the camera moves away from the subject, the distortion is alleviated,
but the sense of grounding of the sphere does not change.