Unreal 开发概述Unreal Development Overview

Unreal 横幅徽标

开始使用混合现实应用程序是一个重大任务。Getting started with mixed reality applications is a big task. 新概念、平台和前沿硬件看似都障碍重重。New concepts, platforms, and cutting edge hardware can seem like barriers. 但是,如果你是 Unreal 的开发人员,那么你很幸运。However, if you're an Unreal developer you're in luck. Unreal Engine 4 具有对 Windows Mixed Reality (VR) 和 HoloLens 2 (AR) 设备的完全支持。Unreal Engine 4 has full support for Windows Mixed Reality (VR) and HoloLens 2 (AR) devices.

最新的 Unreal Engine 4.26 版本包括:The latest Unreal Engine 4.26 release includes:

  • 支持新的跨设备 XR APISupport for new cross-device XR APIs
  • OpenXR 支持 + Microsoft OpenXR 插件OpenXR support + Microsoft OpenXR plugin
  • 用于高质量视频播放的 HoloLens Media Player 插件HoloLens Media Player plugin for performant video playback
  • 适用于 iOS 和 Android 的 Azure 空间定位点(beta 版)Azure Spatial Anchors for iOS and Android (beta)
  • 远程处理时支持反向连接,从而允许从 Azure 流式传输到 HoloLens 2Support for reverse connections when remoting, enabling streaming from Azure to HoloLens 2
  • HoloLens 2 系统键盘访问HoloLens 2 system keyboard access
  • 适用于打包应用的 Windows 应用认证工具包合规性Windows App Certification Kit compliance for packaged apps
  • 针对 HoloLens 2 的 Unreal Insights 支持Unreal Insights support for HoloLens 2
  • HP Reverb G2 手柄支持HP Reverb G2 controller support

请参阅 Unreal Engine 4.26 发行说明,了解详细信息。See the Unreal Engine 4.26 release notes for more.

如果你不熟悉 Unreal 开发,请勿直接跳转。If you're new to Unreal development, don't jump in blind. 浏览 Unreal 教程系列,并在 Unreal 市场中查看资产。Explore the Unreal tutorial series and look for assets in the Unreal marketplace. 还可以在混合现实论坛中找到支持。You can also find support in the mixed reality forums. 这些资源是指向当今的混合现实市场中的构建者和问题解决者的社区的链接。These resources are your links to the community of builders and problem solvers in today's mixed reality market.

重要

如果你有一个现成的 Unreal 项目想要引入到沉浸式头戴显示设备(例如 Reverb G2)中,请查看我们的移植指南Take a look at our porting guide if you have an existing Unreal project that you want to bring over to immersive headsets such as the Reverb G2.

开发检查点Development checkpoints

使用以下检查点,将 Unreal 游戏和应用程序带入混合现实的世界。Use the following checkpoints to bring your Unreal games and applications into the world of mixed reality. 如果你尚未浏览设计全息影像示例应用程序,建议下载它来熟悉混合现实 UX 的基本知识。If you haven't explored the Designing Holograms sample application, we recommend downloading it to familiarize yourself with the basics of Mixed Reality UX.

1.入门1. Getting started

首先,需要安装用于 HoloLens 2 开发的工具。First, you'll need to install the tools for HoloLens 2 development. 接下来,阅读我们的教程系列,基本了解混合现实工具包、为混合现实应用正确配置的开发环境以及在 Unreal 中运行的 MRTK 项目。Next, go through our tutorial series to get a basic understanding of the Mixed Reality Toolkit, a properly configured development environment for mixed reality apps, and a working MRTK project in Unreal. 从 Unreal 4.26 开始,还可以选择为 HoloLens 2 开发 OpenXR 应用。As of Unreal 4.26, you also have the option of developing an OpenXR app for HoloLens 2.

CheckpointCheckpoint 业务成效Outcome
安装最新工具Install the latest tools 下载并安装最新版 Unreal Engine,并为你的项目设置混合现实Download and install the latest version of Unreal Engine and setup your project for mixed reality
创建第一个 HoloLens Unreal 应用程序Creating your first HoloLens Unreal application 通过构建一个基本的混合现实应用程序,开始 Unreal 和 HoloLens 开发旅程Start off your Unreal and HoloLens development journey by building a basic Mixed Reality application
HoloLens 2 教程系列HoloLens 2 tutorial series 在 Unreal 中设置混合现实开发,使用 MRTK 构建首款应用,然后将该应用部署到 HoloLens 2Get set up for mixed reality development in Unreal, build your first app with MRTK, and deploy your app to HoloLens 2
(可选)在 Unreal 中开始使用 OpenXR(Optional) Get started with OpenXR in Unreal 如果要在 Unreal 中构建 OpenXR 应用,则应禁用以下引擎插件:If you're looking to build an OpenXR app in Unreal, you should disable the following engine plugin:
  • Windows Mixed RealityWindows Mixed Reality

从 GitHub 下载以下插件并在项目中启用它们:Download and enable the following plugin in your project from GitHub:
下面是 OpenXR 当前支持的功能的完整列表。The full list of currently supported features in OpenXR is below.

2.核心构建基块2. Core building blocks

许多主要混合现实功能在教程系列中未涉及。There are a number of key mixed reality features that our tutorial series doesn't cover. 这些构建基块可以作为独立功能提供,也可以通过混合现实工具包提供。These building blocks are available as standalone features and through the Mixed Reality Toolkit. 你可能不需要一次全部使用它们,但建议你尽早进行使用。You might not need all of them at once, but we recommend exploring early on. 深入了解下面列出的核心构建基块后,你将拥有一个工具箱,其中包含了各种你可以集成到混合现实项目中的功能。After diving into the core building blocks listed below, you'll have a toolbox full of features you can integrate into your Mixed Reality projects.

适用于 Unreal 的混合现实工具包是一组设计用于在 Unreal 中加快开发速度的插件。The Mixed Reality Toolkit for Unreal is a set of plugins designed to speed up your development in Unreal. 每个插件都包含用于设置沉浸式体验的组件、示例和文档。Each plugin includes components, samples, and documentation for setting up immersive experiences.

  • 适用于 Unreal 的 UX Tools 是第一个要发布的插件,目前仅在 HoloLens 2 上受支持。UX Tools for Unreal is the first plugin to be released and is currently only supported on HoloLens 2. 此插件包括 C++ 代码、蓝图,以及用于输入模拟、手部交互、表面磁性等的常见 UX 功能的示例资产。The plugin includes C++ code, Blueprints, and example assets of common UX features for input simulation, hand interactions, surface magnetism and more.

  • 适用于 Unreal 的 Graphics Tools 是 UE 游戏插件,其中创建了代码、蓝图和示例资产,有助于优化混合现实应用程序的视觉保真,同时不超出性能预算。Graphics Tools for Unreal is a UE game plugin with code, blueprints and example assets created to help improve the visual fidelity of Mixed Reality applications while staying within performance budgets.

功能Feature 功能Capabilities
输入模拟Input simulation 在编辑器中使用鼠标和键盘输入来模拟头盔式显示器 (HMD) 和手部跟踪功能Use mouse and keyboard input in the editor to simulate a Head-Mounted Display (HMD) and hand tracking features
手动交互Hand interaction 使用铰接式手部输入与 UX 组件进行交互Interact with UX components using articulated hand inputs
可按按钮Pressable button 通过低级别组件驱动按钮蓝图的状态Drive the state of button blueprints through low level components
操控器Manipulator 使用单手或双手操作输入移动和旋转 ActorMove and rotate an actor with one or two-hand manipulation input
跟踪行为Follow behavior 保持 Actor 或组件在另一个组件的视线范围内Keep an actor or component within sight of another component

备注

有关更多详细信息,可以深入了解适用于 Unreal 的 UX Tools GitHub 存储库。You can dive into the UX Tools for Unreal GitHub repository for more details.

3.高级功能3. Advanced features

在混合现实应用程序中起作用的其他关键功能可用,无需任何额外的包或设置。Other key features that play a role in mixed reality applications are available without any extra packages or setup. 可以在安装或未安装 MRTK 的情况下将这些功能添加到 Unreal 项目中。These features can be added to Unreal projects with or without MRTK installed. 深入了解这些更高级功能后,你将可以生成更复杂的混合现实应用。After diving into these more advanced capabilities, you'll be able to build more complex Mixed Reality apps.

功能Feature 功能Capabilities
HoloLens 摄像头HoloLens camera 从在 HoloLens 设备上运行的应用捕获混合现实视觉内容和真实世界视觉内容Capture Mixed Reality and real-world visual content from your app running on a HoloLens device
QR 码QR codes 使用坐标系统在每个 QR 码的真实世界位置将 QR 码呈现为全息影像Render QR codes as holograms using a coordinate system at each code's real-world position
WinRTWinRT 使用可由 Unreal 的生成系统使用的 WinRT 代码创建一个单独的二进制文件Create a separate binary with WinRT code that can be consumed by Unreal’s build system

4.流式传输并部署到设备4. Streaming and deploying to a device

如果你想要在 HoloLens 设备上测试仍处于开发阶段的应用程序,则可以使用 Unreal 编辑器或打包的 Windows 可执行文件从电脑直接流式传输该应用程序If you want to test out your application on a HoloLens device while still in development, you can stream it directly from your PC by using either the Unreal editor or a packaged Windows executable.

如果这是你第一次将 Unreal 应用部署到 HoloLens 2,则需要从 Epic Launcher 下载支持文件If this is your first time deploying an Unreal app to HoloLens 2, you'll need to download supporting files from the Epic Launcher. 安装这些文件后,即可从 Unreal 编辑器设备门户进行部署。Once you have those files installed, you're ready to deploy from either the Unreal editor or the Device Portal.

5.添加服务5. Adding services

在开发历程中的这个阶段,你可能希望添加服务或寻求商业部署方面的帮助。At this point in your development journey, you might be looking to add services or for a helping hand with commercial deployment. Azure 云服务 与 Dynamics 365 功能集成可以在很大程度上提高项目的水平。Integrating Azure Cloud Services and Dynamics 365 features can level up your projects in a major way. 我们已编译了几个入门点,用于探索和扩展你的混合现实知识。We've compiled a few starting points for you to explore and expand your Mixed Reality knowledge.

Azure 空间定位点 (ASA) 是一项跨平台服务,可用于构建空间感知的混合现实应用程序。Azure Spatial Anchors (ASA) is a cross-platform service that allows you to build spatially aware mixed reality applications. 借助 Azure 空间定位点,你可按真实世界的规模跨多台设备映射、保存和共享全息内容。With Azure Spatial Anchors, you can map, persist, and share holographic content across multiple devices, at real-world scale.

下一步操作What's next?

开发人员的工作一直在更新,特别是在学习新工具或 SDK 时。A developer's job is never done, especially when learning a new tool or SDK. 以下部分将带你进入你已完成的初学者级别资料之外的其他领域,并在你遇到问题时提供有用的资源。The following sections can take you into areas beyond the beginner level material you've already completed, along with helpful resources if you get stuck. 请注意,这些主题和资源不按任何顺序排列,因此请随意查看并探索!Note that these topics and resources are not in any sequential order, so feel free to jump around and explore!

调试Debugging

如果希望使用 Visual Studio 对在设备上运行的应用程序进行调试,请按照以下说明操作。If you're looking to debug the application while it's running on device with Visual Studio, follow these instructions.

性能Performance

混合现实开发附带依赖于平台的性能检查点。Developing for mixed reality comes with performance checkpoints that depend on the platform. HoloLens 2 应用必须以每秒 60 帧的速度运行,才能使全息影像稳定显示且快速响应。A HoloLens 2 app must run at 60 frames per second for holograms to appear stable and responsive. 幸运的是,我们提供了有关在 Unreal 应用程序中升级性能的性能建议Luckily, we have performance recommendations for upgrading performance in your Unreal applications.

支持的功能Supported Features

HoloLens 2 功能HoloLens 2 Feature 最早支持的 Unreal Engine 版本Earliest Supported Unreal Engine Version 在 OpenXR 中受支持 (4.26)Supported in OpenXR (4.26)
ARM64 支持ARM64 support 4.234.23 ✔️✔️
从电脑进行流式传输Streaming from a PC 4.234.23 ✔️✔️
空间映射Spatial mapping 4.234.23 ✔️✔️
手动和联合跟踪Hand and joint tracking 4.234.23 ✔️✔️
眼动跟踪Eye tracking 4.234.23 ✔️✔️
语音输入Voice input 4.234.23 ✔️✔️
空间定位点Spatial anchors 4.234.23 ✔️✔️
摄像头访问Camera access 4.234.23
QR 码QR codes 4.234.23 ✔️✔️
空间音频Spatial audio 4.234.23 ✔️✔️
Spectator Screen 支持流式传输Spectator Screen support for streaming 4.244.24
通过流式传输的平面 LSRPlanar LSR over streaming 4.244.24
示例应用Sample apps 4.244.24 ✔️✔️
移动多视图:性能达到 60 fpsMobile multi-View: Performance hits 60 fps 4.254.25 ✔️✔️
第三人称摄像机渲染3rd camera render 4.254.25
从打包的桌面应用进行流式传输Streaming from a packaged desktop app 4.25.14.25.1 ✔️✔️
面向 HoloLens 2 的 Azure 空间定位点 (beta)Azure Spatial Anchors for HoloLens 2 (beta) 4.254.25
混合现实 UX Tools 支持Mixed Reality UX Tools support 4.254.25 ✔️✔️
开发人员文档和教程Developer docs & tutorials 4.254.25 ✔️✔️
系统键盘System keyboard 4.264.26 ✔️✔️
HoloLens Media Player 插件HoloLens Media Player plugin 4.264.26 ✔️✔️
适用于 iOS 和 Android 的 Azure 空间定位点(beta 版)Azure Spatial Anchors for iOS and Android (beta) 4.264.26
具有 Microsoft 供应商特定 OpenXR 扩展的 Microsoft OpenXR 插件Microsoft OpenXR plugin with Microsoft vendor-specific OpenXR extensions 4.264.26 ✔️✔️
从 Azure 流式传输到 HoloLens 2Streaming from Azure to HoloLens 2 4.264.26 ✔️✔️
适用于打包应用的 Windows 应用认证工具包合规性Windows App Certification Kit compliance for packaged apps 4.264.26 ✔️✔️
HP Reverb G2 手柄支持HP Reverb G2 controller support 4.264.26 ✔️✔️

另请参阅See also