Skip to content

Google Cardboard for augmented reality, a Unity project

Notifications You must be signed in to change notification settings

qian256/cardboard_seethrough

Repository files navigation

Cardboard See-Through

Author: Long Qian

Date: 2016-10-14

Overview

The purpose of this repository is to turn Google Cardboard into an Video See-Through (VST) Augmented Reality device. However, there is usually only one camera for iOS and Android devices. The stereo vision is simulated by applying a fixed disparity to the left half and right half of the screen. iPhone 7 plus does have two cameras, but unfortuantely, they are not aligned vertically. The detailed post can be found on this blog page.

Requirement

Building

  • Unity3D (v5.0+)
  • Android SDK

Running

  • Android Phone (API 19+)
  • Google Cardboard v1: Cardboard v2 is great, but it does not support camera capture.

Implementation

Fragment shader (pixel shader) of Unity3D does almost everything here, including:

  • Apply correct pixel density adjustment to display image with correct scale
  • Barrel distortion is done, so that the image is good for Cardboard lenses.
  • Put disparity to the two halves of the display, so that a FAKE stereo vision is created.

The FOV and disparity level can be adjust through sliders on screen. Frame rate is displayed as well.

The pixel moving job is the last step of rendering. Augmented Reality application can run over this implementation, before the final texture is blited to the screen.

Demonstration

  • The slider on the top right corner controls the field of view, which is correspondent to the size of visible area on the screen
  • The slider on the button right corner controls the percentage of the difference in the image
    • 0.0 for exactly same display
    • 0.1 for 10% difference (0.3 maximum).

capture

capture

Conclusion

  • Shader is your best friend.
  • I am looking forward to stereo vision cameras on Android platforms.

About

Google Cardboard for augmented reality, a Unity project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published