Info for Developers of Microsoft HoloLens

HoloLens 関連イベントと情報共有に努めるブログ

HoloLens 技術情報の作業過程記録 - HoloLens Documentation: Holograms 100

Install the tools に続いて、Using Visual Studio を確認したところ、下記の下準備が必要であることを確認。

Prerequisites

  1. See Install the Tools for installation instructions.
  2. Create a new Universal Windows app project in Visual Studio 2015 Update 1 for a 2D Windows 10 app or start use Unity to create a holographic app. C#, C++, and JavaScript projects are all supported on HoloLens.

 

この記事は、2. の use Unity to create a holographic app (a.k.a Holograms 100) の作業過程記録です。

 

  1. Target the app to Windows.Holographic新しいプロジェクトの作成 (Chapter 1 - Create a New Project の実施)
    1. Start Unity
    2. Select New
    3. Enter a project name (e.g. "HelloHolograms")
    4. Enter a location to save your project
    5. Ensure the 3D toggle is selected
    6. Select Create project

      f:id:hololensdev:20160814150919p:plain

  2. Chapter 2 - Setup the Camera の実施
    1. Select Main Camera in the Hierarchy panel
    2. In the Inspector panel, find the Transform component and change the Position from (X: 0, Y: 1, Z: -10) to (X: 0, Y: 0, Z: 0)

      f:id:hololensdev:20160814151942p:plain
      ※規定値は (X: 0, Y: 0, Z: -10) だった

  3. Chapter 2 - Setup the Camera の実施
    1. With the Main Camera still selected in the Hierarchy panel, find the Camera component in the Inspector panel and change the Clear Flags dropdown from Skybox to Solid Color.
    2. Select the Background color picker and change the RGBA values to (0, 0, 0, 0)

      f:id:hololensdev:20160814152052p:plain

  4. Chapter 2 - Setup the Camera の実施
    1. With the Main Camera still selected in the Hierarchy panel, find the Camera component in the Inspector panel and change the Near Clip Plane field from the default 0.3 to the HoloLens recommended 0.85.

      f:id:hololensdev:20160816232818p:plain

  5. Chapter 3 - Create a Hologram の実施
    1. In the top left corner of the Hierarchy panel, select the Create dropdown and choose 3D Object > Cube.

      f:id:hololensdev:20160816233221p:plain

    2. Select the newly created Cube in the Hierarchy panel
    3. In the Inspector find the Transform component and change Position to (X: 0, Y: 0, Z: 2). This positions the cube 2 meters in front of the user's starting position.
    4. In the Transform component, change Rotation to (X: 45, Y: 45, Z: 45) and change Scale to (X: 0.25, Y: 0.25, Z: 0.25). This scales the cube to 0.25 meters.f:id:hololensdev:20160816233445p:plain
    5. To save the scene changes, select File > Save Scene, name the scene, and select Save
  6. Chapter 4 - Export from Unity to Visual Studio の実施
    1. Select Edit > Project Settings > Quality
    2. Select the dropdown under the Windows Store logo and select Fastest. You'll know the setting is applied correctly when the box in the Windows Store column and Fastest row is green.
      ※Default 横の▼を選択してを Fastest にする

      f:id:hololensdev:20160821134511p:plain

  7. Chapter 4 - Export from Unity to Visual Studio: Unity build settings の実施
    1. Select File > Build Settings...
    2. Select Windows Store in the Platform list.
    3. Set SDK to Universal 10
    4. Set Build Type to D3D
  8. Chapter 4 - Export from Unity to Visual Studio: Specify the export for Windows Holographic
    1. From the Build Settings... window, open Player Settings...
    2. Select the Settings for Windows Store tab
    3. Expand the Other Settings group
    4. In the Rendering section, check the Virtual Reality Supported checkbox to add a new Virtual Reality Devices list and confirm "Windows Holographic" is listed as a supported device.

      f:id:hololensdev:20160823224801p:plain
      Virual Reality Supported チェックボックスが見当たらない... 

      f:id:hololensdev:20160823224837p:plain
      unity は Version 5.3.1f1 Personal

      Install the tools を確認。

      f:id:hololensdev:20160823224929p:plain
      unity を更新してみる。

      f:id:hololensdev:20160823225001p:plain
      unity の Help からは更新できず。

      Unity - Windows - HoloLens から  Unity Download Assistant をダウンロード。

      f:id:hololensdev:20160823225548p:plain
      Unity の更新。このPC から更新していなかったかな...

      f:id:hololensdev:20160904075711p:plain
      Unity フォルダとは別に、Unity HoloLens 5.4.0f3-HTP のフォルダができた。このフォルダ内の Unity.exe を起動する

      f:id:hololensdev:20160904075838p:plain

      f:id:hololensdev:20160904075854p:plain
      一度保存することで、Unity version: 5.4.0 で保存できた。f:id:hololensdev:20160904183341p:plain
      f:id:hololensdev:20160823234024p:plain
      Virtual Reality Supported 項目を確認できた。

  9. Chapter 4 - Export from Unity to Visual StudioExport the Visual Studio solution
    1. Return to the Build Settings window.
    2. Click Add Open Scenes to add the scene
    3. Check Unity C# Projects

      f:id:hololensdev:20160904184220p:plain

    4. Click Build
    5. Click New Folder and name the folder "App".
    6. With the App folder selected, click the Select Folder button.
    7. When Unity is done building, a Windows File Explorer window will appear.
    8. Open the App folder in File Explorer.
    9. Open the generated Visual Studio solution (HelloHolograms.sln in this example)

      f:id:hololensdev:20160904184509p:plain

  10. Chapter 4 - Export from Unity to Visual StudioTarget the app to Windows.Holographic
    1. In Visual Studio, right click on Package.appxmanifest in the Solution Explorer and select View Code

      f:id:hololensdev:20160904184819p:plain
      Visual Studio で開くと上記確認画面。f:id:hololensdev:20160904184855p:plain
      開発者モードに変更した。

      f:id:hololensdev:20160904185012p:plain

    2. Find the line specifying TargetDeviceFamily and change Name="Windows.Universal" to Name="Windows.Holographic".
    3. On the same line, change MaxVersionTested="10.0.10240.0" to MaxVersionTested="10.0.10586.0"f:id:hololensdev:20160904185419p:plain
    4. Save the Package.appxmanifest.
  11. Chapter 5 - Export from Unity to Visual StudioChapter 5 - Build and Deploy
    1. Using the top toolbar in Visual Studio, change the target from Debug to Release and from ARM to X86.

      f:id:hololensdev:20160904185920p:plain

    2. HoloLens over USB

      1. Click on the arrow next to the Local Machine button, and change the deployment target to Device.

        f:id:hololensdev:20160904190119p:plain

      2. Select Debug > Start without debugging
        2つエラー

        f:id:hololensdev:20160904190613p:plain
        重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
        エラー The OutputPath property is not set for project 'Assembly-CSharp.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. HelloHolograms

        f:id:hololensdev:20160904190842p:plain
        重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
        エラー The OutputPath property is not set for project 'Assembly-CSharp-firstpass.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. HelloHolograms

        visual studio 2008 - "the outputpath property is not set for this project" error - Stack Overflow

        f:id:hololensdev:20160904191139p:plain

        f:id:hololensdev:20160904191814p:plain

        f:id:hololensdev:20160904191842p:plain

        重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
        エラー ファイル "C:\Users\Public\Documents\Unity Projects\HelloHolograms\UWP\Assembly-CSharp\bin\x86\Release\Assembly-CSharp.dll" は見つからなかったためコピーできません。 HelloHolograms C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\HelloHolograms.csproj 241

        f:id:hololensdev:20160904191759p:plain

        f:id:hololensdev:20160904192141p:plain

        重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
        エラー コマンド ""C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock="C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\project.lock.json" -bits=32 -configuration=Release -removeDebuggableAttribute=False -path="." -path="..\Players\UAP\x86\Release" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\Assembly-CSharp.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\Assembly-CSharp-firstpass.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\UnityEngine.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\UnityEngine.UI.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\UnityEngine.HoloLens.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\UnityEngine.Networking.dll" "C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\UnityEngine.VR.dll"" はコード 1 で終了しました。 HelloHolograms C:\Users\Public\Documents\Unity Projects\HelloHolograms\App\HelloHolograms\HelloHolograms.csproj 252 
        あれこれやったが、うまくいかない。バージョンが違うのに進めたせいか。再度作りなおすか。
        Unity が Version 5.4.0f3-HTP Personal であることを確認のうえ、上記手順を再度実行。

        できた。

        f:id:hololensdev:20160910222110p:plain
        Hololens [Setings] - [UPDATE&SECURIY] - [For developers] - [Pair] で確認した PIN を入力

        f:id:hololensdev:20160910222617p:plain

    3. Try out your app

      Now that your app is deployed, try moving all around the cube and observe that it stays in the world in front of you.

      HoloLens でキャプチャーしたDemo (Holograms のみ)

      youtu.be

      HoloLens でキャプチャーしたDemo (Holograms + PV camera)

      youtu.be
      HoloLens のキャプチャー方法は参考情報を参照

参考情報:

Using the Windows Device Portal