Table of Contents

Unity 中的 EasyAR 頭顯支援

本文檔介紹了在 Unity 中 EasyAR 頭顯支援的整體架構和注意事項。

開始之前

  • 閱讀 EasyAR 的頭顯支援 了解 EasyAR 已經支援的頭顯類型和頭顯上可以執行的 EasyAR 功能。

頭顯支援概述

EasyAR 在 Unity 中支援頭顯的方式比較靈活,常見有兩種方式:

  • 內置支援:通常在 EasyAR Sense 函式庫中直接對接裝置 SDK,並在 Unity 中提供對應的介面 (比如 Apple Vision Pro)
  • 擴展支援:透過 Unity 頭顯擴展套件對接裝置 SDK (比如 Pico)
block
  columns 4
  block:groupApp:4
    block:groupAppWrapper
      space
      App1["EasyAR + Device A<br>應用程式"]
      space
      App2["EasyAR<br>應用程式"]
      space
      App3["EasyAR + Device B<br>應用程式"]
    end
  end
  
  block:groupSensePluginExtension
    columns 1
    SensePluginExtension["EasyAR Sense Unity Plugin<br>Device A 擴充功能"]
    space
  end
  block:groupSensePlugin
    columns 1
    SensePlugin["EasyAR Sense Unity Plugin"]
    space
  end
  block:groupXRI
    columns 1
    XRI["XR Interaction Toolkit"]
    space
  end
  block:groupARF
    columns 1
    ARF["AR Foundation"]
    space
  end
  
  block:groupDeviceAUnity
    columns 1
    DeviceAUnity["Device A<br>Unity SDK"]
    space
  end
  block:groupSense
    columns 1
    Sense["EasyAR Sense"]
    block:groupSenseWrapper
      MDeviceB["Device B<br>CameraDevice"]
      Others["..."]
    end
  end
  block:groupXRSubsystem:2
    columns 1
    XRSubsystem["XR Subsystems"]
    XRSDK["Unity XR SDK"]
  end

  block:groupSystem:4
    columns 1
    System["原生函式庫"]
    block:groupSystemWrapper
      space
      DeviceA["Device A<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;函式庫&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"]
      space
      space
      DeviceB["Device B<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;函式庫&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"]
      space
    end
  end
  
  SensePluginExtension --> App1
  SensePlugin --> App1
  SensePlugin --> App2
  SensePlugin --> App3
  ARF --> App3
  XRI --> App1
  XRI --> App3
  groupSense --> SensePlugin
  groupDeviceAUnity --> SensePluginExtension
  SensePlugin --> SensePluginExtension
  DeviceA --> groupDeviceAUnity
  DeviceA --> XRSDK
  XRSubsystem --> ARF
  XRSubsystem --> XRI
  DeviceB --> MDeviceB
  DeviceB --> XRSDK
  
  style groupApp fill:none,stroke:none,stroke-width:0px
  style groupAppWrapper fill:none,stroke:none,stroke-width:0px
  style groupSensePlugin fill:none,stroke:none,stroke-width:0px
  style groupARF fill:none,stroke:none,stroke-width:0px
  style groupXRI fill:none,stroke:none,stroke-width:0px
  style DeviceAUnity fill:none,stroke:none,stroke-width:0px,color:#fff
  style Sense fill:none,stroke:none,stroke-width:0px,color:#fff
  style groupSenseWrapper fill:none,stroke:none,stroke-width:0px
  style XRSubsystem fill:none,stroke:none,stroke-width:0px,color
  style System fill:none,stroke:none,stroke-width:0px
  style groupSystemWrapper fill:none,stroke:none,stroke-width:0px
  style groupSensePluginExtension fill:none,stroke:none,stroke-width:0px  

  classDef EasyAR fill:#6e6ce6,stroke:#333,color:#fff
  class groupSense EasyAR
  class SensePlugin EasyAR
  class SensePluginExtension EasyAR

  classDef Device fill:#636,stroke:#333,color:#fff
  class groupDeviceAUnity Device
  class DeviceB Device
  class DeviceA Device

圖中:

  • 裝置 A 屬於擴展支援

    實踐中裝置 A 通常會有對應的 Unity SDK,用於對接 Unity XR SDK 或者獨立實現頭顯渲染能力。

    裝置 A 的頭顯擴展套件負責將 EasyAR Sense Unity Plugin 和裝置 A 的 Unity SDK 對接起來,從而實現 EasyAR 在裝置 A 上的執行。這個支援套件可能由 EasyAR 提供,也可能由裝置廠商提供。

  • 裝置 B 屬於內置支援

    實踐中裝置 B 可能有也可能沒有對應的 Unity SDK,取決於裝置廠商的實現。比如 Apple Vision Pro 沒有對應的 Unity SDK,XREAL 有對應的 Unity SDK。

內置支援和擴展支援的頭顯都支援使用了 自訂相機

重要事項

在自訂相機或頭顯上使用試用產品(個人版 license、試用版 XR license 或試用版 Mega 服務等)時,EasyAR Sense 每次啟動後會在 100 秒(Mega 用戶可經由 EasyAR 商務在審批後調整時間長度)後停止響應。使用付費版本的 EasyAR Sense 和付費的 EasyAR Mega 服務沒有這個限制。

在 Unity 中,虛擬攝影機的渲染、投影矩陣和 transform 等不受 EasyAR 控制,它們通常由裝置 SDK 或 Unity XR SDK 控制。裝置自身的功能,比如手勢識別、眼動追蹤等,仍然由裝置及裝置 SDK 提供。在使用時,通常需要同時使用 EasyAR 和裝置 SDK。

後續步驟