来到移动端:开发GearVR外文翻译资料

 2022-07-26 15:15:40

Chapter 4. Going Mobile: Developing for Gear VR

In this chapter, we will learn to develop virtual reality applications for the flagship mobile device on the market today, Samsungrsquo;s Gear VR. The ideas we covered in the previous chapter on desktop VR translate directly into programming for mobile, but there are also unique concerns relating to the Android platform used to develop for the Gear VR. Once again, we will use the Unity3D engine to build our examples. But before we get into the details of coding, letrsquo;s explore this revolutionary new device.

In partnership with Oculus, Samsung has created a mobile VR solution that combines Oculus optics (the barrel distortion lenses) with new head-tracking technology, placed in a custom headset that houses a smartphone with a high- resolution display. Samsung released an “Innovator Edition” of the Gear VR in late 2014 for the Galaxy Note 4 phone, and another in early 2015 for the S6 line. The Gear VR unit costs US$199 and can be purchased through Samsungrsquo;s online store. It only works with those phones, so this is not only a potentially pricey option (the phones can cost from US$600-$800 without a two-year plan), but also a restrictive one — at least for now. Still, the Gear VR is the highest-quality mobile VR on the market and provides a wonderful experience.

The Gear VR Innovator Edition for S6 phones is depicted in Figure 4-1.

The Gear VR features high-resolution graphics, with a display resolution of 2560*1440 pixels (1280*1440 per eye) in both Note 4 and S6 phones. The headset contains a custom IMU based on Oculus technology that tracks much faster and with less latency than the IMU built into the phone.

The Gear VR housing has several intuitive input controls, including an eye adjustment wheel (for matching the devicersquo;s interpupillary distance to your own), and several controls that let you access the phone within: a volume control, a headphone jack, and, most importantly, a trackpad for touch input, known as the touchpad.

Figure 4-1. Samsung Gear VR Innovator Edition for S6 and S6 Edge phones

The Gear VR User Interface and Oculus Home

Beyond the big breakthroughs in ergonomics and resolution, the Gear VR features an innovative user interface for discovering, launching, and installing mobile VR applications called Oculus Home. Oculus Home is an app, but it is also a set of improvements to Samsung5s mobile operating system.

Oculus Home provides a completely immersive interface for browsing VR applications, so that you don5t have to remove the headset to launch a new app. While inside the store interface, you can also see system alerts for new emails, text messages, notifications, and so on. The net result is that you can have an uninterrupted VR experience, moving between applications and staying in there as long as you like, all while not being cut off from the other important goings- on of your phone.

A screenshot of Oculus Home is shown in Figure 4-2, with the Store interface selected, allowing you to browse for new apps to install.

Figure 4-2. Oculus Home for Gear VR

Using the Oculus Mobile SDK

Developing applications for the Gear VR[1]s Android-based operating system requires the Oculus Mobile SDK, which is available on the Oculus developer website.

If you donrsquo;t have an account, sign up; itrsquo;s free. Once you are logged in to the site, do the following:

  1. Select Downloads from the top navigation bar.
  2. Under the SDK Runtime section, click the Details button to the right of Oculus Mobile SDK V0.6.0.1. Agree to the terms of the EULA and click Download.
  3. Unzip the SDK to your hard drive, in a location of your choice. I put mine in the /Applications folder on my MacBook.
  4. While yoursquo;re here, grab the Unity package for Oculus. Under the Engine Integration section, download Oculus Utilities for Unity 5 V0.1.0-beta by clicking the Details button, agreeing to the EULA, and clicking Download.

To develop applications that will work on the Gear VR, you need to use the Android SDK in conjunction with the Oculus Mobile SDK. To set up the Android SDK, go to http://bit.ly/install-android-sdk.

You can install the standalone SDK Tools, or you can get Android Studio. This is your choice. We will be using Android Studio for our Java work in Chapter 6, but you can always set that up later and just go with the standalone SDK Tools for now.

You will also want to learn about the Android debugging tools, because you may need to use them on the command line. There is a good write-up on these tools at http://bit.ly/android-debugging.

Generating an Oculus Signature File

You will need a signature file to run applications on your device. Applications that access the VR functionality of the Oculus Mobile SDK must be built with a unique signature in orde

全文共25188字,剩余内容已隐藏,支付完成后下载完整资料


第四章 来到移动端:开发GearVR

在本章中,我们将学习为当今市场上的旗舰移动设备开发虚拟现实应用程序,三星的Gear VR。 上一章我们在桌面VR上讨论的想法直接转化为手机编程,但也有与用于开发Gear VR的Android平台相关的独特问题。 再次,我们将使用Unity3D引擎来构建我们的例子。 但是在了解编码的细节之前,让我们来探讨一下这个革命性的新设备。

与Oculus合作,三星创建了一款移动VR解决方案,将Oculus光学镜头(镜筒失真镜头)与新的头部跟踪技术相结合,放置在具有高分辨率显示器的智能手机的定制耳机中。 三星在2014年年底发布了Galaxy VR的“Innovator Edition”,用于Galaxy Note 4手机,另外在2015年初推出了S6线。 Gear VR单元的售价为199美元,可以通过三星的在线商店购买。 它只适用于那些手机,所以这不仅是一个潜在的昂贵的选择(手机的成本可以从600美元到800美元没有两年的计划),而且还是一个限制性的 - 至少现在。 不过,Gear VR是市面上最优质的移动VR,并提供了一个很好的体验。

用于S6手机的Gear VR Innovator Edition如图4-1所示。

Gear VR具有高分辨率图形,在Note 4和S6手机中的显示分辨率为2560 * 1440像素(每只眼睛为1280 * 1440)。 耳机包含基于Oculus技术的定制IMU,跟踪比手机内置的IMU更快,延迟更短。

Gear VR外壳具有多种直观的输入控制功能,包括一个眼睛调节轮(用于将设备的瞳孔距离与您自己的距离相匹配),以及几个可让您访问手机的控件:音量控制,耳机插孔,最重要的是 触控板触控板,被称为触摸板。

图4-1。 用于S6和S6 Edge手机的Samsung Gear VR Innovator Edition

Gear VR用户界面和Oculus Home

除了人体工程学和分辨率的巨大突破,Gear VR还具有创新的用户界面,用于发现,启动和安装名为Oculus Home的移动VR应用程序。 Oculus Home是一个应用程序,但它也是对Samsung5s移动操作系统的一套改进。

Oculus Home为浏览VR应用程序提供了一个完全沉浸式的界面,因此您不必删除耳机来启动新的应用程序。 在商店界面中,您还可以看到新的电子邮件,短信,通知等的系统警报。 最终的结果是,您可以拥有不间断的VR体验,在应用程序之间移动,只要您喜欢就可以在其中停留,所有这些都不会与您手机中的其他重要事件相悖。

Oculus Home的屏幕截图如图4-2所示,选择了Store界面,允许您浏览要安装的新应用程序。

图4-2. Oculus Home for Gear VR

使用Oculus Mobile SDK

开发Gear VR的应用程序[在您选择的位置将Oculus工具包解压缩到硬盘驱动器。 再次,我将我解压缩到我的/ Applications文件夹。]基于Android的操作系统需要Oculus开发人员网站上提供的Oculus Mobile SDK。

如果您没有帐号,请注册;免费。登录网站后,请执行以下操作:

1.从顶部导航栏中选择“下载”。

2.在SDK运行时部分,单击Oculus Mobile SDK V0.6.0.1右侧的“详细信息”按钮。 同意EULA的条款,然后点击下载。

3.在您选择的位置将SDK解压缩到硬盘驱动器。 我把我的我的MacBook上的/ Applications文件夹。

当你在这里,抓住Oculus的Unity包。 在“引擎集成”部分下,单击“详细信息”按钮下载Oculus Utilities for Unity 5 V0.1.0-beta,同意“EULA”,然后单击“下载”。

生成Oculus签名文件

您将需要一个签名文件来在您的设备上运行应用程序。访问Oculus Mobile SDK的VR功能的应用程序必须使用唯一的签名来构建,以通过SDK提供的API访问低级设备功能。这不是您将如何在实践中部署应用程序 - 在Oculus Store部署过程中仅需要正确签名的Android软件包文件(APK),但在测试期间部署在开发设备上是必需的。

http://bit.ly/oculus- osig提供了一个在线签名文件生成工具。它包含有关如何获取设备ID并使用它来生成签名文件的详细说明。基本上,您必须在终端(shell)窗口中运行以下命令:

此命令将为您的设备打印唯一的ID。复制该ID并将其输入到签名工具页面顶部的字段中,您将获得一个要下载的文件。一旦你下载了这个文件,就把它放在你计算机上安全的地方,您将需要所有Gear VR开发,无论您决定使用哪种开发工具。

使用Unity3D开发Gear VR

在最后一章中,我们了解到使用Unity3创建桌面Oculus Rift应用程序,Unity3D是Unity Technologies功能强大且经济实惠的游戏引擎。 我们还可以使用Unity3D,使用Oculus Mobile SDK创建Gear VR的应用程序。

我必须要使用UNITY吗?

您可能想知道Unity3D是否是为Gear VR构建的唯一方法。 简短的答案是,“不”。Gear VR开发最终是Android开发。 Unity有几个功能,使Android开发更容易,特别是创建游戏和虚拟现实。 但是,如果您不是Unity开发人员,或者您喜欢使用中间件编写本机Android代码,则可以使用其他选项。 一个这样的选择是GearVRf,由三星创建的一个本机Java框架,最近作为一个开源库发布。

现在您已经下载了Oculus Mobile SDK,设置了Android环境,并创建了一个签名文件,您可以开始使用Oculus Utilities for Unity软件包。 (如果您还没有这样做,请从Oculus开发人员站点下载软件包,如上一节所述。)通过将软件包导入到Unity项目中来执行此操作。 Lefs首先创建一个空的Unity项目。启动Unity3D,或者如果它已经在运行,请选择File ^ New Project。

命名您的新项目UnityGearVRTest。现在项目已经创建,我们将导入SDK并构建一个简单的应用程序。

软件包导入过程的屏幕截图如图4-3所示。要将Oculus Utilities包导入到新项目中,请按照下列步骤操作:

1.查找Unity IDE中“项目”选项卡的“资产”窗格。选择Assets -Import Package - 自定义包。

2.你应该看到一个文件对话框。使用它来导航到下载的Oculus Utilities软件包的位置(在我的MacBook应用程序/ Oculus Uti li ti es_0_1_0_beta /)上。

3.选择文件OculusUtilities.unitypackage。

4.单击“打开”后,Unity将扫描文件并向您显示要导入的包内容的列表。现在,lefs只需将它们全部导入到项目中:确保列表中的所有对象都被选中,然后单击导入按钮。您现在将看到资产窗格中存在的资产,以前没有。特别是,您应该看到名为OVR和插件的文件夹。

图4-3。 将Oculus工具包导入Unity项目

一个简单的Unity3D样本

一旦您将Oculus Utilities软件包导入到项目中,就可以构建您的第一个Gear VR示例。该包附带的示例内容,将包含在您的项目中。只需几个步骤就可以在手机上运行。我们将要构建的演示如图4-4所示,在将其插入Gear VR耳机之前,我的笔记本4手机的截图。

要将Cubes World应用程序的资源添加到新项目中,请在Unity界面的“项目”窗格中选择“资产/ OVR /场景”文件夹。在详细信息窗格中,您将看到一个名为多维数据集的Unity场景的图标;双击该图标。您现在应该在主编辑器视图中看到场景。您可以点击Unity窗口顶部的“播放”按钮,在计算机上进行预览。

现在,要为您的手机构建应用程序,您需要调整一些设置。首先,从主菜单中选择File ^ Build Settings打开Build Settings对话框。

图4-4。 立方体世界:使用Unity3D构建的简单Gear VR应用程序

现在执行以下步骤(确保记住设置后续Unity Gear VR项目的这些步骤):

1.在左侧的平台列表中选择Android,然后单击“切换平台”按钮。

2.将演示场景添加到您的构建。顶部的场景列表将是空的开始;您需要添加当前场景。您应该已经在编辑器视图中查看它了;单击添加当前按钮将其添加到列表中,您将看到一个名为OVR / Scenes / Cubes的检查项目。

3.点击左下角的播放器设置按钮。这将在“检查器”窗格中显示各种设置。选择底部的其他设置子窗格,并选中标有虚拟现实支持的框。这将打开Unity5s内置的VR支持,结合Oculus Utilities软件包的功能,您可以在Unity中运行Gear VR应用程序。

4.在播放器设置中,找到捆绑标识符设置,并更改其值以合理的Android包名称。确保将其从默认值更改,否则Unity将在构建步骤期间投诉。我使用值vr.GearVR。 UnityGearVRTest。

5.在播放器设置中,找到标记为最小API级别的组合框,并将其更改为“Android 4.4”KitKaf(API级别19)“或更高版本。

图4-5。 构建Cubes World Android应用程序的设置

您需要做最后一件事,以便您可以在手机上运行项目。 要运行使用Oculus SDK构建的Gear VR应用程序,您将需要一个签名文件。 如果您已经存在,请按照本章前面的说明进行操作,并为您的设备生成一个签名文件。 一旦你这样做,松开它在一个安全的地方; 您将需要所有Gear VR开发。

每个Unity3D项目需要在构建中已知位置放置的签名文件的副本:特别是Assets / Plugins / Android / assets(请注意最后一个文件夹名称中的小写字母“a”)。 您可以将文件从桌面文件夹拖放到Unity界面的“项目”窗格中的文件夹中,也可以使用操作系统界面复制文件,找到存储Unity项目的文件夹,然后粘贴到该文件夹。 (在我的MacBook上,这是路径lt;用户名gt; / Unity

Projects / UnityGearVRTest / Assets / Plugins / Android / assets。)

关于UNITY和OCULUS MOBILE SDK的注释版本

根据您使用的各种工具的哪些版本,您可能需要更改或少于此处所述的选项。 我在运行OS X的MacBook Mac OS 5.0版本0.6.0.1,Oculus Utilities版本0.1.(OculusUtiUties_0_1_0_beta)上使用了Unity 5(build 5.1.2 ^)。

好! 如果您完成了所有这些,您应该准备好为您的手机构建和运行应用程序。 确保使用USB电缆将计算机连接到设备,并将设备设置为USB调试(如本章前面所述)。 现在,在Build Settings对话框中点击Build And Run。 系统将提示您输入文件名,以保存.apk(Android软件包)文件。

我选择了UnityGearVRTest.apk。 这些名称将会显示在您的应用列表中的电话上。 点击保存以保存.apk。 应用程序现在应该启动,显示

全文共9762字,剩余内容已隐藏,支付完成后下载完整资料


资料编号:[144709],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。