Unreal 中的串流Streaming in Unreal

從電腦串流至 HoloLens 可提供兩大優點:Streaming from a PC to HoloLens provides two major advantages:

  • 可讓您的混合實境應用程式利用電腦的計算能力。It lets your mixed reality app take advantage of your PCs computational power.
  • 有助於加快開發反覆運算的時間。It helps speed up development iteration time.

若要開始使用,您必須將全像攝影遠端播放程式下載到您的 HoloLens 裝置。To get started, you'll need to download the Holographic Remoting Player to your HoloLens device. 全像攝影遠端播放程式可讓您的應用程式從下列來源直接串流至 HoloLens 上的遠端播放程式:The Holographic Remoting Player lets your app to stream directly to the remoting player on your HoloLens from the following sources:

  • Unreal Engine 編輯器The Unreal Engine editor
  • 已封裝的 Windows 可執行檔A packaged Windows executable

進行串流時,您可以存取您在裝置上執行應用程式時可用的絕大多數 HoloLens 功能。When streaming, you have access to almost all of the same HoloLens capabilities as you would when running an application on a device. 其中包括手部關節追蹤 (如果您是在 HoloLens 2 上)、空間對應空間錨點,但不包括此清單上的功能。This includes hand joint tracking if you're on a HoloLens 2, spatial mapping, and spatial anchors, but leaves out the features on this list.

注意

  • 串流品質高度取決於您的 wifi 網路強度。Streaming quality is highly dependent on the strength of your wifi network.
  • 全像攝影遠端處理播放程式會自動啟用所有功能。All capabilities are automatically enabled for the holographic remoting player. 如果您發現某個功能需要使用者權限 (例如:眼睛追蹤),才能透過串流方式來使用,但在裝置上執行時則不用,請檢查並確定您已在專案設定下啟用適當的功能。If you find a capability that requires user permission (ex: eye tracking) to be working over streaming but not when running on device, check to ensure you've enabled the proper capabilities under your project settings.

串流限制Streaming limitations

手部網格、HoloLens 相機和系統鍵盤無法透過串流來使用。Hand meshes, the HoloLens camera, and the system keyboard are unavailable over streaming. 請注意,您可以從串流來源電腦的麥克風獲得串流應用程式的語音輸入。Note that speech input for streamed apps can be acquired via the microphone of the PC you are streaming from.

OpenXROpenXR

在 OpenXR 上執行的 Unreal 4.26 支援串流到全像攝影遠端播放程式的 2.4.0+ 版本。Unreal 4.26 running on OpenXR supports streaming to versions 2.4.0+ of the Holographic Remoting Player. 在 2.4.0 中串流的 OpenXR 會失去對於空間對應和空間錨點的支援。OpenXR streaming in 2.4.0 is missing support for spatial mapping and spatial anchors.

裝置支援Device support

來源Source HoloLens 第一代HoloLens first Gen HoloLens 2HoloLens 2 沉浸式頭戴裝置Immersive Headsets
Unreal 編輯器Unreal editor ✔️✔️ ✔️✔️
Windows 套件Windows package ✔️✔️

從 Unreal 編輯器進行串流Streaming from the Unreal editor

身為開發人員,您會發現從 Unreal 編輯器串流至 HoloLens 裝置可在測試時提供很大的好處,也就是您不再需要等到應用程式完成建置和部署,才能試用您的更新。As a developer, you'll find that streaming from the Unreal editor to your HoloLens device provides significant benefits when testing, namely that you no longer have to wait for your app to build and deploy before trying out your updates.

您可以在教學課程系列中找到從 Unreal 編輯器進行串流的詳細指示。You can find detailed instructions for streaming from the Unreal editor in our tutorial series.

從已封裝的 Windows 可執行檔進行串流Streaming from a packaged Windows executable

在 Unreal 4.25.1 和後續版本中,您可以從已封裝的 Windows 可執行檔將應用程式串流至 HoloLens 2 裝置:In Unreal 4.25.1 and onwards, you can stream your app to a HoloLens 2 device from a packaged Windows executable:

  1. 在 [編輯器] 功能表中,移至 [檔案] > [封裝專案] > [Windows]。Go to File > Package Project > Windows in the editor menu.

    • 選擇要儲存套件的位置,然後選取 [選取資料夾]。Choose a location to save your package and select Select Folder.
  2. 套件完成建置後,請在 HoloLens 2 上開啟 [全像攝影遠端播放程式],並記下 IP 位址。Once the package has finished building, open the Holographic Remoting Player on your HoloLens 2 and make note of the IP Address.

  3. 將 [全像攝影遠端播放程式] 保持開啟,並使用命令列提示字元執行下列動作:Leave the Holographic Remoting Player open and use the command line prompt to:

    • 切換至套件儲存所在的本機目錄中。cd into the local directory where you saved your package.
    • 輸入下列命令:<App Name>.exe -vr -HoloLensRemoting=<IP Address>Enter the following command: <App Name>.exe -vr -HoloLensRemoting=<IP Address>

注意

系統應該會自動使用您專案設定中的應用程式名稱來建立 Windows 套件。The application name in your project settings should be automatically used to create the Windows package. 如果這些設定因某些原因而有所不同,請在命令提示字元中使用 Windows 可執行檔名稱。If these are different for some reason, use the Windows executable name in the command prompt.

按 Enter 鍵,您的應用程式即會開始串流!Hit enter and watch your application start streaming!

命令列選項Command line options

您可以在下表中找到可從 Unreal Engine 4.26+ 中的每個平台進行串流的其他命令列選項。Additional command line options for streaming from each platform in Unreal Engine 4.26+ can be found in the table below.

選項Option 說明Description
-HoloLensRemoting=<IP address:port> 取得要作為連線目標的 HoloLens 2 裝置 IP 位址 (和選擇性連接埠)。Takes the IP address (and optional port) of the HoloLens 2 device to connect to. 如果未提供連接埠,則預設為 8265。If no port is provided, default to 8265.
-RemotingBitrate=<bitrate> (選擇性) 預設值 8000。(optional) Default 8000. 最大網路傳輸速率 (kb/s)。Max network transfer rate (kb/s).
-HoloLensRemotingListen (選擇性) 啟動接聽伺服器(optional) Start a listen server
-HoloLensRemotingListenPort=<port> (選擇性) 取得要接聽的連接埠。(optional) Takes the port to listen on. 用於從 HoloLens 裝置連線到電腦或 VM。Used for connecting to a PC or VM from a HoloLens device.
-HoloLens1Remoting=<IP address> (在 4.26 中已過時) 取得要作為連線目標的 HoloLens 1 裝置 IP 位址(deprecated in 4.26) Takes the IP address of the HoloLens 1 device to connect to

另請參閱See also