ARKit Intro - juniverse1103/ARKitStudy GitHub Wiki

ARKit

Overview

  • ARWorldTrackingConfiguration ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ˜„์‹ค ์„ธ๊ณ„๋ฅผ ๋ฐ˜์˜ํ•œ ARKit map ์„ ์ œ๊ณตํ•˜์—ฌ ๊ฐ€์ƒ์˜ ์ฝ˜ํ…์ธ ๋ฅผ ๋ฐฐ์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  • ์‹ค์ œ ์กฐ๋ช… ํ™˜๊ฒฝ์— ๋Œ€์‘ํ•˜๋Š” ๊ฐœ์ฒด์™€ ์ด๋ฏธ์ง€ ์ธ์‹์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • iPhoneX ์—์„œ ARFaceTrackingConfiguration์€ ์ „๋ฉด ์นด๋ฉ”๋ผ์™€ TrueDepth ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์–ผ๊ตด์— ๋Œ€ํ•œ ์‹ค์‹œ๊ฐ„ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
  • ์นด๋ฉ”๋ผ ๋ทฐ๋ฅผ ์ƒ๋žตํ•˜๊ณ , ์–ผ๊ตด ํ‘œํ˜„ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์™€ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (ARSession ์ฐธ๊ณ )
  • ๊ธฐ๋ณธ์ ์œผ๋กœ world coordinate ๊ณต๊ฐ„์—์„œ ARKit์€ ํ•ญ์ƒ ์˜ค๋ฅธ์† ์ขŒํ‘œ๊ณ„๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

Index


ARConfiguration

Overview
  • iOS 11.0 +

  • ARSession ๊ตฌ์„ฑ์˜ ์ถ”์ƒ ๊ธฐ๋ณธ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.

  • worldAlignment : session ๊ณผ real-world์˜ ๋””๋ฐ”์ด์Šค์˜ ๋™์ž‘์„ scene์ขŒํ‘œ๊ณ„์— ๋งคํ•‘ํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

    • gravity

      world๋ฅผ ์ค‘๋ ฅ์— ๋งž์ถฐ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค. (0, -1, 0)

      ์›์ ์€ device์˜ ์ดˆ๊ธฐ ์œ„์น˜๋กœ ์ง€์ •๋œ๋‹ค.

    • gravityAndHeading

      world๋ฅผ ์ค‘๋ ฅ์— ๋งž์ถฐ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.(0, -1, 0)

      ๊ทธ๋ฆฌ๊ณ  ๋ถ์ชฝ (์ •๋ถ) ๋ฐฉํ–ฅ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. (0, 0, -1)

      Location Service์ด ์‚ฌ์šฉ๊ฐ€๋Šฅํ•ด์•ผ ํ•œ๋‹ค.

      ์›์ ์€ device์˜ ์ดˆ๊ธฐ ์œ„์น˜๋กœ ์ง€์ •๋œ๋‹ค.

    • camera

      world๋ฅผ ์นด๋ฉ”๋ผ์˜ ๋ฐฉํ–ฅ์— ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.

      ์ขŒํ‘œ๊ณ„๋Š” ์นด๋ฉ”๋ผ์˜ ์œ„์น˜์— ๊ณ ์ •๋œ๋‹ค.

  • isLightEstimationEnabled : light estimation ์‹คํ–‰ ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

ARWorldTrackingConfiguration
  • iOS 11.0 +
  • ํ›„๋ฉด ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • device์˜ ๋ฐฉํ–ฅ๊ณผ ์œ„์น˜, ์‹ค์ œ ์„ธ์ƒ์˜ ํ‘œ๋ฉด, ์•Œ๋ ค์ง„ ์ด๋ฏธ์ง€์™€ ๋ฌผ์ฒด ๋“ฑ์„ ๊ฐ์ง€ํ•ฉ๋‹ˆ๋‹ค.
AROrientationTrackingConfiguration
  • iOS 11.0 +
  • ํ›„๋ฉด ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ๋””๋ฐ”์ด์Šค์˜ ๋ฐฉํ–ฅ์„ ์ถ”์ ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
ARImageTrackingConfiguration
  • iOS 12.0 + (beta)
  • ํ›„๋ฉด ์นด๋ฉ”๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • running image๋ฅผ ์ถ”์ ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • 6๋ฐฉํ–ฅ์˜ ๊ฐ๋„๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
  • ARWorldTrackingConfiguration ๋˜ํ•œ ์ด๋ฏธ์ง€ ์ถ”์ ์ด ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ARImageTrackingConfiguration์€ ์ด๋ฏธ์ง€๋งŒ ์ถ”์ ํ•˜๊ธฐ์— ์„ฑ๋Šฅ์ด ๋” ์ข‹์Šต๋‹ˆ๋‹ค.
ARFaceTrackingConfiguration
  • iOS 11.0 +

  • ์ „๋ฉด ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

  • FaceTracking์€ TrueDepth ์นด๋ฉ”๋ผ๊ฐ€ ์žˆ๋Š” iOS์žฅ์น˜์—์„œ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. (ํ˜ธํ™˜์„ฑ ์ฐธ์กฐ)

  • isSupported ํ”„๋กœํผํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•ด ํ˜„์žฌ ๋””๋ฐ”์ด์Šค์—์„œ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ์ง€ ์—ฌ๋ถ€๋ฅผ ์•Œ ์ˆ˜์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋”ฐ๋กœ ๋ฉ”์†Œ๋“œ๋‚˜ ์†์„ฑ์„ ์ œ๊ณตํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค,.

  • ์ธ์‹๋œ ์–ผ๊ตด์€ session์— ARFaceAnchor ๊ฐ์ฒด๋กœ ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค.

  • lightEstimaion ์ด ํ™œ์„ฑํ™” ๋˜๋ฉด ์ธ์‹๋œ ์–ผ๊ตด์€ light probe ๋กœ ์ทจ๊ธ‰๋˜๊ณ  incoming light ์˜ ๋ฐฉํ–ฅ์„ ๊ณ„์‚ฐํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

    ์ด๋Š” ์‚ฌ์šฉ์ž์˜ ์–ผ๊ตด ์œ„์— ์˜ค๋ฒ„๋ ˆ์ด ๊ทธ๋ž˜ํ”ฝ์„ ๋žœ๋”๋ง ํ•  ๋•Œ ํ•ด๋‹น ๊ทธ๋ž˜ํ”ฝ์„ ์นด๋ฉ”๋ผ๊ฐ€ ์บก์ณํ•œ ์กฐ๋ช… ์กฐ๊ฑด์„ ๋งž์ถฐ ๋ Œ๋”๋ง ํ•ด์ค๋‹ˆ๋‹ค.

  • ์–ผ๊ตด ์ธ์‹ ๋ฐ ์–ผ๊ตด ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉ์ž์—๊ฒŒ ์„ค๋ช…ํ•˜๋Š” ๊ฐœ์ธ ์ •๋ณด ์ทจ๊ธ‰ ๋ฐฉ์นจ์ด ํฌํ•จ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

ARObjectScanningConfiguration
  • iOS 12.0 + (beta)
  • ํ›„๋ฉด ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • world์— ์žˆ๋Š” object๋ฅผ ์Šค์บ”ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • session์—์„œ createReferenceObject ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ object๋ฅผ ์Šค์บ”ํ•ฉ๋‹ˆ๋‹ค
  • ๊ฐœ๋ฐœ ๊ณผ์ •์—์„œ๋งŒ ์‚ฌ์šฉ์„ ๊ถŒ์žฅ. ๋†’์€ ์„ฑ๋Šฅ๊ณผ ์—๋„ˆ์ง€๋ฅผ ์†Œ๋ชจ๋ผ๋ฉฐ, object ์Šค์บ๋‹์— ํ•„์š”ํ•˜์ง€ ์•Š์€ ARKit ๊ธฐ๋Šฅ์„ ๋น„ํ™ฉ์„ฑํ™” ์‹œํ‚ต๋‹ˆ๋‹ค.
  • ์ตœ์ข…์‚ฌ์šฉ์ž์—๊ฒŒ ARํ™˜๊ฒฝ์„ ์ œ๊ณตํ•˜๋ ค๋ฉด ARWorldTrackingConfiguration ์‚ฌ์šฉ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.

ARSession

Overview
  • iOS 11.0+
  • ARSession ๊ฐ์ฒด๋Š” ์ฆ๊ฐ•ํ˜„์‹ค์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ARKit์ด ์ˆ˜ํ–‰ํ•˜๋Š” ์ฃผ์š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์กฐ์ •ํ•œํ•ฉ๋‹ˆ๋‹ค.
  • ๋””๋ฐ”์ด์Šค์˜ ๋ชจ์…˜๊ฐ์ง€(HW ์„ผ์„œ), ๋‚ด์žฅ ์นด๋ฉ”๋ผ ์ปจํŠธ๋กค, ์นด๋ฉ”๋ผ์—์„œ ์บก์ณ๋œ ์ด๋ฏธ์ง€๋ถ„์„ ๋“ฑ์˜ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ •๋ณด๋“ค์„ ์ข…ํ•ฉํ•˜์—ฌ AR content๋ฅผ ๋ชจ๋ธ๋งํ•˜๋Š” ๊ฐ€์ƒ๊ณต๊ฐ„๊ณผ real-world ์„ ์ผ์น˜์‹œํ‚ต๋‹ˆ๋‹ค.
  • ๋‹จ์ผ ARSession๊ฐ์ฒด๋ฅผ ์‚ฌํ•ฉ๋‹ˆ๋‹ค.
  • ARSCNView ๋‚˜ ARSKView ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์‰ฝ๊ฒŒ ARํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.View๊ฐ์ฒด์—๋Š” ARSession ์ธ์Šคํ„ด์Šค๊ฐ€ ํฌํ•จ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ง์ ‘ ๋ Œ๋”๋Ÿฌ๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค๋ฉด ARSession๊ฐ์ฒด๋ฅผ ์ง์ ‘ ์ธ์Šคํ„ด์Šคํ™” ํ•˜๊ณ  ์œ ์ง€๊ด€๋ฆฌ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.
  • ์„ธ์…˜ ์‹คํ–‰์—๋Š” ARConfiguration ์ด ํ•„์š”ํ•˜๊ณ , ์ด๋Š” real-world์— ๋””๋ฐ”์ด์Šค์˜ ์ƒ๋Œ€์ •์ธ ์œ„์น˜๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๋ฐฉ์‹์„ ์ •ํ•ด์ค๋‹ˆ๋‹ค.
Session ๊ตฌ์„ฑ๊ณผ ์‹คํ–‰
  • ์‹คํ–‰

    • configuration : ์„ธ์…˜์˜ ๋™์ž‘๊ณผ scene ์ถ”์  ๋™์ž‘์„ ์ •์˜ํ•˜๋Š” ์ธ์Šคํ„ด์Šค ์ž…๋‹ˆ๋‹ค.
    • option : configuration์ด ๋ฐ”๋€”๋•Œ ARSession์˜ ํ˜„์žฌ ์ƒํƒœ๋ฅผ ์–ด๋–ป๊ฒŒ ๋ฐ”๊ฟ€์ง€ ์ •์˜ํ•ด์ค๋‹ˆ๋‹ค.
  • func run(ARConfiguration, optionds: ARSession.RunOptions = [])
    
  • ์ผ์‹œ์ค‘์ง€

  • func pause()
    
  • Responding and Update


ARSessionDelegate

Overview
  • ARSessionObserver ํ”„๋กœํ† ์ฝœ์„ ํ™•์žฅํ•ฉ๋‹ˆ๋‹ค.
  • ์บก์ณ๋œ ๋น„๋””์˜ค ํ”„๋ ˆ์ž„ ์ด๋ฏธ์ง€์™€ ARSession์—์„œ์˜ ํŠธ๋ž˜ํ‚น ์ƒํƒœ๋ฅผ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค.
  • ARSessionDelegate, ARSCNViewDelegate, ARSKViewDelegate protocol์— ๊ณตํ†ต์ ์œผ๋กœ ๋ฉ”์†Œ๋“œ๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
  • Session์—์„œ ์บก์ณ๋œ ARFrame ๊ฐ์ œ๋กœ ์ž‘์—…์„ ํ•˜๊ฑฐ๋‚˜ ARAcnhor ๊ฐ์ฒด๋“ค์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ ์ด ํ”„๋กœํ† ์ฝœ์„ ๊ตฌํ˜„ํ•˜์—ฌ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
Method Signature
  • Receiving Camera Frames

  • func session(ARSession, didUpdate: ARFrame)
    
  • Handling Contents Updates

  • func session(ARSession, didAdd: [ARAnchor])
    // 1๊ฐœ๋˜๋Š” ๊ทธ์ด์ƒ์˜ anchor๊ฐ€ session์— ์ถ”๊ฐ€๋˜๋Š” ์ด๋ฒคํŠธ ๊ฐ์ง€ํ•ด delegate์— ์•Œ๋ฆผ
    
    func session(ARSession, didUpdate: [ARAnchor])
    // session์— ์†ํ•œ 1๊ฐœ๋˜๋Š” ๊ทธ์ด์ƒ์˜ anchor๊ฐ€ ์—…๋ฐ์ดํŠธ๋˜๋Š” ์ด๋ฒคํŠธ ๊ฐ์ง€ํ•ด delegate์— ์•Œ๋ฆผ
    
    func session(ARSession, didRemove: [ARAnchor])
    // 1๊ฐœ๋˜๋Š” ๊ทธ์ด์ƒ์˜ anchor๊ฐ€ sesssion์—์„œ ์ œ๊ฑฐ๋˜๋Š” ์ด๋ฒคํŠธ ๊ฐ์ง€ํ•ด delegate์— ์•Œ๋ฆผ
    

ARSessionObserver

Overview
  • ARSession์˜ ์ƒํƒœ๋ณ€ํ™”์— ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌํ˜„ํ•˜๋Š” ๋ฉ”์†Œ๋“œ์ž…๋‹ˆ๋‹ค.
Method Signature
  • Responding to Tracking Quality Changes

  • func session(ARSession, cameraDidChangeTrackingState: ARCamera)
    // FaceAnchor ๊ฐ์ง€ ๋“ฑ ๊ฐ์ฒด ์ถ”์  ์ƒํƒœ ๋ณ€ํ™”๊ฐ์ง€
    
  • Handling Interruptions

  • func sessionWasInterrupted(ARSession)
    // session์— ๋ฐœ์ƒํ•œ ์ธํ„ฐ๋ŸฝํŠธ๋ฅผ ๊ฐ์ง€ํ•ด delegate์— ์•Œ๋ฆผ
    
    func sessionInterruptionEnded(ARSession)
    // session์˜ resume์„ ๊ฐ์ง€ํ•ด delegate์— ์•Œ๋ฆผ
    
    func sessionShouldAttemptRelocalization(ARSession) -> Bool
    // ์ธํ„ฐ๋ŸฝํŠธ ์ดํ›„ world-tracking ์ƒํƒœ๋ณต๊ตฌ ์—ฌ๋ถ€๋ฅผ delegate์—๊ฒŒ ๋ฌผ์–ด๋ด„
    
  • Receiving Audio Data

  • func session(ARSession, didOutputAudioSampleBuffer: CMSampleBuffer)
    // ์ƒˆ๋กœ์šด audio sample buffer ๊ฐ€ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•ด์กŒ์Œ์„ delegate์— ์•Œ๋ฆผ
    // ๊ณต๊ฐ„์ƒ์˜ ํŠน์ • ์œ„์น˜์— ์˜ค๋””์˜ค๊ฐ€ ๋ฐฐ์น˜๋œ ์ƒํ™ฉ์—์„œ, ํ•ด๋‹น ์‚ฌ์šด๋“œ๊ฐ€ ๋“ค์–ด์˜ค๊ฒŒ ๋˜๋Š” ์ƒํƒœ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.
    
  • Handling Session Failure

  • func session(ARSession, didFailWithError: Error)
    // session์˜ ์‹คํ–‰์˜ ์‹คํŒจ๋ฅผ delegate์— ์•Œ๋ฆผ
    

ARSCNViewDelegate

Overview
  • ARSession ์—์„œ SceneKit ์ปจํ…์ธ ์˜ ๋™๊ธฐํ™”๋ฅผ ์ค‘๊ณ„ํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌํ˜„ํ•˜๋Š” ๋ฉ”์†Œ๋“œ์ž…๋‹ˆ๋‹ค.
Method Signature
  • Handling Contents Updates

  • func renderer(SCNSceneRenderer, nodeFor: ARAnchor) -> SCNNode?
    //Asks the delegate to provide a SceneKit node corresponding to a newly added anchor.
    
    func renderer(SCNSceneRenderer, didAdd: SCNNode, for: ARAnchor)
    //Tells the delegate that a SceneKit node corresponding to a new AR anchor has been added to the scene.
    
    func renderer(SCNSceneRenderer, willUpdate: SCNNode, for: ARAnchor)
    //Tells the delegate that a SceneKit node's properties will be updated to match the current state of its corresponding anchor.
    
    func renderer(SCNSceneRenderer, didUpdate: SCNNode, for: ARAnchor)
    //Tells the delegate that a SceneKit node's properties have been updated to match the current state of its corresponding anchor.
    
    func renderer(SCNSceneRenderer, didRemove: SCNNode, for: ARAnchor)
    //Tells the delegate that the SceneKit node corresponding to a removed AR anchor has been removed from the scene.
    

ARSSKViewDelegate

Overview
  • ARSession ์—์„œ SpriteKit ์ปจํ…์ธ ์˜ ๋™๊ธฐํ™”๋ฅผ ์ค‘๊ณ„ํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌํ˜„ํ•˜๋Š” ๋ฉ”์†Œ๋“œ์ž…๋‹ˆ๋‹ค.
Method Signature
  • Handling Contents Updates

  • func view(ARSKView, nodeFor: ARAnchor) -> SKNode?
    //Asks the delegate to provide a SpriteKit node corresponding to a newly added anchor.
    
    func view(ARSKView, didAdd: SKNode, for: ARAnchor)
    //Tells the delegate that a SpriteKit node corresponding to a new AR anchor has been added to the scene.
    
    func view(ARSKView, willUpdate: SKNode, for: ARAnchor)
    //Tells the delegate that a SpriteKit node's properties will be updated to match the current state of its corresponding anchor.
    
    func view(ARSKView, didUpdate: SKNode, for: ARAnchor)
    //Tells the delegate that a SpriteKit node's properties have been updated to match the current state of its corresponding anchor.
    
    func view(ARSKView, didRemove: SKNode, for: ARAnchor)
    //Tells the delegate that the SpriteKit node corresponding to an AR anchor has been removed from the scene.
    

ARAnchor

Overview
  • iOS 11.0 +
  • AR scene์— ๋ฐฐ์น˜ ๊ฐ€๋Šฅํ•œ real-world์˜ ์œ„์น˜ํ™” ๋ฐฉํ–ฅ์ž…๋‹ˆ๋‹ค.
  • ARAnchor๋Š” ํŠน์ • ํ”„๋ ˆ์ž„์—์„œ Anchor์˜ ํ˜„์žฌ ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” immutable ํ•œ ๊ฐ์ฒด์ž…๋‹ˆ๋‹ค.

ARFaceAnchor

Overview
  • iOS 11.0+
  • pose, topology, expression of face ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๊ฐ€์ง€๊ณ ์žˆ์Šต๋‹ˆ๋‹ค.
  • face-tracking AR session์€ ์‹คํ–‰ํ•˜๋ฉด ์ „๋ฉด ์นด๋ฉ”๋ผ์—์„œ ์ธ์‹๋œ ์‚ฌ์šฉ์ž์˜ ARFaceAnchor๋“ค์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ๊ฐ๊ฐ์˜ FaceAnchor ๋“ค์€ ์–ผ๊ตด์˜ ํ˜„์žฌ ์œ„์น˜, ๋ฐฉํ–ฅ, topology(๋ง๊ตฌ์„ฑ๋ฐฉ์‹), ํ‘œ์ • ์ •๋ณด๋ฅผ ๊ฐ€์ง€๊ณ ์žˆ์Šต๋‹ˆ๋‹ค.
์–ผ๊ตด์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ
  • ์ƒ์†๋œ transform ํ”„๋กœํผํ‹ฐ๋Š” world coordinate ์—์„œ์˜ ์–ผ๊ตด์˜ ํ˜„์žฌ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ์ด๋Š” ARConfiguration ์˜ worldAlignment ์— ๋งž์›Œ ์ง€์ •๋ฉ๋‹ˆ๋‹ค.
  • ์ด transform ๋งคํŠธ๋ฆญ์Šค๋Š” ๋‹ค๋ฅธ ์š”์†Œ๋“ค์ด ์–ผ๊ตด์˜ ์œ„์น˜์— ๋”ฐ๋ผ ์ƒ๋Œ€์ ์ธ ์œ„์น˜์— ์กด์žฌํ•˜๊ฒŒ ๋˜๋Š” ์–ผ๊ตด ์ขŒํ‘œ๊ณ„๋ฅผ ๋งŒ๋“ค์–ด์ค๋‹ˆ๋‹ค.
Topology
  • ARFaceGeomerty ์˜ค๋ธŒ์ ํŠธ์ธ geometry ํ”„๋กœํผํ‹ฐ๋Š” ์–ผ๊ตด์˜ ์ž์„ธํ•œ topology์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
Face Expression
  • blendShapes ํ”„๋กœํผํ‹ฐ๋Š” ํ˜„์žฌ ํ‘œ์ •์˜ ํ‘œํ˜„์— ๋Œ€ํ•œ ๋ชจ๋ธ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
Properties (eyeTransform, lookAtPoint)
  • rightEyeTransform / leftEyeTransform
    • iOS 12.0 + (beta)
    • ์–ผ๊ตด์˜ ์˜ค๋ฅธ์ชฝ/์™ผ์ชฝ ๋ˆˆ์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ๋‚˜ํƒ€๋‚ด๋Š” ๋ณ€ํ™˜ํ–‰๋ ฌ์ž…๋‹ˆ๋‹ค.
    • ์•ต์ปค์˜ ๋ณ€ํ˜•์— ์˜ํ•ด ๋ณ€ํ™˜๋˜๋Š” ์ƒ๋Œ€์ ์ธ ์•ˆ๊ตฌ์˜ ์œ„์น˜๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. (FaceAnchor์— ์ข…์†์ )
    • z์ถ•์˜ + ๋ฐฉํ–ฅ์€ ์•ˆ๊ตฌ์˜ ๋ฐฉํ–ฅ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
    • ํ–‰๋ ฌ์˜ ํšŒ์ „๊ฐ์€ x์ถ•(์œ„์•„๋ž˜)๊ณผ y์ถ•(์ขŒ์šฐ)์„ ์ค‘์‹ฌ์œผ๋กœ ํšŒ์ „ํ•˜๋ฉฐ, z์ถ•์„ ์ค‘์‹ฌ์œผ๋กœ๋Š” ํšŒ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • lookAtPoint
    • iOS 12.0 + (beta)
    • ์–ผ๊ตด์ขŒํ‘œ๊ณ„์—์„œ FaceAnchor๊ฐ€ ๋ฐ”๋ผ๋ณด๋Š” ๋ฐฉํ–ฅ์˜ ์ถ”์ •์น˜์ž…๋‹ˆ๋‹ค.
    • ์ด ๋ฒกํ„ฐ๋Š” rightEyeTransform๊ณผ leftEyeTransform ํ–‰๋ ฌ์—์„œ ์ถ”์ƒํ™”๋˜์–ด ์–ผ๊ตด์„ ๊ธฐ์ค€์œผ๋กœ ์‚ฌ์šฉ์ž์˜ ๋ˆˆ์ด ์–ด๋А๊ณณ์„ ๋ฐ”๋ผ๋ณด๋Š”์ง€ ์ถ”์ •ํ•ฉ๋‹ˆ๋‹ค.
    • ์‚ฌ์šฉ์ž์˜ ์™ผ์ชฝ์ด x+ ์ž…๋‹ˆ๋‹ค.
    • ์‚ฌ์šฉ์ž์˜ ๋ˆˆ์ด ๊ฐ€๊นŒ์šด ๋ฌผ์ฒด์— ์ดˆ์ ์„ ๋งž์ถ”๋ฉด ๋ฒกํ„ฐ์˜ ๊ธธ์ด๊ฐ€ ์งง์•„์ง‘๋‹ˆ๋‹ค. (๋จผ ๋ฌผ์ฒด์— ์ดˆ์ ์„ ๋งž์ถ”๋ฉด ๊ธธ์–ด์ง‘๋‹ˆ๋‹ค.)

ARHitTestResult

Overview
  • iOS 11.0 +

  • ARSession ์˜ device camera view์˜ ์ ์„ ๊ณ„์‚ฐํ•˜์—ฌ real-world์˜ ํ‘œ๋ฉด ์ •๋ณด๋ฅผ ์•Œ์ˆ˜์žˆ์Šต๋‹ˆ๋‹ค.


ARTrackable

Overview

transform

Overview
  • iOS 11.0+
  • simd_float4x4 ํƒ€์ž…์˜ 4x4 ํ–‰๋ ฌ์ž…๋‹ˆ๋‹ค.
  • Anchor๊ฐ€ ์†ํ•œ ARSession์˜ world coordinate์— ๋Œ€ํ•œ ์œ„์น˜, ๋ฐฉํ–ฅ ๊ทธ๋ฆฌ๊ณ  scale์ •๋ณด๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

FaceTracking ๊ด€๋ จ ์•Œ๊ฒŒ๋œ ๊ฒƒ๋“ค

  • ARFaceTrackingConfiguration ์„ ํ™œ์šฉํ•˜์—ฌ ์–ผ๊ตด์„ ์ถ”์ ํ•  ๋•Œ, device์˜ ์œ„์น˜๊ฐ€ 0,0,0 ์ด ๋ฉ๋‹ˆ๋‹ค.
  • ์•ˆ๊ตฌ์˜ ์œ„์น˜๋Š” ์–ผ๊ตด ๋…ธ๋“œ (FaceAnchor) ์— ์ข…์†๋˜๊ณ , ์‚ฌ๋žŒ๋งˆ๋‹ค ๊ทธ ์œ„์น˜๋Š” ๋‹ค๋ฅธ ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค.
  • ์–ผ๊ตด์˜ ์ด๋™์— ๋”ฐ๋ผ ์•ˆ๊ตฌ์˜ ์œ„์น˜, ๊ฐ๋„๋„ ๋ณ€ํ™”ํ•˜๋Š”๋ฐ ์ด์—๋Œ€ํ•œ ๋ณ€ํ™˜ ๋น„์œจ์„ ์ฐพ์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

top