原生開發概觀Native development overview


UnityUnreal這類3d 引擎不是唯一開放給您的混合現實開發途徑。3D engines like Unity or Unreal aren't the only Mixed Reality development paths open to you. 您也可以使用 Windows Mixed Reality Api 搭配 DirectX 11 或 DirectX 12 來建立混合的現實應用程式。You can also create Mixed Reality apps using the Windows Mixed Reality APIs with DirectX 11 or DirectX 12. 藉由進入平臺來源,您基本上就是建立自己的中介軟體或架構。By going to the platform source, you're essentially building your own middleware or framework.


如果您有想要維護的現有 WinRT 專案,請前往我們的主要 winrt 檔If you have an existing WinRT project that you'd like to maintain, head over to our main WinRT documentation.

開發檢查點Development checkpoints

使用下列檢查點,將您的 Unity 遊戲和應用程式融入混合實境的世界中。Use the following checkpoints to bring your Unity games and applications into the world of mixed reality.

1.開始使用1. Getting started

Windows Mixed Reality 支援 兩種類型的應用程式Windows Mixed Reality supports two kinds of apps:

  • UWP 或 Win32 混合現實應用程式,這些應用程式 會使用 HolographicSpace APIOpenXR api來呈現可填滿耳機顯示器的 沉浸式視圖UWP or Win32 Mixed Reality applications that use the HolographicSpace API or OpenXR API to render an immersive view that fills the headset display
  • 2d 應用程式 (UWP) ,其使用 DIRECTX、XAML 或其他架構在 Windows Mixed Reality 首頁的平板上轉譯 2d 視圖2D apps (UWP) that use DirectX, XAML, or another framework to render 2D views on slates in the Windows Mixed Reality home

2d 視圖和沉浸式視圖的 DirectX 開發之間的差異,主要是要考慮全像攝影轉譯和空間輸入。The differences between DirectX development for 2D views and immersive views primarily concern holographic rendering and spatial input. 您的 UWP 應用程式 IFrameworkView 或您的 Win32 應用程式的 HWND 是必要的,而且維持在相同的狀態。Your UWP application's IFrameworkView or your Win32 application's HWND are required and remain largely the same. 適用于您應用程式的 WinRT Api 也是如此。The same is true for the WinRT APIs that are available to your app. 但是,您必須使用這些 Api 的不同子集來利用全像全像的功能。But you must use a different subset of these APIs to take advantage of holographic features. 例如,「全像」應用程式的系統會管理 swapchain 和框架,以啟用姿勢預測的框架迴圈。For example, the system for holographic applications manages the swapchain and frame present to enable a pose-predicted frame loop.

CheckpointCheckpoint 結果Outcome
什麼是 OpenXR?What is OpenXR? 熟悉 OpenXR 及其提供的功能,開始您的原生開發旅程Begin your native development journey by getting acquainted with OpenXR and what it has to offer
安裝最新工具Install the latest tools 下載並安裝最新的原生開發工具Download and install the latest native development tools
設定 HoloLens 2Set up for HoloLens 2 設定您的裝置和環境以進行 HoloLens 2 開發Configure your device and environment for HoloLens 2 development
設定沉浸式耳機Set up for immersive headsets 設定您的裝置和環境以進行 Windows Mixed Reality 開發Configure your device and environment for Windows Mixed Reality development
試用範例應用程式Try a sample app 探索您裝置上相同基本 OpenXR 應用程式的 UWP 和 Win32 版本Explore a UWP and Win32 version of the same basic OpenXR app on your device
瞭解 OpenXR APILearn the OpenXR API 觀看60分鐘的逐步解說影片,在 Visual Studio 中導覽 OpenXR API 的所有重要元件Watch a 60-minute walkthrough video that tours all key components of the OpenXR API in Visual Studio
新增 OpenXR 載入器Add the OpenXR loader 將 OpenXR 載入器新增至現有的原生專案以開始開發Add the OpenXR loader to an existing native project to get started developing

2.核心基本要素2. Core building blocks

Windows Mixed Reality 的應用程式會使用下列 Api 來建立 HoloLens 和其他沉浸式耳機的 混合現實 體驗:Windows Mixed Reality applications use the following APIs to build mixed-reality experiences for HoloLens and other immersive headsets:

功能Feature 功能Capability
目光Gaze 讓使用者藉由注視全像投影而將其定為目標Let users target holograms with by looking at them
手勢Gesture 將空間動作新增至您的應用程式Add spatial actions to your apps
全像攝影的呈現Holographic rendering 在您的使用者附近的確切位置繪製全像影像Draw a hologram at a precise location in the world around your users
移動控制器Motion controller 讓您的使用者在您的混合現實環境中採取行動Let your users take action in your Mixed Reality environments
空間對應Spatial mapping 透過虛擬網格重疊對應您的實體空間,以標示環境的界限Map your physical space with a virtual mesh overlay to mark the boundaries of your environment
語音Voice 擷取使用者說出的關鍵字、片語和指令Capture spoken keywords, phrases, and dictation from your users


您可以在 OpenXR 藍圖 檔中找到即將推出和開發中的核心功能。You can find upcoming and in-development core features in the OpenXR roadmap documentation.

3. 部署和測試3. Deploying and testing

您可以在 HoloLens 2 上使用 OpenXR 或 Windows Mixed Reality 沉浸式耳機開發桌上型電腦。You can develop on a desktop using OpenXR on a HoloLens 2 or Windows Mixed Reality immersive headset. 如果您沒有耳機的存取權,您可以改用 HoloLens 2 模擬器Windows Mixed Reality 模擬器。If you don't have access to a headset, you can use the HoloLens 2 Emulator or the Windows Mixed Reality Simulator instead.

接下來要做什麼?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. 這些主題和資源不會以任何順序排列,因此您可以隨時跳到探索!These topics and resources aren't in any sequential order, so feel free to jump around and explore!

其他資源Additional resources

如果您想要 OpenXR 遊戲的等級,請參閱下列連結:If you're looking to level up your OpenXR game, check out the links below:

請參閱See also