- No category
advertisement
50 | Unity Development Guide | Mobile
These controller and touchpad input mappings can be set up in Unity under Project Settings > Input Manager.
The touchpad and the Back Button are mapped as Mouse 0 and Mouse 1, respectively.
Note: An InputManager.asset file with default input settings suitable for use with the Moonlight
OVRInputControl script is included with the Oculus Unity Integration Package.
Configuring for Build
This section describes building your project to PC and mobile targets.
PC Build Target: Microsoft Windows and Mac OS X
This section describes targeting Unity project builds to Microsoft Windows and Mac OS X.
Build Settings
To build the demo as a standalone full screen application, you will need to change a few project settings to maximize the fidelity of the demo.
Click on File > Build Settings... and select one of the following:
• For Windows, set Target Platform to Windows and set Architecture to either x86 or x86 64.
• For Mac, set Target Platform to Mac OS X.
Within the Build Settings pop-up, click Player Settings. Under Resolution and Presentation, set the values to the following:
In the Build Settings pop-up, select Build and Run. If prompted, specify a name and location for the build.
If you are building in the same OS, the demo should start to run in full screen mode as a standalone application.
Quality Settings
You may notice that the graphical fidelity is not as high as the pre-built demo. You will need to change some additional project settings to get a better looking scene.
Mobile | Unity Development Guide | 51
Navigate to Edit > Project Settings > Quality. Set the values in this menu to the following:
Figure 17: Resolution and Presentation options
Figure 18: Quality settings for Oculus demo
52 | Unity Development Guide | Mobile
The most important value to modify is Anti-aliasing. The anti-aliasing must be increased to compensate for the stereo rendering, which reduces the effective horizontal resolution by 50%. An anti-aliasing value of 4X or higher is ideal. However, if necessary, you can adjust to suit your application needs.
Note: A quality setting called Fastest has been added to address a potential performance issue with Unity 4.5 and OS X 10.9. This setting turns off effects and features that may cause the drop in performance.
Now rebuild the project again, and the quality should be at the same level as the pre-built demo.
Mobile Build Target: Android
This section describes targeting Unity project builds to Android.
Configuring Build Settings
From the File menu, select Build Settings…. From the Build Settings… menu, select Android as the platform.
Set Texture Compression to ETC2 (GLES 3.0).
Configuring Player Settings
1. Click the Player Settings… button and select the Android tab. Set Default Orientation to Landscape Left.
Note: The Use 24-bit Depth Buffer option appears to be ignored for Android. A 24-bit window depth buffer always appears to be created.
Mobile | Unity Development Guide | 53
2. As a minor optimization, 16 bit buffers, color and/or depth may be used. Most VR scenes should be built to work with 16 bit depth buffer resolution and 2x MSAA. If your world is mostly pre-lit to compressed textures, there will be little difference between 16 and 32 bit color buffers.
3. Select the Splash Image section. For Mobile Splash image, choose a solid black texture.
Note: Custom Splash Screen support is not available with Unity Free v 4.6. A head-tracked Unity logo screen will be provided for Unity Free in an upcoming release.
4. While still in Player Settings, select Other Settings and make sure both Forward Rendering and
Multithreaded Rendering* are selected as shown below:
Figure 19: Unity Pro 4.5
5. Set the Stripping Level to the maximum level your app allows. It will reduce the size of the installed .apk file.
Note: This feature is not available for Unity Free.
Checking Optimize Mesh Data may improve rendering performance if there are unused components in your mesh data.
54 | Unity Development Guide | Mobile
Configuring Quality Settings
1. Go to the Edit menu and choose Project Settings, then Quality Settings. In the Inspector, set Vsync Count to Don’t Sync. The TimeWarp rendering performed by the Oculus Mobile SDK already synchronizes with the display refresh.
Figure 20: Unity Pro 4.5
Note: Antialiasing should not be enabled for the main framebuffer.
2. Antialiasing should be set to Disabled. You may change the camera render texture antiAliasing by modifying the
Eye Texture Antialiasing parameter on OVRManager. The current default is 2x MSAA. Be mindful of the performance implications. 2x MSAA runs at full speed on chip, but may still increase the number of tiles for mobile GPUs which use variable bin sizes, so there is some performance cost. 4x MSAA runs at half speed, and is generally not fast enough unless the scene is very undemanding.
3. Pixel Light Count is another attribute which may significantly impact rendering performance. A model is rerendered for each pixel light that affects it. For best performance, set Pixel Light Count to zero. In this case, vertex lighting will be used for all models depending on the shader(s) used.
Configuring Time Settings
Note: The following Time Settings advice is for applications which hold a solid 60FPS, updating all game and/or application logic with each frame. The following Time Settings recommendations may be detrimental for apps that don’t hold 60FPS.
Mobile | Unity Development Guide | 55
Go to the Edit -> Project Settings -> Time and change both Fixed Timestep and Maximum Allowed
Timestep to “0.0166666” (i.e., 60 frames per second).
Fixed Timestep is the frame-rate-independent interval at which the physics simulation calculations are performed. In script, it is the interval at which
FixedUpdate() is called. The Maximum Allowed Timestep sets an upper bound on how long physics calculations may run.
Figure 21: Unity Pro 4.5
Android Manifest File
Open the AndroidManifest.xml file located under Assets/Plugins/Android/. You will need to configure your manifest with the necessary VR settings, as shown in the following manifest segment:
<application android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<metadata android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<activity android:screenOrientation="landscape" android:configChanges="screenSize|orientation|keyboardHidden|keyboard">
</activity>
</application>
<activity android:name="com.oculusvr.vrlib.PlatformActivity" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="screenSize|orientation|keyboardHidden|keyboard">
</activity>
<usessdk android:minSdkVersion="19" android:targetSdkVersion="19" />
<usesfeature android:glEsVersion="0x00030000" />
<usespermission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
• The Android theme should be set to the solid black theme for comfort during application transitioning:
Theme.Black.NoTitleBar.Fullscreen
• The vr_only meta data tag should be added for VR mode detection.
• The required screen orientation is landscape: android:screenOrientation="landscape"
• We recommended setting your configChanges as follows: android:configChanges="screenSize| orientation|keyboardHidden|keyboard"
• The minSdkVersion and targetSdkVersion are set to the API level supported by the device. For the current set of devices, the API level is 19.
•
PlatformActivity represents the Universal Menu and is activated when the user long-presses the HMT button. The Universal Menu is implemented in VrLib and simply requires the activity to be included in your manifest.
• CAMERA permission is needed for the pass-through camera in the Universal Menu.
•
Do not add the noHistory attribute to your manifest.
•
READ_EXTERNAL_STORAGE permission is needed for reading the appropriate lens distortion file for the device.
Note that submission requirements will have a few adjustments to these settings. Please refer to the submission guidelines available in our Developer Center:
https://developer.oculus.com
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 3 Contents
- 6 Introduction to Mobile VR Development
- 6 Getting Started
- 6 System and Hardware Requirements
- 7 SDK Contents
- 9 Contact
- 10 0.4 Release Notes
- 14 Device and Environment Setup
- 14 Introduction
- 14 Install the SDK
- 14 Application Signing
- 14 VrPlatform Entitlement Checks
- 15 Device Setup
- 16 Setting up your System to Detect your Android Device
- 16 Windows
- 16 Mac OS
- 16 Linux
- 17 Configuring your Android Device for Debugging
- 17 Note 4 Developer Options
- 18 Display Options
- 18 Android Development Environment Setup
- 18 Android Development Software Setup for Windows
- 18 Java Development Kit (JDK)
- 19 Android Development Tools Bundle
- 19 Installing Additional Packages and Tools
- 22 Verify Eclipse Configuration
- 22 Android Native Development Kit
- 22 Configure Eclipse for NDK Usage
- 23 Apache Ant
- 24 Android Development Software Setup for OS X
- 24 Xcode
- 24 Java Development Kit
- 24 Android Development Tools Bundle
- 26 Installing Additional Packages and Tools
- 27 Android Native Development Kit
- 27 Configure Eclipse for NDK Usage
- 29 Apache Ant
- 31 Android Development Software Setup for Linux (Ubuntu 14.04)
- 31 Java Development Kit
- 31 Android SDK
- 32 Android NDK
- 32 Troubleshooting
- 32 Device Troubleshooting
- 32 View is tilted
- 33 Device not (or no longer) recognized
- 33 Device regularly reconnects
- 34 Running Apps Outside of the Gear VR Headset
- 34 Environment Troubleshooting
- 34 Ant build failure
- 34 Eclipse Problems
- 34 Spaces in Android tool paths.
- 34 Build/clean error due to missing NDK path.
- 35 Unable to launch due to errors
- 35 Compatibility Warnings When Starting Eclipse
- 35 Missing NDK Option in Android Menu
- 35 Java Build Errors
- 37 Unity Development Guide
- 37 Introduction
- 37 Requirements
- 38 Installation
- 38 Preparing for Development: PC SDK
- 39 Preparing for Development: Mobile SDK
- 39 Getting Started
- 39 Importing the Unity Integration
- 40 Importing Sample Applications
- 40 Adding VR to an Existing Unity Project
- 41 A Detailed Look at the Unity Integration
- 41 Contents
- 42 Prefabs
- 43 Unity Components
- 46 Oculus Mobile SDKExamples
- 49 Control Layout
- 50 Configuring for Build
- 50 PC Build Target: Microsoft Windows and Mac OS X
- 50 Build Settings
- 50 Quality Settings
- 52 Mobile Build Target: Android
- 52 Configuring Build Settings
- 52 Configuring Player Settings
- 54 Configuring Quality Settings
- 54 Configuring Time Settings
- 55 Android Manifest File
- 56 Running the Build
- 56 Sample Unity Application Demos
- 56 Running Pre-Built demos: PC
- 57 Running Pre-Built demos: Mobile
- 57 Pre-Built Demo Controls
- 58 Migrating From Earlier Versions
- 60 Known Issues and Troubleshooting
- 61 PC
- 61 Mobile
- 62 Contact Information
- 62 Mobile Unity Performance Best Practices
- 62 Introduction
- 62 General CPU Optimizations
- 63 Rendering Optimization
- 65 Best Practices
- 65 Design Considerations
- 66 Unity Profiling Tools
- 69 Native Development Guide
- 69 Introduction
- 69 Native Samples
- 69 SDK Sample Overview
- 69 Importing Native Samples in Eclipse
- 71 Native Source Code
- 72 Overview
- 72 Virtual Reality API
- 72 Application
- 73 Rendering
- 73 Ray-Tracing
- 73 User Interface
- 74 Utility
- 74 Native User Interface
- 75 Input Handling
- 76 Building New Native Applications
- 76 Template Project
- 77 Integration
- 77 Android Manifest Settings
- 77 Native SoundManager
- 77 Overview
- 78 Implementation details
- 79 Mobile VR Application Development
- 79 Introduction to Mobile VR Design
- 79 Performance Advice for Early Titles
- 80 Frame Rate
- 80 Scenes
- 81 Resolution
- 81 Hardware Details
- 82 Power Management
- 82 Fixed Clock Level API
- 83 Power Management and Performance
- 84 Power State Notification and Mitigation Strategy
- 84 Runtime Threads
- 85 Front Buffer Rendering
- 85 User Interface Guidelines
- 85 In a Word: Stereoscopic!
- 86 The Infinity Problem
- 86 Depth In-Depth
- 87 Gazing Into Virtual Reality
- 87 Universal Menu
- 88 Reserved User Interactions
- 88 Back button/key interactions
- 88 Volume button/key interactions
- 88 Universal Menu
- 89 TimeWarp
- 90 TimeWarp Minimum Vsyncs
- 90 Consequences of not rendering at 60 FPS
- 91 TimeWarp Chromatic Aberration Correction
- 91 TimeWarp Debug Graph
- 93 Media and Assets
- 93 Mobile VR Media Overview
- 93 Introduction
- 93 Panoramic Stills
- 93 Panoramic Videos
- 94 Movies on Screens
- 94 Movie Meta-data
- 95 Oculus 360 Photos and Videos Meta-data
- 96 Media Locations
- 96 Oculus Media Applications
- 96 Native VR Media Applications
- 98 Oculus Cinema Theater Creation
- 98 How to Create and Compile a Movie Theater FBX
- 99 Detailed Instructions
- 104 FBX Converter
- 104 Overview
- 105 Coordinate System
- 105 Materials
- 106 Animations
- 106 Tags
- 107 Command-Line Interface
- 107 Options
- 108 Batch Execution
- 108 Troubleshooting
- 109 Optimization
- 109 Reducing Draw Calls
- 109 Reducing Vertices
- 110 Reducing Overdraw
- 111 Testing and Troubleshooting
- 111 Android Debugging
- 111 Adb
- 111 Using adb
- 112 Connecting adb via WIFI
- 112 Logcat
- 113 Using Logcat to Determine the Cause of a Crash
- 113 Getting a Better Stack Trace
- 114 Application Performance Analysis
- 114 Performance Analysis
- 114 Application Performance
- 114 FPS Report
- 114 SysTrace
- 115 NDK Profiler
- 116 Rendering Performance: Tracer for OpenGL ES
- 120 Revision