With a virtual reality environment set up (in part 1), it is now possible to establish a pipeline for exporting geometry from a 3d package into a format we can view in VR. Here I will outline that workflow.
Start a New Scene in Unity
- Unity > New Project > GearVR_Project
Configure Build Settings
- File > Build Settings
- Platform > Android
- Texture Compression > ETC2 (GLES 3.0)
- Switch Platform
Set Up Unity Integration
- Download the Oculus Mobile SDK if you haven’t already
- Assets > Import Package > Custom Package….
- Import > Oculus Mobile SDK 0.6.0.1/VrSamples/Unity/UnityIntegration/UnityIntegration.unitypackage
Add The Signature File To The Project
In part 1 of this tutorial, you generated An Oculus signature file. It’s now time to add that to the project. Copy the signature file to the following folder: Assets/Plugins/Android/Assets
The signature file is necessary to sign the apk that the build process produces. The file provides a unique developer signature that will allow you to view the apk on your development device. It does not grant a permanent signature allowing you to share your apk unfortunately. Apps have to be submitted via the Oculus submissions procedure. (further information)
Set Up the Oculus Camera
- Deactivate the Main Camera object in the Inspector
- From the /Assets/OVR/Prefabs folder, drag the OVRCameraRig into the Hierarchy panel
- File > Save Scene As > Template.unity
The scene is all ready for some content.
Maya Export To Unity
- Create some demo geometry in Maya. Ideally an interior enclosed space with a bunch of nooks and crannies, and a single texture. I chose a checker map.
- Export Selection > File Format > FBX (choose the 2015 format if prompted).
- Copy the file and its texture to the Unity project’s assets library.
Create The Scene Assets
- Navigate to the location of the fbx model in the assets library.
- Drag the exported model into the hierarchy.
- Adjust the placement and scale of the model relative to the camera.
- Make sure the texture is assigned to the albedo map of the associated texture.
- Set the enviromental lighting
- Window > Lighting
- Skybox > None
- Ambient Color > Black
- Add some point lights to the space:
- Game Object > Light > Point Light
- Set the color, range, intensity and placement
Build In Unity
- Set Up the Player
- Edit > Project Settings > Player
- Set the company name, product name and default icon to suit.
- Other Settings > Bundle Identifier > set to com.[yourCompanyName].[yourAppName]
- Build and run the project
- File > Build Settings
- Click ‘Add Current’ – Template.unity should pop up in the list.
- Click ‘Build And Run’.
- Save the build file if prompted.
- Point to the Android SDK folder [User]/Library/Android/sdk if prompted.
- At the end of the build, you will be prompted to ‘Insert Device’. You can now view your exported geometry on your GearVR.
With the conclusion of this second part, we now have a complete description of the build chain from Maya to the Samsung GearVR using Unity. Hope you find it useful! Contact me if you have any issues.