Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ARKit 2.0

Tachibana Kaoru
June 11, 2018
720

ARKit 2.0

Tachibana Kaoru

June 11, 2018
Tweet

Transcript

  1. What is ARKit? iOS11~ Device with A9 chip~ SceneKit or

    SpriteKit or Metal Unity ARKit Plugin
  2. ARKit capable devices Phone X iPhone 8, iPhone 8 Plus

    iPhone 7, iPhone 7 Plus iPhone 6s, iPhone 6s Plus iPhone SE iPad Pro (all models) iPad (5th generation)
  3. AR Configuration Mode Camera iOS Device AROrientationTracking Back Camera iOS

    11.0+ ARKit Capable Devices ARWorldTracking Back Camera iOS 11.0+ ARKit Capable Devices ARFaceTracking Front Camera iOS 11.0+ Only iPhone X ARImageTracking Back Camera iOS 12.0+ ARKit Capable Devices ARObjectScanning Back Camera iOS 12.0+ ARKit Capable Devices
  4. USDZ on iOS12 Check USDZ files on “AR Quick Look

    Gallery” https://developer.apple.com/arkit/gallery/
  5. USDZ with QuickLook import QuickLook class ViewController: UIViewController { override

    func viewDidLoad() { super.viewDidLoad() } // Call Here to show QuickLook Preview Controller!! @IBAction func showQuickLook(_ sender: Any) { let quickViewCon = QLPreviewController() quickViewCon.dataSource = self self.present(quickViewCon, animated: true, completion: nil) } }
  6. USDZ with QuickLook extension ViewController: QLPreviewControllerDataSource { func numberOfPreviewItems(in controller:

    QLPreviewController) -> Int{ return 1 } func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem{ return MyARItem() } } class MyARItem: NSObject, QLPreviewItem{ var previewItemURL: URL? { return Bundle.main.url(forResource: "coffee", withExtension: "usdz") } }
  7. AR Configuration Mode Camera iOS Device AROrientationTracking Back Camera iOS

    11.0+ ARKit Capable Devices ARWorldTracking Back Camera iOS 11.0+ ARKit Capable Devices ARFaceTracking Front Camera iOS 11.0+ Only iPhone X ARImageTracking Back Camera iOS 12.0+ ARKit Capable Devices ARObjectScanning Back Camera iOS 12.0+ ARKit Capable Devices
  8. AR Configuration Mode Camera iOS Device AROrientationTracking Back Camera iOS

    11.0+ ARKit Capable Devices ARWorldTracking Back Camera iOS 11.0+ ARKit Capable Devices ARFaceTracking Front Camera iOS 11.0+ Only iPhone X ARImageTracking Back Camera iOS 12.0+ ARKit Capable Devices ARObjectScanning Back Camera iOS 12.0+ ARKit Capable Devices
  9. run(_ configuration) Basics of ARKit Recap ARConfiguration ARFrame ARFrame ARFrame

    CMMotionManager AVCaptureSession currentFrame ARSession
  10. Behind the Scenes—Inertial Odometry Motion sensor Image ARFrame Motion +

    Motion + Time Image ARFrame Motion + Image ARFrame Motion + Image ARFrame Motion + Motion + Image ARFrame Motion + Motion +
  11. Orientation Tracking API AROrientationTrackingConfiguration open class ARCamera : NSObject, NSCopying

    { open var transform: simd_float4x4 { get } open var eulerAngles: simd_float3 { get } … } AROrientationTrackingConfiguration
  12. Behind the Scenes—Visual Inertial Odometry Motion data and computer vision

    Image ARFrame Motion + Image ARFrame Motion + Image ARFrame Motion + Image ARFrame Motion CV Image ARFrame Motion CV Time 1 m
  13. What is “share AR?” “share AR” means share World tracking

    information and 3D models Use ARWorldMap class
  14. Share the World Map // Retrieve world map from ARSession

    session.getCurrentWorldMap { worldMap, error in guard let worldMap = worldMap else { showAlert(error) return } // Serialize let data = try NSKeyedArchiver.archivedData(withRootObject: worldMap, requiringSecureCoding: true) }
  15. Relocalize to World Map Setup configuration // Receive / Load

    world map let worldMap : ARWorldMap = ... // Create a session configuration let configuration = ARWorldTrackingConfiguration() configuration.initialWorldMap = worldMap // Run the session session.run(configuration) W
  16. How to use ARReferenceObject? Scanning and Detecting 3D Objects αϯϓϧΛ࢖ͬͯɺ

    ARReferenceObjectΛεΩϟϯɻΤΫεϙʔτͯ͠ɺ*.arobjectΛऔಘɻ XcodeͰɺARͷ৽نϓϩδΣΫτΛ࡞੒͠ɺAsset CatalogʹAR Resource GroupΛ࡞Γɺ͜ͷϑΝΠϧΛDrag&Dropɻ
  17. Prepare for Scan override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated)

    let configuration = ARWorldTrackingConfiguration() configuration.detectionObjects = ARReferenceObject.referenceObjects(inGroupNamed: "apple", bundle: nil)! sceneView.session.run(configuration) } }
  18. Detection of Object func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode,

    for anchor: ARAnchor) { if let objectAnchor = anchor as? ARObjectAnchor{ let foundObject = objectAnchor.referenceObject // check name" let objectname = foundObject.name // do something to the object! objectAnchor.addTitleNode(on: node) } }
  19. ARObjectScanningConfiguration ARObjectScanningConfiguration is for use only in development scenarios. High-fidelity

    spatial mapping has a high performance and energy cost, and disables ARKit features not necessary for reference object scanning. To produce AR experiences for end users, use ARWorldTrackingConfiguration. Appleͱͯ͠͸ɺObject ScanϞʔυ͸ɺ։ൃϑΣʔζͰ࢖͏΋ͷͱ૝ఆ͠ ͍ͯΔΑ͏Ͱ͢ɻ ։ൃऀ͕ಛఆͷΦϒδΣΫτΛScan͠ɺͦ͜Ͱநग़ͨ͠ ARReferenceObjectΛΞϓϦʹ͍ΕͯϦϦʔεɻ