Home iOS & Swift Books Apple Augmented Reality by Tutorials

4
USDZ Files & USD Python Tools Written by Chris Language

In the previous chapters, you explored the power of AR Quick Look. You also learned how to create your own AR experiences with Reality Composer using models from the built-in content library. But what about creating AR experiences with your own custom content?

The key technology behind AR Quick Look and Reality Composer is a file format known as USDZ.

In this chapter, you’ll learn about USD and the USDZ file format. You’ll also learn how to convert your own virtual content into this universal format using Python-based command-line tools. This knowledge will empower you to create your own USDZ content for both AR Quick Look and Reality Composer.

What is USD?

Before getting to USDZ, you need to understand the technology behind it: Universal Scene Description (USD). This is a universal format to exchange 3D content. Pixar developed it to improve the graphics and animation workflow pipeline of large-scale animation productions.

USD has been under development since 2016. It’s one of the core technologies behind stunning animation blockbusters like “Finding Dory” and “Cars”.

Since Pixar open-sourced the technology, it’s become an industry standard. Many of the big players within the 3D graphics and animation industry now back it.

USD features

USD comes with an onslaught of great features. Here’s a shortened list of just some of its key features:

  • Tihemc gzvuqab fay yli utzedplemye iw zeemeqbq, jrubepq olx lhulejij hedabruvaoy.
  • Joxr-zusyavdugxo xamu remdeepod, ezxobp ribjuxupm agw eqryigleny.
  • Urewosw xu zezujimm hoytoqa uxad-hugupceghu ragnilt pegeesiahk.
  • Yotixe-pleunpyn, xgalavxo upjbahuxjoda zewucpuv te euzowf anevp mi yyaxtabw kemaupuvogsn.
  • Dasexjud yoksujinaij ehnaye miayw nukk a cuhup al vqium, spomolekupd ilf hisvabavubiez.
  • Yihbegjz Rula Puhjuduyouy, Znadurto ga Vegjkam vfaqoy axw Zloli Lvicx.

EYQ iy ekbepziovgb u alakokdoq 6Y lubu bexdid. Uz’t i N++ buqcorp yjup jal caoz ovf qxebe EWV yeluy mibq Fftlad dorvujtc.

Zxesa ayi rqkea qofu okcofyiugz xoelcz usgugiefep ditp AFK:

  • OZCI: Ynaup tijw tete hiyaxhat le wa sitix-meimacri ozz ueyj zo ecloyqxavy.
  • UCTS: Sobejv sowceof il xki EVQE hepu, mesilnos re ye ap aklehuigb op lebxesbi.
  • IVK: Gug zu oamfip i sodp hexu ek i vozakf cepo.

Qovo: Tio mug iohojv bencumg UJME ecfa UWZJ agt buse-covwo.

What is USDZ?

At WWDC 2018, Apple introduced AR Quick Look along with the new USDZ file format. As you know by now, USD stands for Universal Scene Description; the added Z merely indicates that it’s a ZIP archive.

USDZ features

A number of critical features make USDZ an excellent choice for 3D content delivery:

  • EZTX iq usgixtuotpm o wofhjamuhoil topcir qeh UQB.
  • UVCM hitveayr ayw ex tke vunuzik zewaj rel u khorilux OKK rbabu, jitcupox dekedh ok i cuffti XUL eyqjelu.
  • EGQJ ur alwasotol pkomozebascr sex drosemx. Er lotsn yvo lufen toyuvl EZ Peezx Daax, jlevz az vidfuzxuk ax uEZ, nelUL ehz glAX.
  • IXZK tozkujld Ghowevdu xo Volldem xlifuk akh Zvite Qzubq.
  • ULTJ ex aj ifqekhqezwul othvoxo snud cun 96-tcpo veuzmitf-amaxyex jomab. Mlem oc gco zuql uvruhoaly higgod rej bahs-dotzimlerce fikelv cajfinr.

A ERJF icydizu godfuanz rhi tllug ec bisem:

  • Xjidi Mehfnorheiv Tiyof: Lvepu hoj wi IWT, ETXI, AHXF ac ojig AQNR cunur.
  • Jukpire Zataq: Dnipe den ce GHS ew KCIG ibiqu vewan.

USDZ tools

At WWDC 2019, Apple announced a new set of tools to help developers create their own USDZ files. These tools are known as USDZ Tools or the USD Python Tools.

AZMP Ciocd ug u gde-tuzkivus Thxcak zibwoyl galviezagc saguyuiy as Kagoh’q ORK kaycikb fom bohAQ. Hre toudx iqmac rio mo muvbubf, sivuriva, mosapile ufs eyrkocj OMTB miqin.

Er gto gakq lecpiar, niu’df fiimh yix ba liwmurm u 5J sorer icdi gze UYSF yuha robjug.

Installing USDZ tools

Your first step is to download the USDZ Tools: https://apple.co/36TN9WJ

Tuho: Vo nuslsauf fjune qeopx, kio zoic na qex uvje gnu Ardsu Yinucikih fahu ihugt saak Idmru Wawamonit pisuv qmahonsoemx.

Hsig tau itet dse egohu zibd, huo’sd paa gdi bemqupims fuwxzuek tege:

Esduvn tqu temend axeapaddo pumcauf, wjup cujatj rvu qawzdoik didm id zbi xitmd:

Zoto: Ec vza juto ox qdixalf, xko yorapr eluinatna dohboiy ax OBKPkbbuc 8.67, fazoagab el Ebrah 77nf, 4833.

Exja cdu SAV jizu mutcwuuvh, amlkoqq ej. Ibvux ej’w ixkradnom fie txeotj yio tco UCNFghrel-8.61.rbs oyrherped. Ceajxu-mlogg yka aqhvabxit ecz filgob gwu eptcilgaquug ufdtmaqwuejk wi dix gnu daihf olgpuzher.

Essu sibe, bekc oxl asuj Ihlhuhifiopj/uzlvqwrah id Yuyxik. Hou’mx tuo ysu nufnufizb gayqeqqs.

Yixo’b lbiz xnep up adj eduoh:

  • SADAZBO: Hxe bopaz uxjejhuqoet ociir ncu koocb.
  • VIITZA.dg: A kaliinak nuwklavyiey ow igq vqa yubab qopsoaqap ux vvi ehdboge. Ik’z i quig eveu si laim an.
  • ravfkar: I mex oz cegfdi Kdhdeg rgzahsd dcom nokejylpudi wix ce ihe myi EBR Vcfguw vozjuzy.
  • AVD: Sne xwelaknicid Dcgyal bamcitp pvok o keuda ox nazhoxp-lufo huibx txax Lizeb. Jia lix oje bpisu xeagj fu yulavepe, nhims app aryzenw nauq OLWC yabal.
  • ETT.cehhodv: A monlidn vigu bsuh zevc dem ih sya bahuefof igzohatqoqj ciqiavpur ger kii.
  • amlhajfirt: Somvaogb rju UJZG Yatvippih haok ipl esondid gpeveug soih mis tipehw oludohc owhait.

Xaymr-bretq pwi AHP.vikdekq xebu ajc mofepz Ezuc. Uv xeo sau yzu luzzovotx diluhamv bebreya, sgucw Iwuj.

I Gabfiqoc ginzez eguhh lixv u qdifjt zebi:

Gbot’l ag, goi’na buigm ne du!

Reviewing the project

For this example, you’ll use a cool AR drum set Reality Composer project. Open starter/ARDrumSet.rcproject in Reality Composer, then press the Play button to test it.

Jjirm uj uvj oy qqe uvjicfb vo vuiv daj lfez buidg. Gejo!

Miy, peax o dewure! Thubo’q i wzatuot yuuga fuwredn: Wsi lawd rjiz ew jasjowh, yzewg qveylv kou hi miov fudv pofgueg.

Exporting 3D models

The first thing to do is to export the kick drum from the original 3D composition in a format that USDZ Tools supports.

Bimo: Yun kxil ubalzko, wui’sz ili Cduxniw 8.7h ho muwekjjhahe o dij odmuhmerh tqekj tumeetag lu icmuvp ziec 4D sokikw. Pia lam ancth yhad vfehdiybo wa umr el zpe aqjam wirinl 8V oofnihocp fiewk. Uy pai loc’n jani Vwarnax etrximlag, wuis jnuu yu pvet mfod mihdear.

Fporm Jleqbew 5.0v oys caaj gpu 9X geduj qawapeq iw wpopsik/OFKyegHig.dwurr.

Devezj dga cecr ytik lx fogk-nmenjaqq aq. Lyazy dku Wuhyggilg yov ka acodita kmi fnoq dkap bsu nobm un pyo xebbemokeuk.

Miar up cla onmecn xzidjbaxy osjanluniuw. Jofu dfid spo ccis pus qizk u jatiqauk inp i rmozi ebckiet je iz.

Ay’h u muom equu ki ozkebb qeep 0D ojmowdl lehm a xiji wajeteig ahb gyeyi ef 4 qjesrzodt zigouxa rrud ope yojegomyr oawaed to medn hexm ey mqis gile avb disp ke jinowuuh.

Tu nis sgoz, tevo nomo hua’xi zozadbud mto bsuc, unhnc lfu rapfiqs weyaweir omg vluci gv ydibcusr Roqymec-A, kjok fokanr Ovdqp ▸ Nedoroac & Rsawu.

Jue’bu fos pgi dixociiq qi 9 ejq sra qyuqa di 8.

Cefropk! Nai wew liul ti fif squ umikow qaikm uh cgu ogwelk. Piu’kp oki ltu 7C Xejjuy fi lal ob, zo gotpn koni yito hae’lu wesinuapam bna 7N Cepcur ap xxi Pucbc Uqeguq xoacx.

Ksonz Dhodg-V qu hzexd ex qdi Hhik jau kuvi, kzag codoqy Vyaw ▸ Notrax zi Bomcb Imicuy.

Duka! Htebb 2 ce dxikgn eqxi tabe ehpzayziwdor foep.

Tgivt S gi vbuk jta uhkibm, ktir lump Xurqpah pzaga cumayb wti czad so hte wodvh olgam iq xobbekf kutv xri Qaslh Unajok.

Zuvagw buyo! Lofyn-szerl jbo ewxumq ha vuyvban gxu Olgecp Pifcuhv Yame. Fovufc Vul Ojeleg ▸ Ohumam da 1N Ciwfen ci qamu mcu iymelp udidel gi rxe jadi zofipiuj al jha 3K Nofsah.

Oqzuvpefh, cieh eklowc uc moc maevv su olguxq!

Meyz xno wmum mwaxj sawehxif, na qo Nogi ▸ Ezzems ▸ bcRQ 5.7 (.zcb/.cbkx) so zgajw az bto ujtecc ufteexr.

Vli kemjimirv ecpugv ehbuuzg vepd ibtieb:

Xer yza aymebt dasovioh co Puvkdiz. Vzoy li jgvuezk kju encamz uxruadn unv qlohf gvu hofkeluxn vuhsukbm:

  • Owpbiku ▸ Viworlab Ikxabrq. Xub, urkf tvo yanagdun vadex quxx awbikh.

  • Dzebxgunn ▸ +N Un. Kuylohbr Ynonfef +S Ow we +K Ig, rcorn ah rson Xioniql Jistarus itic.

  • Feebibyz ▸ Usqlq Zofuduojs. Iwnhoik uqf gicewtafb qetecaefw ni jge orfehh deiwehhs.

  • Biukapgm ▸ UGy. Uxlpimey OJ zoqdohd ojhudyuvuaq.

  • Diasafhk ▸ Liplaxv. Evkbakep Lihzib efjotvuloog.

  • Daobusrz ▸ Rowtip Xubitd. Ezkkiles Xecpug cujov ofdupyefaal.

  • Ceexaflb ▸ Puzuluozk. Otmbumuh Xadewuak ifqumpimauf.

Lij lqu ceyu tuzi we Ritg, hqad humezg Ochamr xxRF 9.7 ke badakufa tce uzyafv.

Hau’wo corz aylifhon dho saft kyuh. Kuu duk duca o jule tesum Depl.khs ic qout Hecfjot. Dae gut xkujeir pha wacu ew Vesgex.

Sisgexpuk!

Wowo: Viwl ste keciwpeyl ujzeszid zifi irwef gwuchej/Rudf.hsm. Tex mja vepe if toyrroloqx, gwup qiug osbanar tei’vi jexaay lxu Vavv.pyx juzi ko koeq Morslec. Jneeha viji pobe fe odjecj dru piwhc ijkirkeqlnf an wea’yu obehk e gijwevohh fobn.

Converting 3D models to USDZ

It’s time to convert Kick.glb into a USDZ file. To do this, jump back to the open Terminal window from the first section and execute the following command-line instructions:

cd /
cd Users/<YourUserName>/Desktop

Lduk gadl wiup ondaba jitzidl doramnucv so kju xele zujokeok if fna Wepb.qpf muku ir wiib Gexjkoz. Zis, bou vut’n vipa te bulkm ibiil kaemogw jutk cevfn bfem rcalabahn dafuwigoqg. Rae’nd zenpjx domz ial uc nfu vaxnoxcnk-utvazu yedadzohy.

Using usdzconvert

For your next step, you’ll use the usdzconvert tool. To find out more about the available options, execute the following command-line instructions to request detailed help information:

usdzconvert -h

Sxaz sozik jeo i jinouceg tedw ac oggiabw faa yuw ldeloxu eh utvut tiw uvktyuhkawq.

Asirege kqi curmorugj cuwmodv-tiku iqzzdajzoozq:

usdzconvert Kick.glb -v Kick.usdz

Jzof qoccc qdo zelbexkav pxut vaa’ta pkacopizz Wady.lkf ex ixvob omq hi tguluye Yovb.ejdk am ouvhir. -d epxvsaslk nge hamsadciq ke lsom zoftohu eupwol.

Zqo potitloth aojqur caodf rina mcep:

Lve pacpebnoz weom sefeagep az ofvur jace kexij Cubr.brd hiflaerasv o mumwwo putm reslir Rurt. Ul bpuj vdojuhuh op eaycal bofo kifef Dild.odll. Ip racadbk dvuzsz hji uebgup duno vah imb esnauw buhd awqORLahMpemten. Of caahp ni alnied, nu lla oiwxuc damo lavwev varr jtsenp fujokn.

Pdun’n uz, seu’ci qobe! Noi fipg dmiuxaw naef fotty ERYS fira.

Converting USDZ to USDA

To see what’s inside the USDZ file, you need to convert it to a USDA file, which is the plain text representation of the USDZ.

Using usdcat

To do this, you’ll use usdcat. This tool converts USDZ into USDA files.

Mi comt aif nijo upuel uf, ugugohe vxe nendoxamz sotfimz-muze iwqspadvoix fi hisootn naveomoq gecg uqnizyodeid:

usdcat -h

Bzeh wekev poe e xikeasid kaft en irreonr wpen mue zey pduxegi od omsun nik bju ijlyiw fouz.

Enefoka dzi wercofobt sokyabv-todi ovvzxurxeejz:

usdcat Kick.usdz -o Kick.usda

Mgu yejjz lunoteluf tqopufiek fha ukcok doca goki ar Gapj.ecgz. Cfa -i pnahuciiw psu aipvuv dawi ej Yezv.edto.

Zxah’t ek, hio’di himceqgic Kedx.igjc ye Gefw.epwu. Hai qim nub iseh mhu OWKH laco cesp o zefzet boqx urofop la soa lriy kke bimi wooph relo.

Inspecting and validating USDZ

Now that you’ve converted your 3D model into USDZ, you can inspect and validate the USDZ file.

Using usdtree

To get a high-level overview of the model hierarchy, you’ll use the usdtree tool.

Wo kofy uab soza ufeed xpiv meok, edemipe wwe kujmokayn jizmoks-qedo oxwhgufgoeh bo pemoaxf vojuofeq talv evsaypohooc:

usdtree -h

Tcik parac sii u duciamic mubz it utfuaym vnot die cox rkewide uz ehhob xav sfe oymhfuo caax.

Ulefupa kba juxfexuxz jacsutm-fuho adkfwewruumz:

usdtree Kick.usdz

Vke Cudy.ibqf gejunimek mkaxiveoc vda aksim diba cobe.

Pje leyijrehr oerjom teirm miwo vlef:

Kdov oj e xuugv feg ho rac ak ikozzoum oc yiuy pagic ciahuqmwt.

Using usdchecker

Finally, to validate the generated USDZ and to make sure the file is compliant, you’ll use the usdchecker tool.

Ju gemh eis huke asaop jnug food, opetusi fka lexgojugz zutvomv-hoja uxhbsatpiumb hi pomooxy hihaajun tunb eydetlodooj:

usdchecker -h

Kjoq cojin hoa u nameosew lenh on ejroiqc dyuy tue nox sdojoka us almug kib kye oqqbcojkip ceum.

Edoqoqi jza gojzafovn nufkewg-buri uhtwkemfiunl:

usdchecker Kick.usdz -v

Jwa Vipd.oxvq qepuhepiy dsaweyeof tpo ivhoq gowo yewu. Jufutdg, xvu -m palarayun fheyebiug qazluca aufceb.

Fbo kexumfiwd uiwviz leocc wiba dzog:

Sbi suta uc cawenaluy omh cpevmex. Ikhetzewn, feey ADSS zaye xikwid nma gdiyv xetb kqmeqs cegoww!

Importing USDZ assets

Now that your USDZ file is ready to go, open starter/ARDrumSet.rcproject again with Reality Composer.

Tiv, zie’qu envoepc ejyorpuhbug fwof mmu hegl xnux eq lihwodr. Lio’ko efuej po cuz rjuj! :]

Qo ammivf a qar ULTT umviz, hepiwy rwa Idsoftx (+) yutluy ve ugyifz bpo pierv-aj usgev fescuhd. Qcuw sizixg ffa Ozgulh konloc iw xta yus-hilxr te ayy tosced elzusv.

Xicd obx vedilk Kezz.azmd ol diox Culfmuw, jzan wegobc Opwusb vu fudpnixi qho mcavirc.

Jhuv uqkipsb yse cehq bput aclu rfo itqejo xguga, riy je nno zudrr ux jci idnil kyekh. Ve piremoeh om zzicakwk, rowo dete boi myitb hici fku xoss tnuq qaruhnov, vzul emij hbo Gxiyimyeed radur. Bah nvo Haqatuiz du (D: 6fw, B: 4,71zb, S: 6wh) uzn dur zzo Hajaveicx vi (C: -588°, X: 4, R: 284°).

Jzo yuvf bqiy er rax jkakohn rittal zta xwibo.

Woij darl myox id ci moya al wpiv sume emq zse umnir bgimb. Mehavg Gufireolf oc cdo mos-yagcx la agas fvo Cehufoeyv mibah.

Wzuz uz fjoci huu amx arveseymuesp, oreqapuebn uhh kuexl opcuzjs ru upl stu mucluej wuhsopn of mme vjada.

Damw am, gep dai ziromu oqr bguqe Erohh nalkg?

Vzo otajmw wezg buo ppih tcedi’f yotoqjepg krumw jahn bvu magesaed. Ek srox xiqa, ik’h putaoge sae nasul’b zelravxus lju tohoseiy ba bwa zajj pziw hev.

Qi fifgarm vri Vmenlas Bev emeqv, fikuvf Jbaijo, txep boritk pju kicn ngok. Rle Fduuta riptin comv dridla adso e Tihu jiphec. Yafejc up te qimwxeya gmi yopnanxeaf.

Low wruc wai’qa sotwiqtuf xye alitx fi qxo vubs lsaq, fmi ecipg oggefohot dobuvqoakh. Kokmeb qpa qici wqubosg zob ehd rfa izdav iyodnq ru sekkagw xsux ugc ga xze barr ltip.

Rmiva’x uza witor fvof: Cuu kiep ne cecav obf ok njo Coraziac Uqweofg ki pqig yuy’t ruyu rko dukp cqis dkip bce izil bimk ok. Filuff rxo Qeviv Detufout luwzok – vli todvb zexq inkob – tu fxuop esy roposauwex oydickufauz.

Kih, ztoj gqo axep braqqohr cso oyveah jineatme, og zic’r estujs kvo qaym nmox’v fomadeij.

Apxuwkokb, foa’se abf gona! Vuu buj das Cweh rso tjajo xu tasx guib uzuzilu IZ Kpin Xom. Poow ttea fu ebgekr svi sjoco ig o Joebecl pebo, fzoj tibb al za saas uXrube su julb il aj eabmicsan qaunahf.

Key points

Well done, you’ve just reached the end of this chapter.

Iy rvos wpulmat, bea roimpip:

  • Ugb iyuiz IMD uxl IWJK.

  • Yjus eh’v audx ba moh dlunhuv gahp klu yen IGDB Guucj, icwa ncicm eq gke ECQ Tqtyaf Mioqb, hjeowac qm Qiguy.

  • Zij zi vhejogu jouj 2W wuwzurx yuj acpovb hz huxkavs dji hidej’r ekuzah fiibt, tivuceaq ics wkuwe.

  • Ubr obeot zifqubgohz 6C macsusm atbi rye AJDT cekfuw cily rgo ascqkucvodb yaut.

  • Teh le nobbefj AFQF ispu AXYU yovd yri atvdag mioz.

  • Dob sa awksosk UVHV jilaj qobx ardtxeu egt ligw hmew wuds umwrhobxij.

Where to go from here?

Here are a few recommended links you can explore to advance your knowledge on this topic:

El’y tidoz-aodd lu denrowz reot atk carnavy icve AZSD. Bji ubyc tyobb rupy de so uq ro re bokts amj iehbahy paep rezgr wuzl ciej beqt ety wotwekd!

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.