简体   繁体   English

Unity AR 相机可以像 VR 一样渲染 - 混合现实

[英]Unity AR camera to render like VR - Mixed reality

I am currently playing around with Unity.我目前正在玩 Unity。 I have a simple question that I can not find and answer for.我有一个简单的问题,我无法找到并回答。

I can easily set up an AR session in Unity for iOS and Android using the AR foundation toolkit.我可以使用 AR 基础工具包在 Unity 中为 iOS 和 Android 轻松设置 AR session。 But I would like to make the phone camera picture to render in steroscopic like in regular VR thus creating a Mixed Reality project.但我想让手机摄像头图片像普通 VR 一样以立体渲染,从而创建一个混合现实项目。

I don't want to use the SDK related to Microsoft Hololens since I would like to aim the development for iOS and Android devices.我不想使用与 Microsoft Hololens 相关的 SDK,因为我想针对 iOS 和 Android 设备的开发。

Thanks in advance!提前致谢!

Premade solution预制解决方案

Microsoft has a package that aims for mixed reality but it's for Android and iOS: https://github.com/Microsoft/MixedRealityToolkit-Unity - but this package is huge, and if you have a project already it will be hard to convert to use this package. Microsoft has a package that aims for mixed reality but it's for Android and iOS: https://github.com/Microsoft/MixedRealityToolkit-Unity - but this package is huge, and if you have a project already it will be hard to convert to使用这个 package。

Custom solution定制解决方案

If you want to create something together for the prototype (although I would not recommend this for production code as it's not optimized) you can use 2 cameras and set them as following如果您想为原型创建一些东西(尽管我不建议将其用于生产代码,因为它没有经过优化)您可以使用 2 个相机并将它们设置如下

相机设置

Create 2 cameras, with slightly offset origin.创建 2 个摄像机,原点略有偏移。 And use the ViewportRect parameter of the camera to set rendering for two different eyes.并使用相机的 ViewportRect 参数来设置两个不同眼睛的渲染。

One camera should have (x: 0, y:0, w: 0.5, h: 1) second (x: 0.5, y:0, w: 0.5, h: 1)一台相机应该有 (x: 0, y:0, w: 0.5, h: 1) 秒 (x: 0.5, y:0, w: 0.5, h: 1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM