ARKit文档(部分翻译)及demo效果展示

ARKit

Integrate iOS device camera and motion features to produce augmented reality experiences in your app or game.
iOS设备集成相机和运动特性产生增强现实体验在你的应用程序或游戏。

Overview
Augmented reality (AR) describes user experiences that add 2D or 3D elements to the live view from a device’s camera in a way that makes those elements appear to inhabit the real world. ARKit combines device motion tracking, camera scene capture, advanced scene processing, and display conveniences to simplify the task of building an AR experience.

增强现实(AR)描述了用户体验,2d或3d元素添加到设备的摄像头的实时视图的方式使这些元素似乎生活在真实的世界。ARKit结合设备运动跟踪,相机镜头捕捉,先进的现场处理,并显示方便简化的任务构建一个基于“增大化现实”技术的经验。

Important
ARKit requires an iOS device with an A9 or later processor.
To make your app available only on devices supporting ARKit, use the arkit key in the UIRequiredDeviceCapabilities section of your app’s Info.plist. If augmented reality is a secondary feature of your app, use the isSupported property to determine whether the current device supports the session configuration you want to use.

ARKit需要一个iOS设备A9之后处理器。让你的应用程序只能在设备支持ARKit,使用ARKit UIRequiredDeviceCapabilities部分的关键应用程序的Info.plist。如果增强现实应用程序是一个次要的特性,使用isSupported属性,以确定当前设备支持会话配置您想要使用。

Topics
First Steps
Understanding Augmented Reality 理解增强现实
Discover concepts, features, and best practices for building great AR experiences.
了解概念,特性,构建基于“增强现实”技术和最佳实践经验。

class ARSession
A shared object that manages the device camera and motion processing needed for augmented reality experiences.
共享对象管理所需的设备相机和运动处理增强现实体验。
(备注:核心类)

Configurations 配置
class ARWorldTrackingConfiguration
A configuration that tracks a device’s orientation and position, and that detects real-world surfaces seen by the device camera.
配置跟踪设备的方向和位置,以及检测设备摄像头看到的现实世界的表面。

class AROrientationTrackingConfiguration
A configuration that tracks only a device’s orientation.
配置跟踪设备的方向。

class ARConfiguration
The abstract base class for AR session configurations.
AR会话配置的抽象基类。

Standard Views
ArticleBuilding a Basic AR Experience
Configure an AR session and use SceneKit or SpriteKit to display AR content.
配置一个AR会话和使用SceneKit或SpriteKit显示基于“增强现实”技术的内容。
(前面的是3d,后面的2d)

class ARSCNView
A view for displaying AR experiences that augment the camera view with 3D SceneKit content.
一个视图来显示基于“增强现实”技术的经验,增强与3d SceneKit相机视图的内容。

class ARSKView
A view for displaying AR experiences that augment the camera view with 2D SpriteKit content.
一个视图来显示基于“增强现实”技术的经验,增强与2d SpriteKit相机视图的内容。

Custom Views
ArticleDisplaying an AR Experience with Metal
Build a custom AR view by rendering camera images and using position-tracking information to display overlay content.
构建一个定制的基于“增强现实”技术的观点通过渲染相机图像和使用位置跟踪信息显示覆盖的内容。

Real-World Objects and Positions
class ARAnchor
A real-world position and orientation that can be used for placing objects in an AR scene.
一个真实的位置和姿态,可用于将对象放置在一个基于“增强现实”技术的游戏场景。

class ARPlaneAnchor
Information about the position and orientation of a real-world flat surface detected in an AR session.
有关位置和姿态信息的实际平面探测到AR会话。

class ARHitTestResult
Information about a real-world surface found by examining a point in the device camera view of an AR session.
发现现实的表面,通过检查设备的相机视图中一个点的AR会话。

Camera and Scene Details
class ARFrame
A video image and position tracking information captured as part of an AR session.
捕获和位置跟踪视频图像信息作为一个AR会话的一部分。

class ARCamera
Information about the camera position and imaging characteristics for a captured video frame in an AR session.
摄像机的位置和成像特征信息捕获视频帧的AR会话。
class ARLightEstimate
Estimated scene lighting information associated with a captured video frame in an AR session.
在一个AR会话中估计场景照明信息关联到一个视频帧捕获。

Renamed

class ARSessionConfigurationclass ARWorldTrackingSessionConfiguration

这两个划掉了。

Beta Software
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.
这个文档包含一个初步的API或技术开发的信息。这些信息有变更,软件实现根据这个文档还会测试最后的操作系统软件。
Learn more about using Apple’s beta software

Class
ARSession
A shared object that manages the device camera and motion processing needed for augmented reality experiences.
共享对象管理所需的设备相机和运动处理增强现实体验。

Overview
An ARSession object coordinates the major processes that ARKit performs on your behalf to create an augmented reality experience. These processes include reading data from the device’s motion sensing hardware, controlling the device’s built-in camera, and performing image analysis on captured camera images. The session synthesizes all of these results to establish a correspondence between the real-world space the device inhabits and a virtual space where you model AR content.
Every AR experience built with ARKit requires a single ARSession object. If you use an
ARSCNView
or
ARSKView
object to easily build the visual part of your AR experience, the view object includes an ARSession instance. If you build your own renderer for AR content, you’ll need to instantiate and maintain an ARSession object yourself.
Running a session requires a session configuration: an instance of the
ARSessionConfiguration
class, or its subclass
ARWorldTrackingSessionConfiguration
. These classes determine how ARKit tracks a device’s position and motion relative to the real world, and thus affect the kinds of AR experiences you can create.

ARSession对象坐标ARKit执行代表你的主要流程创建一个增强现实体验。这些过程包括从设备读取数据的运动传感硬件、控制设备的内置摄像头,对摄像机捕获图像进行图像分析。会话综合所有这些结果之间建立对应关系该设备所栖息的真实世界的空间和虚拟空间模型基于“增大化现实”技术的内容。每个用ARKit构建的基于“增大化现实”技术的经验需要一个ARSession对象。如果你使用一个ARSCNView或ARSKView对象来轻松地构建基于“增大化现实”技术的视觉部分经验,该视图对象包含一个ARSession实例。如果你构建自己的渲染器基于“增大化现实”技术的内容,你需要实例化和维护一个ARSession对象自己。运行一个会话需要会话配置:的一个实例ARSessionConfiguration类,或其子类ARWorldTrackingSessionConfiguration。这些类确定ARKit跟踪设备的位置和运动相对于现实世界,从而影响您可以创建的基于“增大化现实”技术的经验。

ARKit文档链接:https://developer.apple.com/documentation/arkit

官网提供的demo可以感受下:

- (void)viewDidLoad {
    [super viewDidLoad];

    // Set the view's delegate
    self.sceneView.delegate = self;

    // Show statistics such as fps and timing information
    self.sceneView.showsStatistics = YES;

    // Create a new scene
    SCNScene *scene = [SCNScene sceneNamed:@"art.scnassets/ship.scn"];

    // Set the scene to the view
    self.sceneView.scene = scene;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    // Create a session configuration
    ARWorldTrackingSessionConfiguration *configuration = [ARWorldTrackingSessionConfiguration new];

    // Run the view's session
    [self.sceneView.session runWithConfiguration:configuration];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    // Pause the view's session
    [self.sceneView.session pause];
}

看,灰机✈️

猜你喜欢

转载自blog.csdn.net/ScarlettZhao0602/article/details/76926975
今日推荐