It is my project of computer animation course in NCCU!
http://imlab3.cs.nccu.edu.tw/~105257029/
Unity5.6 / Vuforia-unity-6-2-10 / ovr_unity_utilities_1.13.0 / Gear VR HMD
I want to make an AR to VR experience through Vuforia!
Demo for the AR/VR Sample.
https://www.youtube.com/watch?v=rLIVKO3YFos
Integrating Gear VR and the AR/VR Sample in Unity 5.3 and above
https://library.vuforia.com/articles/Solution/Integrating-Gear-VR-and-the-AR-VR-Sample-in-Unity-5-3-and-above.html
Unity VR with Oculus Utilities for Unity 5: Enable Unity's VR and link the OVRCameraRig prefab to the ARCamera and have access to additional Oculus-specific APIs.
- Download the Oculus Utilities for Unity 5
- Create a new Unity project and import the following:
- arvr-x-y-z.unitypackage (In Vuforia Develop -> Samples -> Digital Eyewear -> Dowload for unity!)
- OculusUtilities.unitypackage (ovr_unity_utilities_1.13.0)
- Open the Vuforia-3-AR-VR.unity scene
- Open the Android Player Settings (File > Build Settings... > Player Settings) and enable the following checkbox options:
- Drag an instance of OVRCameraRig to the Hierarchy and position at [0, 2, -1].
- Now configure the CenterEyeAnchor fields:
- Clear Flags = Solid Color
- Background = Black
- Clipping Planes [Near] = 0.05 *
- Clipping Planes [Far] = 300 *
- TargetEye = Left
- Duplicate the CenterEyeAnchor, name it CenterRightEyeAnchor, and set the following:
- TargetEye = Right
We recommend Near = 0.05 and Far = 300 for AR/VR scenes, but you can adjust to suit your 3D scene.
- Add two new Empty GameObjects (VuforiaCenterAnchor & TrackableParent) to the existing OVRCameraRig in the Vuforia-3-AR-VR scene as shown in the partial hierarchical outline below (screenshot shows full rig hierarchy):
- TrackableParent eGO x=0, y=0, z=0
- VuforiaCenterAnchor eGO x=0, y=0, z=0
- eGO = Empty GameObject
- Make all targets (i.e. Trackables) in the scene children of the TrackableParent object. In the AR-VR sample, the Trackable is the ImageTargetStones GameObject.
- Attach the VRIntegrationHelper.cs script to both the CenterEyeAnchor and CenterRightEyeAnchor
- On the CenterEyeAnchor, enable the checkbox Is Left and drag the TrackableParent object onto the Trackable Parent property in the Inspector.
- Select the ARCamera in the Hierarchy
- Vuforia 6.2 in the VuforiaConfiguration asset set the following properties:
- Drag the following GameObjects in the Hierarchy to the respective fields:
- VuforiaCenterAnchor to Central Anchor Point
- CenterEyeAnchor (Oculus) to Left Camera
- CenterRightEyeAnchor (Oculus) to Right Camera
- Click the Add Vuforia Components button that will appear under the Left Camera and also under Right Camera fields in the Inspector.
Place Oculus Signature Files (OSIGs) in the following Unity project location: Assets/Plugins/Android/assets/
Open the VRIntegrationHelper.cs script located in Assets/Vuforia/Scripts/Utilities and replace the code in OnPreRender() with the following:
void OnPreRender()
{
// on pre render is where projection matrix and pixel rect
// are set up correctly (for each camera individually)
// so we use this to acquire this data.
if (IsLeft && !mLeftCameraDataAcquired)
{
if (
!float.IsNaN(mLeftCamera.projectionMatrix[0,0]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[0,1]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[0,2]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[0,3]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[1,0]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[1,1]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[1,2]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[1,3]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[2,0]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[2,1]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[2,2]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[2,3]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[3,0]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[3,1]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[3,2]) &&
!float.IsNaN(mLeftCamera.projectionMatrix[3,3])
)
{
mLeftCameraMatrixOriginal = mLeftCamera.projectionMatrix;
mLeftCameraPixelRect = mLeftCamera.pixelRect;
mLeftCameraDataAcquired = true;
}
}
else if (!mRightCameraDataAcquired)
{
if (
!float.IsNaN(mRightCamera.projectionMatrix[0,0]) &&
!float.IsNaN(mRightCamera.projectionMatrix[0,1]) &&
!float.IsNaN(mRightCamera.projectionMatrix[0,2]) &&
!float.IsNaN(mRightCamera.projectionMatrix[0,3]) &&
!float.IsNaN(mRightCamera.projectionMatrix[1,0]) &&
!float.IsNaN(mRightCamera.projectionMatrix[1,1]) &&
!float.IsNaN(mRightCamera.projectionMatrix[1,2]) &&
!float.IsNaN(mRightCamera.projectionMatrix[1,3]) &&
!float.IsNaN(mRightCamera.projectionMatrix[2,0]) &&
!float.IsNaN(mRightCamera.projectionMatrix[2,1]) &&
!float.IsNaN(mRightCamera.projectionMatrix[2,2]) &&
!float.IsNaN(mRightCamera.projectionMatrix[2,3]) &&
!float.IsNaN(mRightCamera.projectionMatrix[3,0]) &&
!float.IsNaN(mRightCamera.projectionMatrix[3,1]) &&
!float.IsNaN(mRightCamera.projectionMatrix[3,2]) &&
!float.IsNaN(mRightCamera.projectionMatrix[3,3])
)
{
mRightCameraMatrixOriginal = mRightCamera.projectionMatrix;
mRightCameraPixelRect = mRightCamera.pixelRect;
mRightCameraDataAcquired = true;
}
}
}
Unite 2015 - Creating Mixed Reality Apps with Vuforia 5
https://www.youtube.com/watch?v=RdDAjgfj_Yw