Prerequisites
Version 3.0 of the zSpace SDK for Unity runs on Unity version 4.1.3 and later. Depending on the version of Unity, you may need a Unity patch from zSpace. You can download the patch from Downloads in the zSpace Knowledge Base.
Finally, when you launch your zSpace-enabled application, you will need command-line arguments. When and how to use the command-line arguments is discussed in the following section.
See the following table for detailed prerequisites based on the Unity version.
4.1.3 |
Yes |
-force-opengl -enable-stereo |
4.3.0 |
Yes |
-force-opengl -enablestereoscopic3d |
4.5 and above |
No |
-force-opengl -enable-stereoscopic3d |
For all versions of Unity, you will need a zSpace plugin, also available from the Downloads section of the zSpace knowledge base.
You will also need access to a zSpace system to test the stereoscopic 3D settings, head tracking, and stylus implementation.
Importing the Package
First, you will need the ZSCore Unity package. You can import the ZSCore GameObject into your own application with the following steps:
- To enable stereo, open Unity with the appropriate command-line arguments for your version of Unity.
We recommend you create a Unity.bat file with these arguments. You will also need these command-line arguments for your final standalone player.
- Open your Unity scene in the Unity Editor.
- Click Assets > Import Package > Custom Package...
- Browse to ZSCore.unitypackage and select it.
ZSCore.unitypackage contains the following assets:
- Plugins/zSpaceUnity.dll
- zSpace/Core/Editor/ZSCoreDiagnosticWindow.cs
- zSpace/Core/Resources/ZSCore.prefab
- zSpace/Core/Scripts/ZSCore.cs
- zSpace/Core/Scripts/ZSCoreSingleton.cs
- zSpace/Core/Scripts/ZSFinalCamera.cs
- zSpace/Core/Scripts/ZSLeftCamera.cs
- zSpace/Core/Scripts/ZSRightCamera.cs
Click on Import.
- Drag and drop the ZSCore prefab from the zSpace/Core/Resources folder in the Project view into the Hierarchy view to instantiate it.
- Click on the new ZSCore GameObject in the Hierarchy view. It should have a reference to the ZSCore.cs script in the Inspector window.
- Drag your scene's main camera onto the script's "Current Camera" property.
- Note:
- If you skip this step, the "Current Camera" property defaults to Unity's "Camera.main" if it currently exists in the scene.
- Press play.
If ZSCore is working correctly, you will see the scene in stereo 3D with a head-tracked camera.
- Note:
- After you import the ZSCore package, you may encounter errors or visual artifacts due to missing effects scripts. Refer to Using the Left and Right Cameras to correct this.
Adjusting the ZSCore Settings
The ZSCore script contains settings that give you control over stereoscopic 3D quality.
- Enable Stereo
- When checked, your game plays in stereoscopic 3D. Without the polarized glasses, you see two of each object.
- Enable Tracking
- When checked, both head and stylus movements are tracked. Head tracking causes the view to adjust as you move your head when looking at your game on the zStation monitor.
- Enable Mouse Emulation
- When checked, by default, the stylus emulates your game's standard mouse behavior. Use this if your game is built for mouse interactions and you do not intend to add stylus interaction.
- Inter Pupillary Distance
- This represents the physical distance between the viewer's eyes. You can make small changes to improve viewing comfort. However, you should adjust Viewer Scale first.
If you set Inter Pupillary Distance to 0, this places the left and right eye views in the same place, which produces a monoscopic view.
- Viewer Scale
- This is the most useful adjustment you can make to ensure your scene fits comfortably in the zSpace display area. If you have a large model, such as the universe, increase the Viewer Scale. For a smaller model, such as molecules, decrease the Viewer Scale.
- Field of View Scale
- You can make small changes to the Field of View Scale to produce mild zoom and wide angle effects. However, large adjustments will skew the angle of the stylus beam in the scene.
- Head Tracking Scale
- This controls how sensitive your game is to head movement. The stereo camera rig's movements are multiplied by the Head Tracking Scale. For example, a value of 2 causes the stereo camera rig to move 2 cm in response to 1 cm of head movement. A value of 0 causes the stereo camera rig to stay at the virtual head pose, disabling head tracking. Generally, we recommend you leave the value at 1 unless you want to produce an exaggerated effect.
- Glasses Offset
- This is the distance between the bridge of the polarized glasses and the bridge of the nose. The default is 0.01 meters.
Using the Left and Right Cameras
If you have attached scripts to your main camera, attach them to the Left and Right Camera objects under the ZSCore/ZSStereoRig GameObject. When zSpace stereo is enabled, your main camera will be disabled and the Left and Right Cameras will be used instead. All the standard Unity renderer callbacks will be received by those cameras instead of your main camera.
Using the Stylus
Any script in your scene can poll the stylus for its current pose and button state. Simply find the ZSCore GameObject's ZSCore script and use the ZSCore.GetTrackerTargetWorldPose(), ZSCore.GetNumTrackerTargetButtons(), and ZSCore.IsTrackerTargetButtonPressed() functions.
Copyright (C) 2007-2014 zSpace, Inc. All Rights Reserved. zSpace is a registered trademark of zSpace, Inc. Unity is a trademark of Unity Technologies.