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>App"]
space
App2["EasyAR<br>App"]
space
App3["EasyAR + Device B<br>App"]
end
end
block:groupSensePluginExtension
columns 1
SensePluginExtension["EasyAR Sense Unity Plugin<br>Extension for 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["Native Library"]
block:groupSystemWrapper
space
DeviceA["Device A<br> Library "]
space
space
DeviceB["Device B<br> Library "]
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。