unity3d 调用uwp_在UWP中使用全息遥控创建增强的3D视觉效果

unity3d 调用uwp

Standalone Universal Windows Platform Holographic Emulation is the next step in holographic emulation, extending its functionality outside of the Unity Editor. Developers can now create UWP applications running on their Windows PC and connect to HoloLens at any point, providing a way to visualize 3D content in mixed reality.

独立通用Windows平台全息仿真是全息仿真的下一步,将其功能扩展到Unity Editor之外。 开发人员现在可以创建在其Windows PC上运行的UWP应用程序,并可以随时连接到HoloLens,从而提供了一种在混合现实中可视化3D内容的方法。

要求 (Requirements)

Standalone UWP Holographic Emulation requires Unity 2018.2 beta and Windows 10 Anniversary Update or later.

独立的UWP全息仿真需要Unity 2018.2 beta和Windows 10周年更新或更高版本。

入门 (Getting Started)

To enable remoting in the UWP build, open the Build Settings window and select Enable XR Remoting.

要在UWP构建中启用远程处理,请打开“构建设置”窗口,然后选择“启用XR 远程处理”

This changes the startup process of the app by enabling holographic remoting and setting it to run in Remote to Device mode internally.

通过启用全息远程处理并将其设置为在内部以“远程到设备”模式运行,可以更改应用程序的启动过程。

Next step is to write some code, allowing us to connect to a remote HoloLens device. Sample code is available as a part of the documentation here.

下一步是编写一些代码,使我们可以连接到远程HoloLens设备。 示例代码可在此处作为文档的一部分获得。

The new HolographicRemoting API allows us to connect, disconnect, or check the connection status. Once the connection succeeds, code loading Windows Mixed Reality device has to be executed to start the initialization process.

新的HolographicRemoting API允许我们连接,断开连接或检查连接状态。 连接成功后,必须执行加载Windows Mixed Reality设备的代码才能启动初始化过程。

1

2
3
4
5
6
7
8
StartCoroutine(LoadDevice("WindowsMR"));
   IEnumerator LoadDevice(string newDevice)
    {
        XRSettings.LoadDeviceByName(newDevice);
        yield return null;
        XRSettings.enabled = true;
    }

1

2
3
4
5
6
7
8
StartCoroutine ( LoadDevice ( "WindowsMR" ) ) ;
   IEnumerator LoadDevice ( string newDevice )
     {
         XRSettings . LoadDeviceByName ( newDevice ) ;
         yield return null ;
         XRSettings . enabled = true ;
     }

For a call to XRSettings.enabled to succeed, we have to wait for load device by name to complete. To make sure we do so, we yield return null.

为了成功调用XRSettings.enabled,我们必须等待按名称加载设备完成。 为了确保我们这样做,我们产生return null。

全息遥控 (Holographic Remoting)

from the Windows Store. Start the application on the device, and the IP Address you should use when using Holographic Remoting API to connect will show up on the screen. Windows应用商店中提供的远程播放器。 在设备上启动应用程序,使用Holographic Remoting API进行连接时应使用的IP地址将显示在屏幕上。

More information about the Remoting Player is available at Microsoft Windows Dev Center.

Microsoft Windows Dev Center中提供了有关Remoting Player的更多信息。

Once the app is running on a device, launch the standalone Unity app with remoting functionality enabled. Once HolographicRemoting.Connect() is called, you should see the content of your UWP app displayed in mixed reality on HoloLens.

应用程序在设备上运行后,启动启用了远程功能的独立Unity应用程序。 调用HolographicRemoting.Connect()后 ,您应该会在HoloLens上以混合现实的形式看到UWP应用程序的内容。

This is a great way to extend your UWP application by adding Mixed Reality content to it or use users desktop to render complex models and see them in XR.

这是通过向其添加“混合现实”内容或使用用户桌面呈现复杂模型并在XR中查看它们来扩展UWP应用程序的好方法。

在编辑器中测试您的独立全息远程处理应用程序 (Testing Your Standalone Holographic Remoting App  in Editor)

The Standalone Holographic Remoting API can run while in Play mode inside Editor. To enable this option, go to Holographic Emulation window and make sure that the Emulation Mode is set to Remote to Device and that the Remoting Player is running on the HoloLens.

Standalone Holographic Remoting API可以在Editor的Play模式下运行。 要启用此选项,请转到Holographic Emulation窗口,并确保将Emulation Mode设置为Remote to Device,并确保Remoting Player在HoloLens上运行。

There is no need to provide any other information in that window. Now, start the App in Play Mode in Editor, and execute the logic leading to the HolographicRemoting.Connect() call.

无需在该窗口中提供任何其他信息。 现在,在编辑器的“播放模式”下启动该应用程序,并执行导致HolographicRemoting.Connect()调用的逻辑。

已知局限性 (Known Limitations)

Speech (PhraseRecognizer) isn’t currently supported via Holographic Remoting and instead intercepts speech from the Editor-hosted machine.

全息远程处理目前不支持语音(PhraseRecognizer),而是从编辑器托管的计算机中拦截语音。

PhotoCapture can be performed during Holographic Simulation, but since the capture works via a local camera (such as a webcam), you won’t be able to retrieve a matrix with TryGetProjectionMatrix or TryGetCameraToWorldMatrix.

可以在全息仿真过程中执行PhotoCapture,但是由于捕获是通过本地摄像机(例如网络摄像头)进行的,因此您将无法使用TryGetProjectionMatrixTryGetCameraToWorldMatrix检索矩阵。

During Remoting, all audio on the hosted PC (not just that from the app) will redirect to the device.

在远程处理期间,托管PC上的所有音频(不仅是来自应用程序的音频)都将重定向到设备。

翻译自: https://blogs.unity3d.com/2018/05/30/create-enhanced-3d-visuals-with-holographic-emulation-in-uwp/

unity3d 调用uwp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值