案例研究-使用稳定面减少全息 turbulenceCase study - Using the stabilization plane to reduce holographic turbulence

使用全息影像通常比较棘手。Working with holograms is often tricky. 四处移动空间,从所有不同角度查看全息影像,可提供一种在普通计算机屏幕上不可用的浸入式级别。Moving around a space and looking at holograms from all different angles provides a level of immersion that isn't available on a normal computer screen. 将这些全息影像置于适当位置并寻找现实,这是一项技术特征,由 Microsoft HoloLens 硬件和全息式应用程序的智能设计完成。Keeping these holograms in place and looking realistic is a technical feat accomplished by both the Microsoft HoloLens hardware and the intelligent design of holographic apps.

技术人员The tech

为了使全息影像看起来像是实际与你共享空间,它们应该正确呈现,无需颜色分离。To make holograms appear as though they're actually sharing the space with you, they should render properly without color separation. 这种情况是通过内置于 HoloLens 硬件的技术实现的,这使得全息影像定位在我们称为 " 稳定" 平面上的部分。This is achieved, in part, by technology built-in to the HoloLens hardware, which keeps holograms anchored on what we call a stabilization plane.

平面由点和法线定义。A plane is defined by a point and a normal. 由于我们始终希望飞机面对相机,因此,我们要考虑设置飞机的点。Since we always want the plane to face the camera, we're concerned with setting the plane's point. 我们可以告诉 HoloLens 将其处理集中于哪个点,以使所有内容保持锚定和稳定。We can tell HoloLens what point to focus its processing on to keep everything anchored and stable. 但是,设置此焦点点是特定于应用的,并且可以根据内容创建或中断应用。However, setting this focus point is app-specific and can make or break your app depending on the content.

正确应用了稳定平面后,全息影像的工作效果最好,但实际的含义取决于要创建的应用程序的类型。Holograms work best when the stabilization plane is properly applied, but what that actually means depends on the type of application you’re creating. 让我们看看一些当前可用于 HoloLens 的应用如何解决此问题。Let’s take a look at how some of the apps currently available for HoloLens tackle this problem.

幕后Behind the scenes

在开发以下应用程序时,我们注意到,当我们没有使用飞机时,对象会在我们的打印头移动时使用 sway。While developing the following apps, we noticed that when we didn't use the plane, objects would sway when our head moved. 此外,还可以看到彩色隔离与打印头或全息图的移动。We'd also see color separation with quick head or hologram movements. 我们结束了试用和错误如何最好地使用稳定平面,并围绕无法修复的问题设计应用程序。We ended up learning through trial and error how to best use the stabilization plane and design our apps around the problems that it can't fix.

Galaxy 资源管理器:静止内容,三维交互Galaxy Explorer: Stationary content, 3D interactivity

在此场景中, Galaxy 资源管理器具有两个主要元素:天体内容的主视图和看看注视的小 UI 工具栏。Galaxy Explorer has two major elements in the scene: The main view of the celestial content and the small UI toolbar that follows your gaze. 对于稳定性逻辑,我们将查看当前看上去向量与每个帧中的相交情况,以确定它是否达到了指定冲突层上的任何内容。For the stabilization logic, we look at what your current gaze vector intersects with in each frame to determine if it hits anything on a specified collision layer. 在这种情况下,我们感兴趣的层是行星,因此,如果注视落在地球上,则会将稳定平面放置在该处。In this case, the layers we’re interested in are the planets, so if your gaze falls on a planet, the stabilization plane is placed there. 如果未命中目标冲突层中的任何对象,则应用将使用辅助 "计划 B" 层。If none of the objects in the target collision layer are hit, the app uses a secondary “plan B” layer. 如果未在 gazed 任何内容,则稳定面将保持与 gazing 内容时的距离相同。If nothing is being gazed at, the stabilization plane is kept at the same distance as it was when gazing at the content. UI 工具将作为平面目标,正如我们发现,在接近到远处,降低了整体场景的稳定性。The UI tools are left out as a plane target as we found the jump between near and far reduced the stability of the overall scene.

Galaxy 资源管理器的设计适合于使其保持稳定并降低颜色分离的效果。The design of Galaxy Explorer lends itself well to keeping things stable and reducing the effect of color separation. 鼓励用户浏览内容,而不是从一边移动内容,而是轨道缓慢,以致颜色分离并不明显。The user is encouraged to walk around and orbit the content rather than move along it from side to side, and the planets are orbiting slowly enough that the color separation isn’t noticeable. 此外,还保留了恒定的 60 FPS,这在防止颜色分离发生的情况下是一种很长的方式。Additionally, a constant 60 FPS is maintained, which goes a long way in preventing color separation from happening.

若要亲自查看此问题,请在 GitHub 上的 Galaxy 资源管理器代码中查找名为 LSRPlaneModifier.cs 的文件。To check this out yourself, look for a file called LSRPlaneModifier.cs in the Galaxy Explorer code on GitHub.

HoloStudio:带有 UI 焦点的固定内容HoloStudio: Stationary content with a UI focus

在 HoloStudio 中,大多数时候都在查看正在使用的同一模型。In HoloStudio, you spend most of your time looking at the same model you’re working on. 如果你选择一个新工具或要浏览 UI,你的注视不会有很大的影响,因此,我们可以将平面设置逻辑保持简单。Your gaze doesn’t move a significant amount, except for when you select a new tool or want to navigate the UI, so we can keep the plane setting logic simple. 查看 UI 时,平面将设置为您的 "注视" 对齐的任何 UI 元素。When looking at the UI, the plane is set to whatever UI element your gaze snaps to. 查看模型时,平面是一组距离,与您与模型之间的默认距离相对应。When looking at the model, the plane is a set distance away, corresponding with the default distance between you and the model.

"HoloStudio" 中的 "稳定" 平面以用户在 "主页" 按钮上 gazes

HoloTour 和3D 查看器:包含动画和电影的静止内容HoloTour and 3D Viewer: Stationary content with animation and movies

在 HoloTour 和3D 查看器中,您正在查看孤立动画对象或电影,其中添加了三维效果。In HoloTour and 3D Viewer, you’re looking at a solitary animated object or movie with 3D effects added on top of it. 这些应用中的稳定设置为当前正在查看的内容。The stabilization in these apps is set to whatever you’re currently viewing.

HoloTour 还可以让你与你的虚拟世界 straying 得太远,而不是在固定位置继续。HoloTour also prevents you from straying too far from your virtual world by having it move with you instead of staying in a fixed location. 这可以确保你不会从其他影像中获得足够的空间,以便在中进行爬出。This ensures that you won’t get far enough away from other holograms for stability issues to creep in.

在此示例中,HoloTour 为 Hadrian 的 Pantheon 的此电影。

RoboRaid:动态内容和环境交互RoboRaid: Dynamic content and environmental interactions

尽管应用程序需要突然移动,但在 RoboRaid 中设置稳定平面非常简单。Setting the stabilization plane in RoboRaid is surprisingly simple, despite being the app that requires the most sudden movement. 该平面靠近墙壁或周围的对象,并且在离您的距离足够远时,将在您前面固定距离。The plane is geared towards sticking to the walls or the surrounding objects and will float at a fixed distance in front of you when you’re far enough away.

RoboRaid 设计为在设计时考虑到了稳定性。RoboRaid was designed with the stabilization plane in mind. Reticle,它将最大程度地移动,因为它已被锁定,只使用红色和蓝色,这会最大程度地减少任何颜色。The reticle, which moves the most since it’s head-locked, circumvents this by using only red and blue, which minimizes any color bleeding. 它还包含各部分之间的一小部分深度,最大程度地减少了通过使用已预期的视差效果屏蔽的颜色出血。It also contains a small bit of depth between the pieces, minimizing any color bleed that would occur by masking it with an already expected parallax effect. 机器人不会迅速移动,而且会按固定的时间间隔快速移动。The robots don’t move quickly and only travel short distances in regular intervals. 它们的正面往往围绕2米,在默认情况下,会设置稳定。They tend to stay around 2 meters in front of you, where the stabilization is set by default.

片段和年轻人 Conker:包含环境交互的动态内容Fragments and Young Conker: Dynamic content with environmental interaction

用 c + + 中的 Asobo Studio 编写,片段和年轻人 Conker 采用不同的方法来设置 "稳定" 平面。Written by Asobo Studio in C++, Fragments and Young Conker take a different approach to setting the stabilization plane. POI) 的兴趣点 (在代码中定义,并按优先级排序。Points of interest (POI) are defined in code and ordered by priority. Poi 是游戏中的内容,例如年轻人 Conker、菜单、目标 reticle 和徽标中的 Conker 模型。POIs are in-game content, such as the Conker model in Young Conker, menus, the aiming reticle, and logos. Poi 与用户的 "注视" 相交,"平面" 设置为具有最高优先级的对象的中心。The POIs are intersected by the user’s gaze and the plane is set to the center of the object with the highest priority. 如果未发生交集,则将平面设置为默认距离。If no intersection occurs, the plane is set to the default distance.

如果移动到之前已作为播放空间进行了扫描的内容,则片段和年轻人 Conker 还会通过暂停应用程序来设计离全息 straying 太远的位置。Fragments and Young Conker also design around you straying too far from the holograms by pausing the app if you move outside of what’s been previously scanned as your play space. 因此,它们使你能够在提供最稳定的体验的边界内实现。As such, they keep you within the boundaries that are found to provide the most stable experience.

自制Do it yourself

如果你有一个 HoloLens,并想要了解本文中的概念,你可以下载一个测试场景来尝试以下练习。If you have a HoloLens and want to play around with the concepts in this article, you can download a test scene to try out the following exercises. 测试场景使用 Unity 的内置别出心裁 API 来帮助你直观显示你的平面的设置位置。The test scene uses Unity’s built-in gizmo API to help you visualize where your plane is being set. 在此示例中,代码还用于捕获屏幕截图。The code was also used to capture the screenshots in this case study.

  1. 同步最新版本的 MixedRealityToolkitSync the latest version of MixedRealityToolkit-Unity.
  2. 打开 HoloToolkit-Examples/公用事业/场景/StabilizationPlaneSetting 场景。Open the HoloToolkit-Examples/Utilities/Scenes/StabilizationPlaneSetting.unity scene.
  3. 生成并配置生成的项目。Build and configure the generated project.
  4. 在设备上运行。Run on your device.

练习1Exercise 1

你将看到不同方向的几个白点。You'll see several white dots around you at different orientations. 在您之前,您将在不同的深度看到三个点。In front of you, you’ll see three dots at different depths. 点击以更改平面设置为的点。Air tap to change which dot the plane is set to. 对于本练习,在这两个过程中,在 gazing 点时移动空间。For this exercise, and for the other two, move around your space while gazing at the dots. 向左、向右、向上、向下旋转。Turn your head left, right, up, and down. 从点更接近或更远地移动。Move closer to and farther from the dots. 查看稳定性平面设置为不同目标时,如何做出反应。See how they react when the stabilization plane is set to different targets.

练习2Exercise 2

现在,转到右侧,直到看到两个移动点、水平路径上的一个振荡和一个垂直路径上的一个。Now, turn to your right until you see two moving dots, one oscillating on a horizontal path and one on a vertical path. 同样,单击即可更改该平面设置为的点。Once again, air-tap to change which dot the plane is set to. 请注意颜色分离如何减少并显示在连接到平面的点上。Notice how color separation is lessened and appears on the dot that is connected to the plane. 再次点击以在 "平面" 设置函数中使用点的速度。Tap again to use the dot’s velocity in the plane setting function. 此参数向 HoloLens 提供有关对象的预期运动的提示。This parameter gives a hint to HoloLens about the object’s intended motion. 了解何时使用这一点非常重要,因为当在一个圆点上使用了速度时,另一个移动点将显示更大的颜色分隔。It’s important to know when to use this, as you’ll notice when velocity is used on one dot, the other moving dot will show greater color separation. 在设计应用程序时请牢记这一点,这会使对象的运动产生内聚性,从而有助于防止出现项目。Keep this in mind when designing your apps—having a cohesive flow to the motion of your objects can help prevent artifacts from appearing.

练习3Exercise 3

再次转到右侧,直到看到新的点配置。Turn to your right once more until you see a new configuration of dots. 在这种情况下,距离有一个点,其中有一个圆点在其前面加上一个点。In this case, there are dots in the distance and one dot spiraling in and out in front of them. 点击以更改平面设置为的点,在背面的点与运动中的点之间交替。Air tap to change which dot the plane is set to, alternating between the dots in the back and the dot in motion. 请注意,将平面位置与螺旋式点的速度设置为会使项目显示在任何位置。Notice how setting the plane position and the velocity to that of the spiraling dot makes artifacts appear everywhere.

提示Tips

  • 使平面设置逻辑简单。Keep your plane setting logic simple. 如您所见,您不需要使用复杂的平面设置算法来实现沉浸式体验。As you’ve seen, you don’t need complex plane setting algorithms to make an immersive experience. 稳定平面只是一片谜。The stabilization plane is only one piece of the puzzle.
  • 在任何可能的情况下,始终在目标之间平稳移动平面。When at all possible, always move the plane between targets smoothly. 即时切换到远处目标可能会以可视方式中断场景。Instantly switching distant targets can visually disrupt the scene.
  • 请考虑在飞机中设置一个选项,将逻辑锁定到特定目标。Consider having an option in your plane setting logic to lock onto a specific target. 这样一来,就可以根据需要在对象(如徽标或标题屏幕)上锁定平面。That way, you can have the plane locked on an object, such as a logo or title screen, if needed.

关于作者About the author

Picture of Ben Strukus Ben StrukusBen Strukus
软件工程师 @MicrosoftSoftware Engineer @Microsoft

另请参阅See also