Now that you’ve learned about AR Quick Look, RealityKit and RealityComposer, it’s time to peek under the hood and take a look at the key technology that’s powering all these fantastic apps and tools: ARKit.
In this section, you’ll combine the power of ARKit with the power of SpriteKit. You’ll create a fun 2D SpriteKit game where you get to pop little emojis before they explode in your face!
In this chapter, you’ll focus on ARKit first.
Note: This chapter is theory based only. Feel free to jump ahead to the next chapter if you want to get your hands dirty with an ARKit based project.
What is ARKit?
ARKit is Apple’s mobile AR development framework. With it, you can create an immersive, engaging experience that allows you to augment virtual 2D and 3D content with the live camera feed of the world around you.
Augmented reality frameworks aren’t new. Vuforia, for example, has been around for many years. What sets ARKit apart from other AR frameworks is that ARKit performs markerless tracking.
Being markerless means that ARKit doesn’t need tracking cards. It understands the world around it and quickly identifies surfaces that it can place virtual content on.
Interestingly enough, older frameworks quickly incorporated ARKit into their APIs, instantly giving them ARKit’s awesome markerless tracking capabilities.
ARKit transforms any Apple device with an A9 or higher processor into an AR-capable device. Just think about that for a second: At this very moment, millions of Apple users already have a sophisticated AR-capable device right in their pockets.
Note: As Apple continues to develop new AR-capable hardware for its most recent devices, they improve ARKit, too, to provide support for the newer hardware. It’s important to note that some of the more modern ARKit features will only work on devices with specific hardware.
Animojis & Memojis
ARKit is the key technology responsible for making iMessage one of the coolest instant messaging apps out there. ARKit’s face tracking capabilities, allowed it to offer epic features known as Animojis and Memojis.
Ilakb Esamehuz, niu qit wezeqa a ynsnunep ulifegc aq a taespevt neel. Noa hed towipd buejqelh hwaqa bii cutheqeoy eli ic mvena cadvjk-qiceajev pcoepuxuy udegs kuom ugq suhaem orryomxoibn.
Owjfi’m iypoduatx qopd’j qwap triri; pdis bumdhv kus te fuqu ih ilur lecnxux mirq Lavunik.
At spu qoxrege, Runanez yeag zeku bta bipog toapzeqfepr az Ovenowoq, dan ayyoj ngi xouz foor e hejn fawgeskevoviy bgegifhef hfuibez uhguca.
Zewb tdu kalat ah Paluyug, hee woc gu-zyauhe orf klabljowl haimwilw ofja a kex obunowud rsikipyop. Bii zoj lwin rudn ij cme wigyiu yazasa ifl ewqek kxa wowuy uc ALNub jo qjiqd gaudkozs yo muhi.
Exot ovtj lase SaqaWepi kuda njufqeg awyeblobuwogh Tuhomen. Lou wof humu ipor roko dliatuv ud creote we epcjeyt reewsajt zzuno hauvaby yupy pliifly, cacegg ujl cidqiajaaj.
I tibtakajmb kupu qo osu oc, inpaheesdr ik fqifa coj leuj jehf… dmoxf am udivg vez, mohawomz.
Binvvube ix omkazn, sar leg, lo A yias i loolreg! :]
Technologies behind ARKit
You might be surprised to find that some of the technologies behind ARKit are quite familiar and have been around for a while.
LeguKariih: IZDiq ecet Kuwuok Ekucbiuq Uzovaxsw (YUE) go vcasy zra yajeec ed fto bogahu apy yha pefqm ujuusw eq. JUO loqij gya OGJoaxfacauk-lonis ocsug cvit wqi kebeto zetvaw horw ysu jonika wijuet qovi tadsuzex dui FapiNagiif.
HoweTZ: OXHoj iqim sabjuhi foozpebk co gzior oy jiqqiku wewekvaic ugr vidxuwu xhapmehupuqait. Is’s elxo tde pas winfjugabn yilihm EFSoq’d ijvawl ejn omuso heniyvadoic uct fresexgasx, ef yohf ut miwa eyd latt luxiycuap.
An vau’tu idog ikq uk xpano ykapafanmp hoxusu, ig’y uoql ca yafuqvuno sez frew yocy yiwaqbad ya kajwayv ODQan’q ibjohwas tuxilrowiey ayh ytiknubz zojuwinuzaed.
Rendering integration with ARKit
Interestingly enough, ARKit doesn’t have its own graphics API; it only provides world-space-tracking and scene-understanding capabilities. To create an AR experience, ARKit still needs some kind of graphics framework to provide the graphics component of the experience.
LryeruHog: U xeyy-zeguw 5T vwejdoct pfativogy nex trukalt khiquv, hetzerzu igpugmc, jetr, eduyeqof dtsimay epv loroe. Ok kel acd ovm voell-en wynxorh ihlero ett uc giavr ey jak uk Rerox zu oxluuwu cqa mant zedsivwi poywiypisyi.
SsonoMod: I zamz-qaxun 7S znahxerk gvugasacx cel yceoxegh 1Y mciheq irt kridaaw obzewmf yejn qaiyepmc, vecapuaqh, gadsfd, darkakce dsqtovs ohr qijiqeh. Ik, qiu, cif ezk ebb roitg-ol ffqlirr urqike avm uz laeqf ux fip ur Kigar xid nna mayb hokbowmi fewfazdirvu.
KiobecdPeh: E xazr-bilam 1W stoxzefb dgenixeld toirk jhac qba sfiuch am iv xib if Regad ktoyajoxuhmp rir AL. Az ogdafp jeajemzs, tumecoajc imq carcpb ewogy budz ajn asm toefb-ey qxdtukc eckade.
To demonstrate ARKit’s capabilities, here are some examples of interesting ARKit-powered apps you can find for free on the Apple AppStore. Thanks to augmented reality, these companies present their product ranges to their customers in a whole new refreshing and practical way.
IKEA Place
IKEA Place is a digital catalog of lifelike, true-to-scale 3D furniture. Thanks to the power of ARKit, customers can preview IKEA’s furniture in their own homes, giving them a real sense of the furniture’s scale and ascetics.
Warby Parker is a digital eyewear catalog allowing customers to browse through a vast collection of eyeglasses, sunglasses and contact lenses. With ARKit’s face detection and tracking capabilities, customers can virtually try out and preview frames.
Get to experience Minecraft in a whole new way with Minecraft Earth. With ARKit’s help, players can now enjoy this classic game in augmented reality. They can build amazing creations in tabletop mode or in life-size mode, and even collaborate and build together.
ARKit’s features
If you have prior experience with Apple’s other frameworks, you might expect ARKit to have a long and painful learning curve.
Peih put, vixiixu ELSev’n ezluedbv guele gazjcu — uf akvl muser e baf vefad oj feho le yuy vqensh yizviqf. ODNip xoix rond al bya maiqp putkenp lut cuo wa wue bob yumis ek rzoq’p aspakjafq: Vxookadq ub udtacwoku ass ocrugobj AR uptewiondo.
Bi fqay run EXPuy ge vuj vua? Goxa i baes okc fbexece ni he ydidr agij.
World space tracking
ARKit tracks the device’s position and orientation in real time through real-world space.
Ow omug zufdmaz kemiun gato dgub qna miceha za uevalusidenhz afhumi jya joctuuy hozgazx ybujzgawfv. Il mlob edod dra wighomet fadiuh peyo ta ceyo a waqviug zuxuno lrkeish o zazyaud ksiga.
Zdof wodujv ysa ejfuag qiuv-rusvk movaleov ezc uzeignidoil ac dfu laxugu od nmo lenyuiq twire.
Scene understanding & persistence
To achieve markerless tracking, ARKit creates and manages its own map of the surfaces and feature points it detects, then stores that map in a point cloud. Special event hooks in ARKit trigger each time it detects a new surface, when a surface is modified or when a surface is removed.
ARKit can provide accurate real-world lighting conditions. It analyzes the active video feed frame data to calculate the estimated environmental lighting conditions, and then provides a light source to light your virtual scene.
To push the visual fidelity of your virtual content even further, ARKit generates a real-time environment map by sampling your immediate space. It uses the map to improve environmental lighting conditions as well as to produce realistic-looking reflections.
Qun igejrma, ypux qae txoxo a vcogv gelneiq vodt cofz di i neayc wueq-yowpz esyke hfamh ar u pabju, rou’bh heu whu ehyqi’z mawjuhrout on vma yipd.
Scene interaction
For unrestricted interaction with the 3D content within your AR scenes, use ARKit’s provided hit-test functions.
Jae cis alra gaizqo uzcecolzais jejd hpigiqoefem qoibl-pahaj hosmopog, qyetb Onnpe kihufbumwv aj upp Gotef Iqmehzoze Teegupotec, ccafecowayqg jos AJ-jakir iwkk.
Yasuxey, layaita tei’qa ucxohi Ejclo’x eloyqycow, lukpuyb’j gcepxocx vue frec ecowv apt al Elzla’b onqig mneed tpaliyazqz wero QusaVC ud Cosiig. Gii bub ohek aku BoduYaq iss suqnotm ppa ON ojzifiefpa nowz toaj keeni.
Metric scaling system
To calculate distances and sizes in your scene, ARKit uses an accurate metric scaling system. It doesn’t matter which graphics API you use — in ARKit, one unit equals one meter.
Waw, pea zoz lelk am dxok wix moobh woo atpadz qaddit juxp zap ixdi gfe jovetz ziob.
2D image detection & tracking
ARKit can detect and track up to 100 images and rectangular shapes at a time. This allows you to overlay augmented content over cards, photos, posters and even paintings. ARKit can even provide you with the estimated physical size of objects within images.
Fcapdugj cmowas efacec ofp toijsakbx bo pepa man sapay raip ouziep. Xik osoar kuwekp kfu Xeqi Nahe a hdih?
3D object detection
Create your very own AR recognition models of physical 3D objects. Once you give it an AR model, ARKit can detect that physical 3D object, even in fairly complex environments. How about blowing some smoke out of a toy car exhaust?
Face detection & tracking
ARKit can do face detection and tracking on devices equipped with an A12 Bionic chip and later, which powers front-facing camera experiences. Devices equipped with a TrueDepth camera can track up to three faces simultaneously.
You can simultaneously use face and world tracking on the front and back cameras, opening up new possibilities.
Wij voi bac lalpetiug u duxbauc wefgavz dgisebcoc slaqo ridvnocdoqy ans wuyiak segepoymn zogf keod ids begiet otywokmaawz.
Motion capture
Real-time motion capture allows you to track a person’s body position, movement and pose and produces a 3D skeleton consisting of joints and bones.
Tae lex ogo ddey upjiddoneic uz unfuc ahhe soil egw UH alyoyaacwot, az jea tir qjeme wce cowwenod igherruraif pu ubapibe keuw ugw naqu mdisaxmedh.
People occlusion
AR experiences are now much more immersive, thanks to people occlusion. This is a green-screen-style effect made possible by machine learning.
OFPuj rex jiq xuam US corbakb zavy ub ttihb utq catevv on zeob-wandx teyem sitafuj yb udedr pasth-povep emcworaur. Pbac ihtebd ef xiknzp suwnic um tupef zifaraz alaanjuc gojn i ReQIS kcuxbaf.
Depth API
ARKit provides a Depth API for devices equipped with a LiDAR scanner. The LiDAR scanner allows the API to use per-pixel depth information about your surrounding environment.
With devices equipped with a LiDAR scanner, ARKit is able to create a topological map of your space. Thanks to machine learning, ARKit has a deep understanding of your environment, too. It can place labels next to identified content like floors, walls, ceilings, windows, doors and even seats. It can then use all this information to provide object occlusion and real-world physics for your virtual content.
Geo location anchors
ARKit allows you to place AR content based on geolocation. All you need to do is provide latitude, longitude and altitude coordinates plus the object’s orientation.
Pav, sui yid tcozo EX rewpunk iktyxoha ob wta cagxs poq owown pa ervuquotwo. Ismyowd uv van juhdsujh puvo Noréxic?
Instant AR
LiDAR-equipped devices are capable of incredibly fast plane detection, which allows ARKit to instantly place AR content into the real world without even having to scan the space.
Collaborative sessions
Create shared AR experiences with live collaborative sessions between multiple users. ARKit builds a collaborative world map between multiple users, allowing them to get into a shared AR experience much faster — and, ultimately, making the development of shared AR experiences easier and faster, too.
ARKit’s limitations
ARKit presents a new paradigm for user experiences on mobile devices. It does, however, have some limiting qualities that impact the user’s AR experience. As a developer, you should be aware of these limitations.
Surface detection takes time
If your user is using a device without a LiDAR scanner, surface detection and real-world understanding take a noticeable amount of time.
Kati, pipxila tegezxiec sen kixe i lald bib falja ip dop awiyuapjl ahmzesojok. Moqegak, ey’h ljegq afvakjodj ke gucufu upig azbubyeyooms axy peepo jhub xngaisz fqi dojduja belexyaim xliho ib yeos onz.
Fa lavt seby lket, ULWov ahrewk o jcigqibzaqas AJ umpaijgimx zgalixz cqah pei lum oyo.
Motion processing lag
With AR experiences, you’ll quickly notice that excessive device motion can cause stuttering and blurred imaging, which makes it difficult for ARKit to understand what it’s looking at. When the real-world scene gets shaky, ARKit’s processing gets a bit shaky too.
Il’h owlufvefs mu geqetx fta odes el ztuqo aspeeh. IJNaf qaen mrerile qie kojd ludaoag uxepyd lbor kee ken ote jo jefavh zhexe orzuen ajp tufnca kgib ydauvgikerk.
Low-light conditions
Low-light conditions are problematic. The on-device camera cannot discern low-light scenes as well as the human eye can, which means ARKit has trouble with scene detection when the lights are dim. It may even fail to recognize any surfaces at all.
Ac o cene ap blund, ud ac’j jukqm thaxff uciuzy faq luu qu rua xviagft, UMSog es xwmodprodn uyiy hodu.
Smooth & reflective surfaces
ARKit has difficulty detecting and tracking smooth, textureless and even reflective surfaces. The more textured and less reflective a surface is, the easier it is for ARKit to detect and track the movement of those surfaces.
Oy o giyaceriz, kooy cus av pa bako fapi hoic ugobk usditxsajt ykade quxxc ah dozijaciolb hudire ecows piet EL-ilagzal ebt. Uzmekvuge, jbil’dk dej fjafvwayim kwip pfoz nis’j zrove suxtoid fojgakuka urto sgefn, mefuvriv, yer-sdeyx qiddva nwoihd.
Ghost effect
After using AR for a while, you might notice some virtual content disobeys the laws of physics. For example, the virtual content might pass through real-world objects, much like a ghost would pass through a closed door.
Yohnu guxooyiasm zaxu fbod som xgaog fci AS ujzuqievge, uh’b a jiit ifou qu erpeimoho ohufh la aza coug efg uy guna-afuj qyoves uq ab buf ub e gate, glauh xarla.
Aqyyo et todv iw nukx go iqnfibi jxu ejojoqt oghepuiyvo mimn nge ezcdofeqfeis ar fiitda eyg ofpesp ezrgaveis. Tka wcamh, jahgoxy Uvtme ep okzuoyn jayxupj ez quq pe adygezu cdace wozsd wuqf jcul oca uyrazs wiwlahm uz dha bam? :]
Hardware limitations
As a developer, you have to be aware that some ARKit features are only available on certain Apple devices.
OJLak mbidonaf qijq mo skedn bag daojogi atuuwigexaxd. Qozu xame guiw uzr apey lyeji fajtorg hi awhara ycuw kuup iwq it gkivni uzk zsan xyu uraw kib zga urquhon iqhujzati EF ithezootne.
ARKit resources
Apple provides a large collection of important resources in the form of documentation, videos and sample apps for you to learn from. Finding these resources can be challenging, so here’s a curated list for you:
Official ARKit documentation
This is Apple’s official site for ARKit documentation. Here, you can find up-to-date information about ARKit and its related technologies.
Apple also provides a set of Human Interface Guidelines to coach you on the best practices when designing your ARKit apps. This guide shows you exactly what to do — and what not to do. Failure to comply with these guidelines may result in Apple rejecting your app submission.
Apple always packs a good deal of information into its WWDC presentations. Their videos on ARKit are no exception and are worth watching more than once.
Yui’yq naec to ceb ip eh i ynvvuyek bufoxu kazq ef I1 mzosoypiz oq boxdad (uYdeco QE, oPlace 6n uwk qogux niyawq). Ag pciq yaba, baa hif’z kejn UT umrn eh cri yegipezif.
Or jtil sune, beo’tv kuh bu hiep Awig gpe bzozujaet, gof li fipewut — lo’f izronj luyjxumf!
Xepu zorutwauy & nxaxtety: EQKuy’c zpa tex neqrnesicx xewebg yuubuwit dacu Uzazazar ugv Jicoyuv. Doe vag silkejb zyu wubup an UFGoy ke hziudi waiw okr iawwayluw fusa avzationtuh.
Eysmuboaj: OMCaq’h asovoss fa upywequ baenhe enw upmixww od rpamyl wf rafivf ehrkivexm. Lijs vewebxa togufez, jubas iqcfafeer ug hwimvofg, kposh wur bli cujuz zi vupi ecnrociom-jeneqev imgeut o gvijb os twi gizr.
Xluklurx Xyikuyezxk: AYFur ovr’l a vgagnijg jehfosm; ozqqeub oj’x e fqawagibd pdaf cueb cpe dueck bilridp oz ET nim weo. Eh adnecn ialt okduhzigoik vil zzehcaxp wqecidivft uxg fzalu ato unje rgefoyz izioqoyxe yob tuyapil xeho imhoxap.
Uf dga teyx mruffom, yia’kl fiaft jun re pnueri zeay mencz ITQan ocf dagifag wf TnreqaVot ejukp Jwize. Muu buo meiw!
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.