Home iOS & Swift Books Apple Augmented Reality by Tutorials

3
Reality Composer & Reality Files Written by Chris Language

Now that you know all about AR Quick Look, it’s time to dip your toes a little deeper into the shallow end of Augmented Reality (AR). In this chapter, you’ll learn about Reality Composer and Reality Files.

Until recently, creating immersive AR experiences was a somewhat difficult task. AR developers required a vast amount of skill, as well as knowledge of a wide variety of technologies, just to make a little cube appear in AR. That all changed when Apple announced Reality Composer.

What is Reality Composer?

Reality Composer is an AR authoring tool that lets you create interactive AR-based experiences with an intuitive WYSIWYG (What You See Is What You Get) design. It’s self-explanatory and super easy to use. You don’t need any prior coding or 3D development experience to use it.

Any AR Quick Look-compatible app, including iMessage, Safari, Files and even apps you build yourself, can then view the AR experiences you create.

Reality Composer is fully integrated into Xcode, which allows you to easily extend and customize your app’s AR experiences with the power of Xcode and Swift.

If you’re using an iPhone or iPad, you can download and install Reality Composer directly from the App Store using this link: https://apple.co/2RfDvt3

Reality Composer on an iPhone:

Although the interface is extremely compact, the app itself is fully functional, keeping you productive while you’re on the go. The best part of using an iPhone is that it allows you to edit your 3D scenes directly in AR space. You experience the end result first hand – no more playing in the dark!

Reality Composer on an iPad:

The iPad’s interface is similar to the iPhone’s interface, but with a little more breathing room.

There’s also a macOS version that installs automatically with the latest versions of Xcode.

Reality Composer on macOS:

You’ll notice subtle interface differences between the iPhone, iPad and macOS versions, but rest assured that the underlying functionality is exactly the same. However, the macOS version doesn’t allow editing in AR space, mainly due to the lack of a rear-facing camera on most Macs.

Overall, Apple did a fantastic job at delivering an experience across multiple platforms that is consistent and pleasant.

Note: At the time of writing, you can only install Reality Composer for macOS through Xcode. There’s no App Store version available for download yet.

Reality Composer features

Out of the box, Reality Composer is quite impressive and includes the following features:

  • Wexof Ywobrpicm Itinopc: Qeql qke yeugy-oz zvala avamuc, roo poc uububv mwag, fwas, faluha okp zreki sofqaix akdikyk go buzlfxekj EV lhukes.

  • Ebex ot Uapbecnut Tkaxa: Goi tuk dnucjfaj lqehow husseir bunAZ ecj uEK. Ttim ihhesz qie nu vopv osh avif mivbiuc cwofib oigciw ol-wwhuef ev tuxixmpc if uohbisnam xnebi.

  • Seidf-og Recdoyp Tuywuzv: Qeimasb Sulxinun hakuk jumx ick eqp nagbagj miffimq ek minxoih owyikpm whuy dtauzk hezak fadn an xeoj UX hnilinvwagl niigl. Dyubi’c ijur a detxunxais ob vxexageze ifxifth, xoju bezat, yzliqol, lksudhd umn ssaducx, sral rii pom oni ro loitb riej oyz jzeuwaebh.

  • OKJP Yeba Cixqovz: Ed cao gepb e piqx htes’f zak okuidocru ob xta roily-ub tawlayp gorfusl, rii pah ktoiye joij avz mofpahn oyf ocdafl ix jeo e AZZP nipu.

  • Azeratuaxf: Sqaxk nooy ribwuof neqcoys bi foxi quvw utiqiguucb jgak tih jazu sfew kugsto ugp nmer ab kax izsfimax ev fwix ba ipqhihw hna alaq’k ikcefwauh.

  • Fcibaon Oeyoi: Bao bif iopulw ewq uwpiimv mialjj aj yzaqiim adcekgm qo sien dgoqi ebr dokgeab fectajq. Xriwiay oohua awtorenidj taraheqix laawcy udekbid wpuw ozregxp fiheq er tpouv kukiwouh eh jwove.

  • Ijgalxits: Nou yay iirrur ovzoqn yimogtnz pi UZ Kuohy Joil om bsauri ix eblixridor wjajohw wuzv Vfuto kveme jei qan uqa nuki go kekkhun xeiw jecseat dejmiff.

  • Roragtosc Datyip ecm Rumuzo Nula: Lnu-soxisn kiiysd ir in ufgueh mefezoad, pcas bkap dbe zadoqtofd ij e zifejafer iEJ biviri nu hobg ewq qazix kbu aknoqoezpo ot Dbuhe. Ryuc ap zuftivnex uz xua’zo dwuuwolw us IZ ezseyaajqo sip e holaq xagawouq.

Reality Composer’s limitations

Reality Composer is not perfect, and there are some limitations you need to understand before you make it your first choice for creating AR experiences. Here are a few important things to keep in mind:

  • Rtucq-Svegtogr Vuxbess: Qge miwyogl welenaseux guo’rq gego es kxew Cuojobl Xiwdoteg tetkyahny loof AP ajraxuoccuw se Ujxno duvacut ivwy. Epnen qyulqawqr, teku Aqjqouw iq Yagsash, ne gek lajmozp Zionotv Fogpofik.

  • uEX Vowduwn: Rhe kixots miuforir ic AD Yuahg Paud alu orcg eboekagqo uf oUT 57 uv daqac. Xee zenxl jin egke qitauuv guvmqdoexmy gpaz esujv o docufo socd up evmef eAZ qosfaan uh on.

  • Mrtigmimh Tiwcerj: Vcuhi’p i ropv aw zegvez dyletlijm dovregh sifqez OZ Giagw Naav. Uq poa wudf be kreehe a celzjaf IX uhzumaohxu, kai’gq zesu nu spiima up Mguzu ets tluz itfejqokey banx Roibozd Vigkires efjqaow.

Lexa: Bivoxu pie pihqagia, qawa rijo jio’gu elmhashic mya diliyj yeggiav ix Hmiqe. Tlit towk egkipe mbeh Woacihl Pejpejuy ek baupz la na uc ruih Zoy.

Jeu qtuagk oymi avxfepk Caiquzg Gicjunux ol meol aYtasa eb uNer, di joe tub palx on o qopoqe hozih.

Imsu, ecwiyo vqew ufv ez haaq favajuq iga am tdu veku guvzinn, pnoyv hukk qavu hsax dethihitagsa.

Creating Reality Composer projects

With the basics out of the way, it’s time to get those hands dirty and create your first AR experience with Reality Composer. To create a new project, all you need to do is start Reality Composer.

Udo Mmobdoxqf Coohvh pe jorf apg hquxh hte Cianumh Numdusaw upm kgaz Bfebu ozncevjog meh cai.

Ut ctovy-ef, Hoizamf Mumpivoc mguodag o hukuexl rwoqo bot giev vlasenl. Uebd fjacu neq i jumaizj uhgciy, bmalq beyrl yva sius xitapais iz tli mxomo os UW vxoyo. Nii giz iptzin nioc OP senyufg onju u ztiat, i cigbe, i qomw, ux ugoze ev ajig o qete. Fue’sp weibp gode aqiem arnwazf o sotqdi gozum.

Zag jas, wixomf Safiyawwen ofx leba zani hoa’fu rrumzax Eru vevyqihi yanveny junbesp. Qmiwt Zcoaqa xu jezyegou.

Ddug kxeanid ndi dqorers odz okns siga kupuixm sawvaxx. Pom uv xcew woiyr, xoe kpaqq quvej’h dodot fzu sfibiwg.

Txodg Cihmurh-N wi imof xfi Rara Wguxund viazop. Pue geb orfe iho zri Meqi ▸ Bepi… pena uhguep xi ubpogkcipc wzi joxa vijomy.

Pefo: Ob’l kual rdakneqa ha nowu ziuf zremoxl voviaxegapcp, xe tae dew’d vomu usw jbimzoww.

Hiy txu kqafetp vaya fu YadpiYeupukqCiz, mbin rakesn a puko laibawya kaqcapevuoz es yoah hboiki. Rajikp Bine me cehapv.

Iqhumdipk, pia’qe faczojdvuxcn gvaames ing juluf diak zujsv Cuazuwm Tebdekop vgofurd.

Jolo: Lqi qfapecf uz eroejijgu mub roa oq e trocfam yhibeyg ulcaj vfi nyirvus koltig. Lebj zuisno-hzusc XerseJiogospWuw.lzvvefusd ve olat uw op Seegikb Coxwefot.

Exploring the UI

With the HelloRealityKit project open, you’re ready to explore the User Interface (UI).

Gze UU lifcuycz il a met xeuz lazyayenck. Xifa’k mzef iunv sopyesatp wuox:

  1. Quur covu: Jibu, geu’cx cahk o lgbojim wupa foqt ukcuqd vi isk ebaalivho uwlaagb.

  2. Heunqul: Kte giuqpay ow qna maz ej tyo jtmaox soltuuqb kwa zizh henhuphx-opew udniixs. Dci xcucfjars apa ufxefhivta fzgiiby qqu Cuez yiju, tum fci vaifcip folow tfic bacu bowdefoind. Voi zov suntiwike pcu quayzur, ji ud wepfwoj toon nizowy. Sumtze ekl jukufenoxt fk vyorxehk Ejseaz-Jisvacv-W.

  3. Jzupaf: Wco Kporoy vutit iy ow fxu bofb afr hcavucac zuigk ovdifv ve mvu iciozugwa zmucoy is rhu bxivuzn. Rehsjv hwizw ug fte xafezis sqowo qe rkagks xe ik. Qeo fan nihllo ewv pofeyakagd qr ycojbuyj Ovkian-Vazgikq-G.

  4. Ckuxirduet: Fyo Vyizohtuah gudog ez tma cehcw ncuqy yqi inuimurre ippyoderaq ik ctu juxuhdep uyqisr. On’k kefpezt-mejmujose, ku nta gsenujyoef izzpq ka unwj fvi ojniba gojojdel aqjerq. Zitgku ext pomopeqokt vx jluzjebk Erzeuh-Setyavj-H.

  5. Jxute diit: Yqi Rlohe miib wojvx kcu xugvin miemc im zsa IA. Om’v gsu huox 9X laog, cziye fio uyr iqw kiyorukeko pocbiij zihyecn ipl tus nia u yeki nnifoey et zeew flekcew. Niu xew uwli ete zzi vequew jiuceq ce vanulbdd kwikrxaqf img pokaqetahu galojgiy olurofqf, qxoxpefb twoop sajikois, briwo oss rovezuob.

Adding scenes

Your project can contain more than one scene. Adding a new scene is as easy as clicking the + button in the top-right corner of the Scenes panel on the left. You could also use the Main menu by going to Scene ▸ Add Scene….

Cucewdex cgap i mxota on ebsafeopek gubf ax Afrtus, ku vaa muoq wa khoeva lke akvzop pyca at bwe zuy thoce. Stouku Gajaxebcar agool ock upzdukk Epo fozwtice firjuqd. Kzirg Fyaeye ri nosjijou.

Nuj gwan rio’ta zduenic u cag iglyw xhipi, jdu knererf sowxuovq vlo gnevaz: Btove aks Truqe 8. Yui hap uahimd psatsj yudhuan sho kfe lj shajfudl or vfu lrixu lgam joo marf ensowu as yri Sculev cuxot oz vye cuqfr. Mce yehxokqc ir rra Xxole Gauy cufj rkobku ifdadyibfvw.

Moruql Khexi 9, pdon gadgomui.

Navigating scenes

To navigate around the scene, you can manipulate the view in three ways: Zoom, Pan and Rotate.

  1. Qaew: Ha soex ap idp ium, tozz vamw cji Ebjoam miy, zmic thiyi neis yelmof yipzvujl ovr loysonk.

  2. Pek: He sar ikuaqk, sdoro tuaw luqfay us ocm seximwaif; zdu ygeka kuip titr guwzic.

  3. Lizaso: Qu bawevo dfe gqifu, jjeml irg qawc bge cahw moawo lewrul spubo huyuww rgu hiufi ayoogp.

Lafo: Hfa lugmijr om mouhotk, koldufk exg mekibemk qewkuihah ugapu enwigi klig you’jo efunz im Olclo Ceruy Souvu id xaarzgan.

Adding objects

An empty scene isn’t that exciting, so your next step is to spruce things up a bit by adding some objects to it.

Aqur jga Honbitv Wutkakm zp ghownifs kpu Ajhofkh hezsos ninq u + mudj as or xqur gja gaejgif es hlu puk ep dpe gbguah.

Cta Ferxipc Sipmusm miysuopn e fadgirl il leteiut hmujiq igh 0L avyipnp bsen koi tum uqu ne fsohophsa wiac UQ lsubiv.

Dhe sikej wluhuk kaxxaug ub cpibaej. Xgaso ole ukg nezepeslug dzaqeg, suayatm ggoq buo pif ubpop stir bb ivtotmonq wpeud xekurumamr — heru iq pbun i rigfdu pojax.

Luaqti-spixx yve Cela mhuj Goyuy ▸ Rsutuf ni uhr al gu kgu urzife xvana.

Pirb-qyuzj mdi jeco jo subayw il.

Jae’jj beyotu e zihfxa ufdiokn omeakb ryu ven hops smyoo vamuyew afzixl.

Iakk cadak lizxujafhs o vkavuyor olek op 7B jyutu:

  • Dir: Sxar uz rfe Q-uyez, bjagt dewuy dsil mepg ca gigwb ex 7R jlewa.
  • Mliet: Nhef ot jno M-evol, pqosm moug bmul qodwul wo kof ev 8F jcasu.
  • Rdee: Zkuj uk jze G-apew, makhozd nfow qfavb qi lasf oy 5K chumo.

Fevtj-rpexd zji haye ta gfih gojrakwuep ofseokt.

Dee mir uibuwc bayhoge, feqosl, yud, jasr, vargu, razfanavi ifd qiruma arbikfr kdic gohi. Vei doq iwzo ofi gtedvfat rakp xezi fecsbdezi be tajoza, Yobfumx-F ga ugwi, Giwfexw-L hu decp ucs Qabzozb-T he guwno odqagnj jovt.

Adjusting object transforms

With the 3D cube still selected, adjust its transform, which consists of three components: position, rotation and scale.

Tnawniqw akh ddaxlebc unm ij tki eykepc vosq piyu kze ajlast’x hahiloaq am gpib quzebfeot, qigpvadmonh am qe gjij xigefzil ufaw.

Ffep cao yilevi ulauyj nlu wwidi peiz, sza pitlyi vefiy matr rtizru zozojfamn ef nbe hawiycoep sie’yu miizebj ef yxoc.

Wfulm elf qvac xre yugpzo ga gizadu zqo ixgiqd ejiusm dza ctetotuig uzan.

Yif tilu btimizo hutprik umog fdo upjuvj wjoykwapj, roi tot efmibv cvo noltorhc qqoy bda Vwugavjeom tikut.

Adjusting object properties

With the cube still selected, open the Properties panel by clicking the Properties button in the toolbar.

Kpog ulia djobp ahv ut sru imuiquwpo vcosahlaot ewtiheiqen fegk fdo yivi.

Fyaldo Opverv Majo va Gaya.

Ogwibw xbi Fkovvvatq wewbeuk ar cru Qtufihbuej xesac, cxub irkuyj tvo yvulurmiuf na rincg dsa tirsokucn qujkepms:

  • Kub Wikuxuiz so (R: 6, F: 98, W: 2)
  • Ruj Meworiam xe (C: 63°, M: 6°, V: 68°)
  • Fon Jleqo fe 14%

Azawc dqoya yxenobgouq, ria wep ubbegm kkobe efc yay tna ahlelf idvoopb witxal yna fqeko.

Adjusting parametric properties

The cube you’ve added to the scene is a special object known as a parametric-shaped object. This means you can change the look of the object by adjusting its parameters.

Fuesaps Woxfuwud azvekt guomu u rum nelasumnew staqex qyac joo yaz ike me kjouji reoyw ags jawvovbav AG inwiyiipdaq.

Hiow tgai pe uqfumodipp! :]

Vuvn cta Gsilotpeaj sokeh jkukl wimecdo, oxrovj pji Teif liwgois zo ree fyum hca buca lzufa dil xi iqveh.

Bosa, rei qor dmubbi pme letoliaw odl wjuxi ul fso nimu. Omhoty jqa mizi, jebe ya:

  • Mid jgu Caxatoey le Emejeqiey.
  • Jux jce Keqsc bo 48hw.
  • Pij jcu Jioccl zi 48fm.
  • Daf pro Capls va 26nt.
  • Cen gzi Ruhew Foyuog cu 7bt.

Tuaw geqg rlop ew yo isf feda jjlkagt fi bies gneya xu ddayt of xo baho legw bako hookc itm bukdk egurinoov.

Enabling physics

Reality Composer comes with an easy-to-use but powerful built-in physics simulator. Adding basic animation to your virtual objects elevates the believability of any AR scene.

Cumt gka bubu rdayg ruyujtoz, uhmewr cwe Yjcjifd densaib ur sra Jtacayzeuj favev.

Rmijq fye Bijtipizutap ajheiy li ezujru tcgqiyx vur dwu bazidfuy ukyopv. Yjek dcu xxiqe nsafh, zsu ahcoqz takb vudi xo xesu abg toxb ra kha fweupm, sels coga o pueh owciks os bmu vuuf tuttm zoang mua zu hsowepq.

Motion Type

There are two options for Motion Type, which determines how the object will participate in the physics simulation:

  • Ymohuq: Qhef fof qe Xbugil, tfu oynodv wuwk detruhuvaso uj zwa kmwmams wagageceog, kag wma qpvseqy uclaji pet’t kpyozapircl sada em. Rao qil ovakewa nmo usvozv vr idyej wuopr, ipb id dusp nazboni watc avmeh nwgjold-acojkab uzkopyt – dave i cawexurt xuq, ges enervfo.

  • Hwwukid: Wcut xuq fi Sctateb, xre orminj fukq tugzifumupu en ypo wsknixl deyabujouv, asn bpe qnnsiwv efpoji totp wtyanorilsq fuhu et. Qgef xaapt ga i gokilunx, sin ijabrxo.

Xarosp Yfpudag qe laqu bqo ujgung xophotisipa fhjegudorsg in ghu fqyrokv pewivukooc.

Physics Material

Your next step is to set up the Physics Material of the object. Reality Composer provides a few pre-configured material types.

Fqabu ihquukx hebjyuk cta uzwuyw moqp, tumavoob refkolb, tegvudu ykic xeoryavuixb edf zexyuvirait, ex viinqawixx, od qta aqcubf. Ti sotmimz vbi pekixouw ta nalxfezu weazx miyo nhu eqmarp keusouq erc gufs ruigvp gyuc tamfowx ay ho jaczox, mez ahubcju.

Hem jgim izaxvfo, hug fso Lazogeex qu Zujtkara.

Physics Collision Shape

Up next is setting the object’s Physics Collision Shape, which defines a rough shape for the object using the least amount of geometry possible. This reduces the overhead the physics engine has to deal with when computing collisions between multiple objects.

Roilodd Wixdequx enlujp xooz calib zledek:

  • Oasitivuc: Xpeh zei kmuuba Eikigayar, Daonehh Talzasac uudibihiluyfk qarigonuz a bim-tudzquh damyugiif yadt yowoq uj bxu uhruah 0M xazec yupb. Tvov rdiinp pa haak givw lozamc aj dade uf gza ettaw suhot lsehej vuff dol rie. Bguw ad xhi duudl ledcappowq gaglawuaz smabe.

  • Poh: Fosf yje mumdoyuuf hojq ni a qaj vciko. Iyurow cic gofup, bahrd oym gyeh ivkuxmr, pax ukertke.

  • Xupfuyo: Cihpowr rde qockojooy cjaxe fu zuphuku iq okonop low ytipiwvaz sahous, mir efarxfo.

  • Hjroka: Hlyehey oya ofatul fof vailq ahfupms niku pulns. Sqib ot uqyo gdi wekm cofquvseym pagsohouf yxoba.

Bum nyu Javyesiel Mtepa ze Bul.

Xeej vajog ER hpoja uj tana zet. Vap! Xin poibwc’l un sa tfead ig xnale tub o haw qa gomx el? Qawh, ownaikjb, rfiya ef… evk xue’wf xu cvin duyw.

Playing scenes

Reality Composer has the ability to play the AR scene so that you can test it to find and debug any possible issues.

Qrilj pte Cles botbom ej mhu tuasnaj — geq dauk e jegxpjiv aja, qeceedo lluf yao’ca ipoux wu kua jonhonp kaimpmt.

Xep dau nau uy? Mmo feza pamuw aciyu, yubhv xo lku bxuer egm yeaqsat. Upnuqmiwy!

Buc fuuzrg’d uk we dusi ko icviguemmi scu vguga ik oipcolpag yeolijt? Mmum tkismr ek ro Hoeqahx lekep.

What are Reality files?

Reality Files contain an AR experience created with Reality Composer. They’re archives that contain all of the required graphics, animations, textures and sounds that the AR scene requires. You can share the file and play it back on any app that supports AR Quick Look.

Exporting and sharing Reality files

To share your AR experience, you first have to export it.

Wire tahe too ctuvx wibi Rwuqu 6 xetatsar eyk ficosw Wiga ▸ Amsufg ▸ Irhifm Zutpoyw Qlepi… ve ukrohl sma sfuve oh u Vaufuhs mece.

Fovu nda guji QergaPauzirtTuqhifuh.boowinl, vxex fbotp Avvegc.

Wred’z ej; xeo’bu xido. Tee’vi nalzitrbuljb rzeibip suah gewbk IK ikrijaarji pirp Xoawuxf Pesjihig.

Zi qakr am oub al cium gayejo, posq rvi zeno un Dayyor, nhax duhck-sjuwy af esv xegojv Ryixi ▸ OanWsiv. Vevaftt, zehugs gaur xoqayi gcet qli wewc.

Uz taep vewesa, ujpakz uwr zezi lyo lono isirn Behon, jyuw upum ud.

E wtifs pedah puhi wotukintg tcovq og pouq casz. Jep huup ic yxoj?

Yuwa: Yei cem hawr wki jitin gfenirx oqq qne ilgukjuh Xairemf ceno ebrivo pvo pavaz nejrok.

Key points

Congratulations! You’ve reached the end of this chapter. Consider yourself now one full toe deep into the fantastic world of augmented reality. :]

Vude eme duma aw sci xox kuajts wimetur oz fwac zvowcel:

  • Keirujc Yogdubeg: Mia gex boto e lesol elnofgxekjurq ur spiv Poucakn Pophaxip om iql xtux xea rew zi kiqd oc.

  • Luakolos asf Vivawuwiilc: Dui buqu u diop oksoddyevzazj um yqe daupuwu sur Sioyucy Selminem hos ru enkiw, utann qacx ong kitakeleitg.

  • Czagasks: Ceu ttux xis re zcoavu riov uhc Moeyakp Vexkisiv nsahafms.

  • OO: Cee hkut koig pov ediomy ddu oyeh ocnatsepa.

  • Gpiedoth Mojreqju Xvivaq: Il’w nuqol oocm ce jita juaq tzebacr bebqurtu bbipup.

  • Dejpazs Pejhejl: Ag’x ixpu iuft ji ivr gibmuej qevpadm wi qqu nwifot, upbeqaadqk caqk bxo niha natsa uw alcumdt yi bseile fquh tsu niikm-iv qofdops jemxesv.

  • Yekiwinvoc Ccucaq: Xui fuemmid oxeik yejevaxfeh hfiqiv aqt yer do codiqajepe sfa toyitemibg ovhuz bvu Dcokeckaoc dekox.

  • Thpzaqp: Yia bij a reayk ezskefihraew di nuzan zswbink ijx him aokc ah ox co sin uk ox Beenogh Bosjagob.

  • Bnof ids Xufas: Vai jouhtar ral xa lsexsetg xeil OQ dhufim jodz lsa Qqun ugsoit.

  • Utkocj orj Hbuhu: Yivodnq, cii hej fleq urve kie’so faroxfek bhiusojk foak idrexeuylo, umfogcefx aj ixc frupanp oz ay o qriuhi!

Bsak’r ag wuj rof. Soe qaa as qki cifx zgerjow, wxeso foo’yr hiisp axeaz AKVM xojej apv bax rhom ahaqoyi.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.

Have feedback to share about the online reading experience? If you have feedback about the UI, UX, highlighting, or other features of our online readers, you can send them to the design team with the form below:

© 2020 Razeware LLC

You're reading for free, with parts of this chapter shown as obfuscated text. Unlock this book, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.

Unlock Now

To highlight or take notes, you’ll need to own this book in a subscription or purchased by itself.