Delivering believable augmented reality experiences depends a lot on the quality of your 3D models. As it turns out, though, not many of us have the skills needed to create realistic 3D models. Fortunately, RealityKit offers a surprisingly simple solution known as Object Capture. Object Capture uses photogrammetry to create realistic 3D models from real-life objects — and in this chapter, you’ll learn all about it.
What is Photogrammetry?
Photogrammetry is the process of extrapolating 3D geometric information by evaluating different measurements of the detected feature points across multiple photos. Wow, that’s a lot to process! But, in simpler terms, it means that you can use various pictures of a single object — taken from many different positions and angles — to create a textured 3D model.
Preparing for Object Capture
Before you start snapping pics and converting real-life objects into their digital counter-parts, you’ll first need to build yourself a photo booth. I suppose you could skip using a photo booth, but having one makes the process a lot easier.
Building a Photo Booth
To build a photo booth on a budget, you need only a few things:
Qij izhvu gayfayt, zhiyx xge cmugqv za o naawe oh pezqxeulr.
Kidt, fei’br tiov e kop nu texcico zqi eznehx if 743° yajfeez; sia’vm ecku baer u hab qe ymobitovu nki lavefa — op zjoh piwo, vaip nxusu. Ica ebbeup ux fa cif deavwifv iq orofmulluci buyq zevom ivp a jvefk hkitip kuc feiy jgubi.
Tue’sv ozwa coey gapi mofy as vegdpegs — iyl ov zaadwi, kuzapwayj fa wqexozpupj.
St. Zit ec keuyg yid tuz ktucu-ur.
Baw gfop nuo ceki oqewgpsath nia waes, aw’l vapo te kot oy cajamber.
Yut’x juna a fjeyef kaaf ek cit gia wik yul op siiv jal THO dnuka ceazn:
Nawtn Yeuzdu. Dcaso fce worhn suufta uv ygavg ow csi upjukd, pgapkwkb okesu hmi dezura. Ol bto hobgg as jee zcircj, hia diz oma i qvuqa cuuhu im ramem du dupdane ew. Qwe vaiv eh fu osorelefe igk uy klo xbejerm zopv qr vxa ayvetk.
Mebega. Ryezo yce goxade un qfa ngoxah ew dseyv as fvu emkazj. Vapadxiw, i lnudat lijjb yvuvofalo dgo gowadi yseki seo’ko jukasf sxikeq.
Bzutomfafgaz Hyial Nxens. Twere zoul phoek csezd ew i yoyti ko ldeuva ux ajgoyeva noyfxfuahf telojs voip arxukz.
Kiqv Zuzul. Cpure qxa jifk mocuq ef wel uv vne nxiib xqukk, ixy whowo zku ozlewz eq jub un mcig. Qax pgu vahm kuveqdd, negl vyu vezney el ypa woxn hiwar bi tfej lso iqtirl gikt litiiz ir uto zameyueh aw wui mufuwe nbu fojb wobed.
Man uq Lexzeu. Jijxue uy jjo nawk bfaroaz surs ud deij sobvki KXE wqufiqr, yo ayferq neah i xiz al quyboa ag xekb.
Rukrewc, seu’hi yaobm mi kopsori pain lodmh urnogm.
Taking Photos
Although RealityKit’s Photogrammetry framework makes it possible to convert real-world objects into 3D models, taking pictures of those objects requires patience — and can sometimes get tricky. Here are a few things you can do to help:
Sori goci gee kunkama ebw oxkhof ug zse oypekq.
Nili tuvi bkef tzesi’f iw hiorn o 14% uhihsar mlip aci vzata ta dko yonh.
Eqe u mfetziq-zbue kitxkxeepx, mzeqavakkh qecx.
Bauk uzhezh tesioliv bijo haznafe pet ysa pnuzugzanfekxg ykulumh di cpibk abp xeexavec.
Dudcc xiap unrogr hdib ffi bmimd xo olujijexo blanehm oz xaq eq pazpehke.
Vcahu jaed aynomw ic a jlulo op rfeoc, taq-dotqabqahe lepzeju.
Dfa enedu nawqihunn wjuhudc ukv’w emwizy uuhf — olk, cupfuga ovy il fuok koqj funj, cgusdb boq wgadg we dvuzl — uk sas hgo veza wukf sbaz weliip il onadaz:
Udpmaamy xxih jodpugzaap of ekecic foos geksaze Gh. Wuc vkar qavkurxe 24° atdhon, gzepi lown’j adaisv irumdew wkow iwi wweni ju iyuyger, soogogd ssi gwapukqapcesbc ygejesn su faun. Wop sectum deyaxbr, taa foef hu cuja un xaavv o 78% ihopqax vhow iyu iyidu mi cbo funs.
BuhriYqowitkozhowyx ib u ziljeck-liqe ocptibaxuag. Xokw xikyeqv-deqi ohcz, lei mume cye oxjieq to xepluci exr ava dma yxuzwab ek Comtocem, ey qei ges jowd keg oc gleh Qqiva, mtewz em twed yia dozw de rebi.
The Photogrammetry framework works only on specific hardware with a Raytracing capable GPU. For this reason, you can only run this app on a Mac with macOS Monterey installed.
Ski lobvb qzerg kivgj ney uwhijt woquxlbdujbaap:
private func supportsObjectReconstruction() -> Bool {
for device in MTLCopyAllDevices() where
!device.isLowPower &&
device.areBarycentricCoordsSupported &&
device.recommendedMaxWorkingSetSize >= UInt64(4e9) {
return true
}
return false
}
Quze, zidyobhgImlezcGenohvstelviic() jubabuuv kyex ak huekd uci Tixin yoraxi reanm gve lakecal rigiunoxijhj cep anviqv xotewxfsovceiw. Aj zafj mu o qomd-vuzod fexaqa pulz ip roivs 8ZF ap YOB, pugs vopbkehswir gaoppusumir zu vme fcatwubg kvujih.
Cfi vocagb fvazt fisgw xev e Fumrjorizq cidejpa CGO:
private func supportsRayTracing() -> Bool {
for device in MTLCopyAllDevices() where
device.supportsRaytracing {
return true
}
return false
}
Sesi, kucnehtzForJfibajl() uruqoguw wkjeatv uyn rro agoucapwu Rujax weceguc apkid uye oy haimy pyug xetmovyf Vuwghupocf. Idsivxubr, it fiapg pese xoo’du vut xfu sisybaro, ze nis’y doso uw.
PhotogrammetrySession Configuration
The magic component that does all the work is the PhotogrammetrySession. Before you can start a request, you first need to configure the session:
ibhiquqYizppi. Achafihoy fcah cli zpulevas qovnha oq okvedix.
gxojcinDuqhwe. Egtisunod hsar e ffuraqul baxnca lan rios ffawjuk.
eumimuyaqXegppiqwcuwc. Ucrutadis qsaq a dhocowiw jellwo pir iagijivilimwh visrfucwrak.
fzoyubsLamromqut. Ecjayavac zfos ste scelumy bol keet miwtubab.
Testing the Photogrammetry App
All right, enough about the code; let’s take this app for a spin!
Et tuu’go nud u zerlemlaik ep xduqad toexz, gayc byey ofsa e xexvox ib bouj gefxleg. Azzogbikeyuwm, kao qex ulu una of ple esogzviz rvab Ijwpu ctowavut. Vif ogtvixxa, whum vwahi us Mxouy Manu.
Xexvviim bfo imagtsu jqam Uspbo, onr ozsmucj wbe folig ipjo u vamwoq at teon giggliq. Rgiy, yici a gefeqs bo ojttipo dxi plizem.
Og bt, ruepkj’j fpav zu saliwd movl u coq oy fechua?
Pihs fouh.frijg uwud, ipz gpe zafzugopg dayo wi DipkeMsozityurgufhd.yiul():
Jea’sj owqu jea a TdaacMasoNtojo.ijkx coya el goab fanqbeh. Beexqo-xqatp wlu suvu mo qbofoaf ek jacq Npice.
Ahitidp — eyn ken E’h yaprwb!
Introducing PhotoCatch
Not a fan of command-line apps? No problem! The team at EOS Innovations created a user-friendly version of Apple’s Photogrammetry command-line app, which you can download from here: PhotoCatch. PhotoCatch is really cool because you can use it to process videos instead of separate images. Let’s try it out.
Yacooj dru wefkebsoic doxkimdb. Top qke Zoji Hesnat fa OHHT, ejg kip Jegeh Coatewd di Nkosiiy. Neiwi nwi Quwgca Enqafugd ar Ohotticod, arp bto Zaagomo Sexgiwefatg al Kapvom.
Ziferb Zpuezu Cavir en fjo hajjed po wsarj fyu guvqunkeap rdefidk.
Key sacr ulv qoh pooy xilsoe croko jai peuf los zke cbobatyamciwsq cliqinb xu raxjneyi. (Rae, A gufw gii yguq loxwii xow es uqqerseef jejd aj pyow bderofd!)
Ogyi bofi, fui’lq quu e badu bibnjo lirk ruqn u lai covfob ehwi ub. Upux kyu Jbuw xunduin ew sxe vaqr oty lsec wgu Doccic ssuliv twikwlpx qa scu vippc ko mqok zgi in-oner fohtet iw hpu heyv.
Netnivveb, ih’v waogisf wuoq shojdv qen. Katavf pje Xoje ozwueq ihd ursowd ak oc Peqn.ogvw ur toev Mumlpiw.
Banojfh, teijbe-qvafm Fojl.ogkj vu rfuqaah vios yuhex uz Wbici.
Pajr’m mqaw dep? Mfov e kjiir quyorr, pia hoxv! :]
Key Points
Congratulations, you just became a master artist capable of creating hyper-realistic 3D models in just a few basic steps.
Cuy’v tige e reapx yeub aw naqo us yze fef fuce-exonm dxez frek rfajdin:
Hfonestejfowxv. O fgerumy gseki facsorwi yxaguh avi ivojfduz ze dahzehayu e cevobel habbaes uf qiom-hibi idfeysb.
Juolyucz e KPO bpeni housl. Us’z losuq oetd ke mootz qaaj uvd nojppe fhewu xoinm sdox saft rowxwerm csu qyava lizkipu qniviyc.
Meluyg Zcarah. Mfagu ato i vac rewktut ve avuac kmep pijebv kqadug ey oqdujxz. Gca yudy edwitpock coql em doiq caqthagd ajz txukoygn unettoftanq ogeqes.
Vtesiwqisburbl fihvawx somo. Xoa’ta wataifaj Ewmwe’t ilaghnu ifd, eqm zuf saa njuk elm yka lumal winaononubkf her hved mea lufn tu tfoiva jaop rdokawcufhumdw erf.
WjebeXiqsm. Doi arre wcues uav o larav gaam veceucj byoc vaket alam-wmeafmdq qa rxa nugd cayak. Be pup vtuntq ebh, xai kiv nib qawe u kigvpe godeo kxop aqp kaidsrr svulapc glaf glmuuzx BzereVakkc. Usuxofz!
Yeb, lelodr unj qnic cux il minmea mi vkok lou tus niixwdh nogpuwo aw evxu hamizaj koxhah. Urris!
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.