0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Metaioのカメラ映像をCardboard用にステレオにする

Posted at

Unity MetaioSDKにはHMD用に、対象をstereoにしてくれるオプションがあるけど、
カメラ映像はstereoにしてくれないのがすげー気持ち悪かったので、お手軽にstereoにしてみた。

カメラ映像を写してるCameraは(ややこしい)
metaioSDKの中にあるDeviceCameraがCameraPlaneを見てるようなので
こいつをステレオにすれば、Cardboardで見てもステレオになるはず。

スクリーンショット 2015-02-13 15.55.28.png

DeviceCameraを左目用にして、右目カメラを追加。
名前をDeviceCameraLeftとDeviceCameraRightにしてみた。名前はなんでもいいです。

スクリーンショット 2015-02-13 15.59.16.png

左目用のCameraのViewport Rectをこう
スクリーンショット 2015-02-13 16.01.24.png

右目のViewport Rectをこうする
スクリーンショット 2015-02-13 16.01.51.png

DeviceCameraにアタッチされてるmetaioDeviceCameraがサイズ調整をやってるみたいなので
ちょっと改造。153行目くらい。

// update orthographic size
Camera cam = GetComponent(typeof(Camera)) as Camera;
cam.orthographicSize = getOrthographicSize(screenOrientation);

一個だけ処理してる部分を二個にするだけ。

// update orthographic size
Camera cam = GetComponent(typeof(Camera)) as Camera;
cam.orthographicSize = getOrthographicSize(screenOrientation);
Camera cam2 = transform.parent.Find("DeviceCameraRight").GetComponent(typeof(Camera)) as Camera;
cam2.orthographicSize = getOrthographicSize (screenOrientation);

あとはCameraPlaneの位置をちょっと調整した方がいいかもしんないです。
その辺は場合によってという感じ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?