Importing the samples
To import the Digital Eyewear samples into a new Unity project:
- Activate Vuforia AR Support and VR Support in XR Settings for your project
- Add Vuforia as the 1st VR SDK for your project - this option is presented once you activate VR Support in XR Settings
- Select Import for the sample in the Unity Asset Store
- Accept all of the sample assets from the Import dialog
To import the samples into an existing Vuforia Unity project:
- Follow the steps in the Vuforia Unity project migration guide, See: How To Migrate a Unity Project
- Follow the steps to import the sample into a Unity project set out above.
Running the samples
Before you build and run on the Android device
- Ensure the latest Android SDK has been installed and that its location has been defined in the Unity Editor ( Unity > External Tools > Android SDK Location ).
- For ODG and HoloLens, ensure that you have configured the drivers for your eyewear device on your computer following the instructions provided by the manufacturer. But this step isn't necessary for phone based stereo viewers like Merge and Cardboard
- Connect the device to your PC/Mac and check that the command adb devices results in a log that shows that it is connected.
Building and Executing the Sample
- Set your platform build target in File > Build Settings. For Android, set the Device Filter to ARMv7 in Other Settings
- Add your scene(s) to Scenes in Build.
- Define a unique Bundle ID in Player Settings > Other Settings.
- Define a unique Product Name to serve as the name of the app when installed on a device.
- Select Build to generate an executable or Build & Run to both generate an executable and deploy it to a connected device.
- You may be asked to specify the location of the installed Android SDK configured your Unity installation for Android already.
There is no need to change any of the default Player Settings to support Vuforia SDK for Digital Eyewear. You can customize the presentation of your app on the device by adding icons and splash images in Player Settings and setting the app s device orientation.
When running the sample on a device you should see a stereo rendering of the AR content with a different image delivered to each eye. The video background will be turned off. The devices will be switched to 3D mode by Vuforia prior to showing any augmentation.
Using the Unity Stereo Rendering Sample
The stereo rendering sample for Unity demonstrates how to configure a Vuforia Unity scene for stereo displays, to support both optical and video see-through digital eyewear apps.
This article highlights the Game Objects and script components that are significant to enabling stereo rendering and describes the configuration options that can be used to customize stereo rendering in a scene.
Target textures as both jpegs and PDFs for printing
||Vuforia plugin libraries for Android and iOS
||The sample scenes
||Scripts that are specific to the sample
||Device databases used in the sample
||The Vuforia Unity extension libraries
||All Vuforia prefabs encapsulating the features of the SDK
||Manages the scene and device cameras along with the main Vuforia application process
||A prefab instance for the Astronaut Image Target
||A prefab instance for the Drone Image Target
||A UI Canvas for presenting error messages
||An object encapsulating error handling behaviors
The sample scene depicts two Image Targets configured for the StonesAndChips database augmented with teapot models.
Fields and Options
|App License Key
||Add a license key when you're ready to customize the sample with your own targets.
|Camera Device Mode
||A hint to indicating whether framerate or render quality should have priority when the app is running
||Defines the target See-Through device type, default is None
Digital Eyewear Video See-Through Selection
|Stereo Camera Config
||Indicates which stereo camera rig to use, support is provided for both Oculus and Cardboard. The default is the native Vuforia camera rig.
||Defines which AR/VR Viewer to use, from a selection of supported viewers including Gear VR, Cardboard, Merge VR and also a Custom, developer defined, viewer type
||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.
Configuring the ARCamera Prefab for Digital Eyewear
Follow these instructions to configure the Digital Eyewear section of the VuforiaConfiguration asset to support either Optical or Video See-Through head-worn eyewear devices. These settings will configure your project for stereo rendering and also enable you to specify whether Vuforia should utilize the functionality for a 3rd party AR/VR SDK. 1. Add an ARCamera instance to your scene.
2. Select which eyewear type you are building for in the Digital Eyewear section
Selecting either Optical or Video See-Through will add a pair of stereo cameras to your ARCamera hierarchy.
After setting the Eyewear Type to Video See-Through, you can specify which Stereo Camera Configuration to use. This setting enables you to bind the Vuforia ARCamera to the camera rig of a 3rd party SDK, such as Oculus or Cardboard. If you aren't utilizing a 3rd party SDK with Vuforia, you can simply use the default Vuforia Stereo Camera Config.
Configuring for Optical See-Through Eyewear
Steps to configure for Optical See-Through Eyewear
Select the See Through Configuration for the eyewear device you are using. If you don't see a configuration specific to your device make and model, select the Vuforia configuration.
Note: if you are using HoloLens, you will need also need to bind the HoloLens camera to the Vuforia ARCamera, See: Developing Vuforia Apps for HoloLens
Configuring for Video See-Through Eyewear
Steps to configure for Video See-Through Eyewear
Now define which Viewer Type you are targeting - again, this only applies to Video See-Through eyewear.
4. Set a camera offset for Play Mode and video see-through eyewear
The camera offset should correspond to the interpupillary distance that you want to simulate in Play Mode and for apps running on devices such as the Gear VR. The interpupillary distance (IPD) is the distance between the centers of the pupils of someone's eyes. Typical IPD values for adults is between 54 and 68mm.
Note: Camera offset has no effect in apps running on optical see-through devices.
Viewport Configuration for Video See-Through Eyewear
The size and offset distance of the stereo viewports for camera see-through devices can be configured using the Camera Offset field in the VuforiaConfiguration asset which is accessible from the ARCamera's Inspector panel via the Open Vuforia Configuration button. You can also search for VuforiaConfiguration in the Project panel.
Camera Offset defines the distance between the stereo viewports in scene units (mm) and can be used to define an interpupillary distance ( IPD ) for the user. Camera Offset is only applicable to video see-through applications, and has no effect on optical see-through devices. The Camera Offset can be adjusted at runtime in Play Mode to evaluate the effect of different settings. The following example uses a camera offset of 42mm and a scale factor of 0.32.