Open14

Babylon.js NativeからHoloLens Buildする

イワケンイワケン
git clone --recursive https://github.com/BabylonJS/BabylonNative.git
cd BabylonNative
cd Apps
npm install

ここでエラー

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\workplace\BabylonJS\BabylonNativeHoloLens/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\workplace\BabylonJS\BabylonNativeHoloLens\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\owner\AppData\Local\npm-cache\_logs\2022-05-31T07_04_16_768Z-debug-0.log

エラーの理由はApps以下に移動しなかったからでした。

イワケンイワケン

Building on Windows 10, Targeting HoloLens 2

Follow the steps from All Development Platforms before proceeding.

Required Tools: Visual Studio 2019 with C++ and UWP development tools, Python 3.0 or newer (required by dependencies)

HoloLens 2 supports arm64 UWP applications. To create a HoloLens 2 Visual Studio solution for a physical device, run the following command from the repository root:

「All Development Platforms」の手順で進めてください。

必要なツールVisual Studio 2019(C++およびUWP開発ツール付き)、Python 3.0以降(依存関係により必要です。

HoloLens 2 は arm64 UWP アプリケーションをサポートしています。物理デバイス用のHoloLens 2 Visual Studioソリューションを作成するには、リポジトリルートから次のコマンドを実行します。

イワケンイワケン

ビルド方法

レポジトリルートにて

cmake -B build/uwp_arm64 -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0 -A arm64
イワケンイワケン

Additional notes for HoloLens 2 development:

At this time, running immersive applications on HoloLens 2 emulators is NOT supported. We are tracking support for HoloLens 2 emulators here.
For the Playground app, setting the hololens javascript variable to true in experience.js will configure the experience for HoloLens 2.
HoloLens 2 immersive experiences require the Spatial Perception UWP capability. This capability is enabled in the application's Package.appxmanifest. When creating a custom BabylonNative project, one will need to enable the Spatial Perception UWP cability in their app's Package.appxmanifest. For more information on UWP capabilities, see here.
HoloLens 2 immersive experiences are built on top of OpenXR. Updates to the OpenXR runtime should automtically be installed on physical HoloLens 2 devices through the Windows Store. If for some reason updates are not automatically installed (custom device configurations, lack of network connectivity, etc), developers may need to manually install updates for the OpenXR runtime through the Windows Store. For more information on installing newer versions of OpenXR, see here.

現時点では、HoloLens 2エミュレータでの没入型アプリケーションの実行はサポートされていません。HoloLens 2エミュレータのサポートについては、こちらで追跡調査しています。
Playgroundアプリの場合、experience.jsでholens javascript変数をtrueに設定すると、HoloLens 2用のエクスペリエンスが構成されます。
HoloLens 2没入体験には、Spatial Perception UWPケイパビリティが必要です。このケイパビリティは、アプリケーションのPackage.appxmanifestで有効にします。カスタムBabylonNativeプロジェクトを作成する場合、アプリのPackage.appxmanifestでSpatial Perception UWPケイパビリティを有効にすることが必要です。UWP機能の詳細については、こちらをご覧ください。
HoloLens 2の没入型エクスペリエンスは、OpenXRの上に構築されています。OpenXRランタイムのアップデートは、Windowsストアを通じてHoloLens 2の物理デバイスに自動でインストールされるはずです。何らかの理由でアップデートが自動的にインストールされない場合(デバイスの構成がカスタマイズされている、ネットワークに接続されていないなど)、開発者はWindowsストアを通じてOpenXRランタイムのアップデートを手動でインストールする必要があるかもしれません。OpenXRの新しいバージョンのインストールに関する詳細は、こちらを参照してください。

イワケンイワケン

build/uwp_arm64/BabylonNative.slnをVisual Studio2022で開く

  • Windows11で開く
    • 失敗
  • Windows10で開く
    • ビルド成功
イワケンイワケン

Windows11は失敗

Release>arm64>ValidationTests (Universal Windows) > デバイスをプレイ

配置エラー
ブートストラップがマシンに接続できませんでした。

重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー DEP6953: 次のエラーにより、リモート デバッガーの起動に失敗しました: 'Command failed: 0x80270254'。 ValidationTests

重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー DEP3321: このアプリケーションを配置するには、デプロイメント ターゲットが Windows Universal Runtime バージョン 10.0.22000.0 以降で実行されている必要があります。現在実行しているバージョンは、10.0.20348.1503 です。OS をアップデートするか、デプロイメント ターゲットを該当するバージョンのデバイスに変更してください。 ValidationTests

イワケンイワケン

Windows10で行ったら成功

同じように

  • buildコマンドを叩く
  • Visual Studio2022
    • Release>arm64>PlayGround (Universal Windows) > デバイスをプレイ

しかし、MRアプリにはなっていない

イワケンイワケン

課題

ツイートの動画では、問題なく描画されているが、
HoloLens側の描画としては、しましまの白い棒状の描画が、手前にされている状況。
こちらの解決を急ぎたい。