Mobile Development Documentation


Add to my manuals
120 Pages

advertisement

Mobile Development Documentation | Manualzz

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

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents