Importing the samples
To import the Digital Eyewear samples into a new Unity project:
- Either double click on the unitypackage file (*.unitypackage to launch the Import Package dialog or import the same Unity package by selecting it from the Unity Editor menu from Assets > Import Package > Custom Package.
- Click the Import buttons at the bottom right of the Importing Package window.
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
1. Obtain an App License Key and paste it into the field in the inspector for VuforiaBehaviour, See:
How To add a License Key to your Vuforia App
2. 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
3. Ensure that you have configured the drivers for your eyewear device on your computer following the instructions provided by the manufacturer.
4. Connect the device to your PC/Mac and check that the command
results in a log that shows that it is connected.
Building and Executing the Sample
1. Set your platform build target for Android in
File > Build Settings.
2. Add your scene(s) to
Scenes in Build
3. Define a unique Bundle ID in
Player Settings > Other Settings
4. Define a unique Product Name to serve as the name of the app when installed on a device.
5. Select Build to generate an executable or
Build & Run
to both generate an executable and deploy it to a connected device.
6. 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 prefabs and 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 Stones Image Target
||A prefab instance for the Chips 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
||The license key for your app. Video see-through apps should use a Mobile SDK license key. Optical see-through apps should use a Digital Eyewear license key.
|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
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.
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
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.
defines the distance between the stereo viewports in scene units (mm) and can be used to define an interpupillary distance ( IPD ) for the user.
is only applicable to video see-through applications, and has no effect on optical see-through devices. The
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.