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];
}

看,灰機✈️

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章