VuforiaのDigital Eyewearの設定を理解する

# 前提

+ Unity 2018.1.6f1
+ Vuforia 7.2.23


# 理解するところ

+ VuforiaConfiguration の Digital Eyewear部分
![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/72a935ae-e9b9-408b-4559-496e055848ff.png)


# 任意設定部

+ ２眼に設定する場合、Device Type、 Viewer Config、Viewer Typeは以下のように
![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/648dfa83-2914-2c80-23f1-8015e2a46f5b.png)

+ 以下は良き感じに
![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/208573fe-7021-b6cb-2b07-0bbf54f5f69c.png)

+ Google Cardboard等のボタン付きHMDにはButton Typeを項目を設定できる
![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/ec6e1dbf-bad1-2ab3-a7fb-30050e04e596.png)


# Screen Lens Distance

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/7aaf80b7-0798-c3bc-0277-d9ab54dd1a30.png)

+ 画面とレンズ（眼ではない）の距離を設定する

> ![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/7516cac0-ea72-11a9-6e82-fe6ee850644a.png)
> https://support.google.com/cardboard/manufacturers/answer/6324808


+ 値が小さいと、画面を中心に小さくなる

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/8cc7ff57-cda9-f2e8-157c-24c6fb51eb55.png)


# Inter Lens Distance

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/92dcee37-d22e-f922-c17c-896dcf9da112.png)

+ 両画面の中央の距離を設定する

> ![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/3566f08a-8934-428f-7492-21d91ddaf89d.png)
> https://support.google.com/cardboard/manufacturers/answer/6324808

+ IPD（瞳孔間距離）ではなくレンズ間の距離を測る

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/3601f90e-ce5c-e18d-3e44-dc1db61e53ee.png)


# Tray Alignment & Lens Center To Tray Distance

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/eb86be6e-3d29-9806-2443-bc535c056b7a.png)


> ![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/114778e7-b107-2d8a-94b5-8c1cc52e31dd.png)
> https://support.google.com/cardboard/manufacturers/answer/6324808


+ Tray Alignmentを起点とした両画面中央の位置を設定する

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/c025d0a9-5614-68b1-89a2-9527049037d9.png)


### TRAY_ALIGN_TOPでも変わらない？

+ Vuforia 7.2.23 で Tray Alignment を TRAY_ALIGN_TOP にしてみたが、 TRAY_ALIGN_BOTTOM と同じような挙動となった
![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/7bd6797d-3dd3-9d3b-985c-e030cb0a2831.png)

+ 本来なら端末の上側からの距離となるはず
> ![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/01371391-7420-e3e5-bfc4-a80eb3984ab9.png)
> https://support.google.com/cardboard/manufacturers/answer/6324808






# Distortion Coefficients

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/cc7d15c5-5359-d544-889e-5ad5619b7f76.png)

+ レンズの歪みを指定する
+ k1, k2（半径方向歪み係数）

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/8a925fa7-face-3952-0847-a810f7285410.png)


# Field Of View

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/696c4ae8-ccf9-831e-e8e7-e017938ecdac.png)

+ 視野（FOV）を指定する
+ Outer, Inner, Top, Bottom の順番で指定する

> ![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/bf59f3bf-c26d-c6e3-b977-c7bf30132732.png)
> https://support.google.com/cardboard/manufacturers/answer/6324808


![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/49a047fc-6fe2-dc15-05fd-fc0ede81b011.png)

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/016f6103-b4d6-4f1b-ebb9-3769c09560b0.png)

# Containts Manget

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/778ab374-3948-346b-691a-0909d6497e8f.png)

+ Cardboardのように磁石ボタンがあるときにチェックを入れるらしいが、特に何かできるAPIが用意されている訳ではない

> however, at this time there is no Vuforia API to detect a magnetic trigger event and/or to register a callback for such type of event.
> https://developer.vuforia.com/forum/digital-eyewear/vuforia-55-and-cardboard-trigger#comment-53011

# Camera Offset

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/b567d629-1c57-a986-c7f9-f8a378baca6f.png)

+ 瞳孔間距離を設定する時に使用できるらしい
    + とあるがIPDはInter Lens Distanceで変更できるし値の変更による違いがよくわからず

> Defines the distance between the stereo viewports. This setting can be used to set IPD and also to adjust eye convergence for scenes with subject matter that is very close.

+ "0.06"を入れている人が多いようだ（独自調べ）
    + 一般成人男性の平均瞳孔間距離？（56mm~64mm）

![image.png](https://qiita-image-store.s3.amazonaws.com/0/178486/f2bba17b-731e-b33c-59d9-14551be6021e.png)



# 参考

+ https://support.google.com/cardboard/manufacturers/answer/6324808
+ https://library.vuforia.com/articles/Solution/Working-with-Digital-Eyewear-in-Unity.html
+ https://www.slideshare.net/izugch4423/vuforiadigital-eyewear

# 終わりに

Vuforia 8が出ちゃいましたね