Discover supporting concepts, features, and best practices for building great AR experiences.
为了构建好的AR体验,发现支持的概念,特征和好的例子.
Overview
总栏
Figure 1
场景1
The basic requirement for any AR experience—and the defining feature of ARKit—is the ability to create and track a correspondence between the real-world space the user inhabits and a virtual spaceconventionwhere you can model visual content.
- 体验任何AR所需要的基本需求和ARKit已确定的特性是创建基本的AR模型和追踪模型和用户行为的基础.
When your app displays that content together with a live camera image, the user experiences augmented reality: the illusion that your virtual content is part of the real world.
- 当你的app把摄像头和用户自己的东西一起显示,就会产生你虚拟的东西是现实世界的一部分的错觉,.
In all AR experiences, ARKit uses world and camera coordinate systems following a right-handed convention: the y-axis points upward, and (when relevant) the z-axis points toward the viewer and the x-axis points toward the viewer's right.
- 在所有的AR体验中,ARKit使用的显示世界和摄像头的坐标系遵循右手定则:y轴向上,
z轴直线观察者,x轴指向观察者的右侧
Session configurations can change the origin and orientation of the coordinate system with respect to the real world (see worldAlignment).
- 原始的坐标和方向是遵从现实世界的,可以通过会话配置更改,(参考 worldAlignment).
Each anchor in an AR session defines its own local coordinate system, also following the right-handed, z-towards-viewer convention; for example, the ARFaceAnchor class defines a system for locating facial features..
-每个在AR会话中的锚点都遵循它自己的坐标系统,并且准守右手定制和z轴指向观察者的惯例,例如ARFaceAnchor 就是一个定义面部特征的类.
- How World Tracking Works
现实追踪如何工作
To create a correspondence between real and virtual spaces, ARKit uses a technique called visual-inertial odometry.
- ARKit 使用一项视觉惯性测试的技术来创建现实世界和虚拟空间的对应.
This process combines information from the iOS device’s motion sensing hardware with computer vision analysis of the scene visible to the device’s camera.
-进程采集iOS运动传感器硬件和从设备摄像图采集的影像做分析.
ARKit recognizes notable features in the scene image, tracks differences in the positions of those features across video frames, and compares that information with motion sensing data.
- ARKit能识别图像中的显著特征,识别视频每帧中这些特征的不同,并且把这些信息和运动传感器数据比较.
The result is a high-precision model of the device’s position and motion.
-结果是一个高精度的位置和运动的模型
World tracking also analyzes and understands the contents of a scene.
-现实追踪也分析和理解场景中的内容.
Use hit-testing methods (see the ARHitTestResult class) to find real-world surfaces corresponding to a point in the camera image.
-使用击中测试方法可以找到显示世界的面对应相机照片上的一个点.
If you enable the [planeDetection](apple-reference documentation://hswVcas8JL) setting in your session configuration, ARKit detects flat surfaces in the camera image and reports their position and sizes.
- 如果你在会话配置中打开planeDetection设置,ARKit就会检测相机影像里面的平面表面并输出他们的位置和尺寸.
You can use hit-test results or detected planes to place or interact with virtual content in your scene.
-你可以使用击中测试结果或检测平面或者和场景的虚拟内容交互.
- Best Practices and Limitations
- 练习和局限性
World tracking is an inexact science.
- 现实追踪是一个不精确的科学.
This process can often produce impressive accuracy, leading to realistic AR experiences.
-可以经常产生印象深刻的现实AR的体验.
However, it relies on details of the device’s physical environment that are not always consistent or are difficult to measure in real time without some degree of error.
-然后,它依赖于设置的物理环境并不是一直可靠的,或很困难测试和真实情况的一个错误的程度.
To build high-quality AR experiences, be aware of these caveats and tips.
-为了构建高质量的AR体验,记住这些注意事项和提示.
Design AR experiences for predictable lighting conditions.
-为不同灯光条件设计AR体验.
World tracking involves image analysis, which requires a clear image.
-现实追踪涉及图像分析,且需要一个清晰的图像.
Tracking quality is reduced when the camera can’t see details, such as when the camera is pointed at a blank wall or the scene is too dark.
-当摄像头拍不清楚时,例如摄像头指向一个黑色的墙或者场景太黑,追踪的质量就会降低.
Use tracking quality information to provide user feedback.
-使用追踪质量信息来提供用户反馈
World tracking correlates image analysis with device motion.
-现实追踪把设备运动关联到图像分析
ARKit develops a better understanding of the scene if the device is moving, even if the device moves only subtly.
-ARKit对设备在移动/甚至巧妙的场景开发出一个更好的理解.
Excessive motion—too far, too fast, or shaking too vigorously—results in a blurred image or too much distance for tracking features between video frames, reducing tracking quality.
- 过多的运动例如太远/太快/晃的太大力会导致模糊的影像,两视频帧之前距离太远也会降低追踪质量.
The ARCamera class provides tracking state reason information, which you can use to develop UI that tells a user how to resolve low-quality tracking situations.
-ARCamera类提供是追踪状态的原因信息,可以用在界面上显示帮助用户知道怎么解决低质量的追踪状态.
Allow time for plane detection to produce clear results, and disable plane detection when you have the results you need.
-允许一定时间检测平面来生产清晰的结果,并且获得到你想要的结果后可以关闭平面检测.
Plane detection results vary over time—when a plane is first detected, its position and extent may be inaccurate.
-平面检测有时会变化的,当首次检测平面时,它的位置和扩展可能不准确
As the plane remains in the scene over time, ARKit refines its estimate of position and extent.
-随着时间的推移平面一直存在,ARKit会估算位置和扩展.
When a large flat surface is in the scene, ARKit may continue changing the plane anchor’s position, extent, and transform after you’ve already used the plane to place content.
-当场景中有一个大的平面表现,ARKit会在你已经使用的平面放在内容后也会更改平面锚点的位置/扩展/方向.