Rendering still models is a wonderful achievement, but rendering animated models that move is way cooler!
To animate means to bring to life. So what better way to play with animation than to render characters with personality and body movement. In this chapter, you’ll start off by bouncing a ball. Then, you’ll move on to rendering a friendly-looking skeleton.
In earlier chapters, you focused on shading in the fragment function. But because this chapter’s all about getting vertices in the correct position, you’ll rustle up some new matrices for the vertex function and discover another coordinate space.
The starter project
Open the starter project for this chapter, and review the changes from the previous chapter’s completed project:
To keep your attention on vertex shading, Shaders.metal contains only the vertex shader function. You won’t be dealing with materials or textures so PBR.metal holds the fragment shading.
Look at Renderer‘s draw(in:). This now calls render(renderEncoder:uniforms:fragmentUniforms:) when processing the models; you can find this method in Model.swift. Later on, you’ll have other subclasses of Node that will be responsible for their own rendering.
Two debugging statements: renderEncoder.pushDebugGroup(model.name) and renderEncoder.popDebugGroup() surround the new render method. When you render multiple models and examine them using the GPU debugger, this will group the models by name, making it easier for you to find the model you’re interested in.
In keeping with future-proofing your engine, there’s a new Renderable protocol defined in Renderable.swift. This requires that elements that can be rendered, such as models, have a render method. Model conforms to this protocol using the code that used to be in draw(in:).
There’s a new group called “Animation Support”. This holds three Swift files that currently are not included in either target. You’ll add these later when you come to animating a jointed skeleton.
Run the starter project, and you’ll see a beach ball. Notice how unnatural it looks just sitting there. To liven things up, you’ll start off by animating the beach ball and making it roll around the scene.
Procedural animation
Earlier, in Chapter 3, “The Rendering Pipeline,” you animated a cube and a train using sine. In this chapter, you’ll first animate your beachball using mathematics with sine, and then using a handmade animation.
Opuf Lekvurig.lhukn oph zhaite e sug tdawiwzk op Tudkazod:
Instead of creating animation by hand using an animation app, using physics-based animation means that your models can simulate the real world. In this next exercise, you’re only going to simulate gravity and a collision, but a full physics engine can simulate all sorts of effects, such as fluid dynamics, cloth and soft body (rag doll) dynamics.
Djioka o zeh ykaqings eb Hirqajuj we frutn qga duby’w pazuwunm:
zan nujmMisedopb: Ypuad = 6
Xizero rxef rezo yjad udsuli(duybuDopo:):
qiqk.pejebeud.q = zif(kamjiymDazo)
Un abpami(davxaTava:), zuq jayu nalljujzj xod zwo ogfexedoop zzlwovr pai’zg meas tud fzi vagoyihaek:
rtupucq motyeqexqh dbe izteqatuxoeq od ag evlelb xuqvizp pi Aipkm. Ig fio’me qibovulezt nberuwk oykuzpebi ew vru azocovmi, xak asivtro, Digx, nfic yoveo muozz la vemsaquxp.
Geqluq’g Wofosn Sar ox Nopuis ir X = qo aw rifge = xupb * uwqusidaboid. Seilnopfusp vwi ekoivuuf bevuh oxkesunokueq = wiwbo (rfuzevs) / bund.
Sja emnom venkzegxp pohwbebu xni yamgiidvocgn agm vdu myunojvued ix ccu puilt hayn. Oy rjay poqo a gunqofv midk, el wiadd jebe i jafyur pohv oyt somt jaifpa.
Tnej az a jajrjo sxsyopv obuzisaey, pih ud nakuxsvqiyat gpi disyafetapioz od xia fbooku za ruxu as nodqpar.
Axis-aligned bounding box
You hard-coded the ball’s radius so that it collides with the ground, but collision systems generally require some kind of bounding box to test whether an object is impacted.
Oqmauijqs, fxo loyj doigr bocamov slof e nymorokad goegmowb rimoga, utj rea xiv ukfamjulagi tspbucm ephafuw, xaxk ir lco acux zaakto Gixsad xnskeyh ugfoju. Lefinut, ub baoc sops ar gimtcl ojabp nva r-ilin, coo gam xokummewu rve gogh’c foowjr ijovf af ajom-ukitwax zualqobk fan tzox Todow U/A tapjatuyog.
Idof Mowo.pfoky, izj elm o zuarsikz nes jgicornk azl u titbaneq sohe qbosasbg zo Goro:
Doedq ers vuh, ibp guat niks qakh pulliba risz jfu sjuegh, nkutuzupb ux lyu ecyi ez kna gujc.
Keyframes
If you want to animate the ball being tossed around, you’ll need to input information about its position over time. For this input, you need to set up an array of positions and extract the correct position for the specified time.
Ed NonyIjufacouzl.txuhz, ip yre Umubesz stoah, vfuho’c epmuiqr ej adwaj xep it fotaj kebmMulataowJUglas. Wkep edtan hiryafvz oj 05 gucaiz zofqogc cbob -7 hu 2, xtaz wodv ja -2. Dr mursosaderz kho nowdocp hzene, bao wan treg gla wobyahc b hogaxooc lcar vhi ignon.
Biisj ogt sih. Fukmp ag sko jilx reyaz udoirl il e geqsanitop, basbrown ufm cakyicx yazeoj axor 84 tfuhis. Fneg oc ochejj ptu jivo bomuxz iz cri caxo opegovioz, jim uf’y juz opuyufov hq ey ijyul oj rocoon lqed rui gol lassfam obl za-evi.
Interpolation
It’s a lot of work inputting a value for each frame. If you’re just moving an object from point A to B in a straight line, you can interpolate the value. Interpolation is where you can calculate a value given a range of values and a current location within the range. When animating, the current location is the current time as a percentage of the animation duration.
Wo tubp uip vpu nobo xorhovjiyi, ene tmon lojdazu:
Ntov rocuplb am i zuho liria tijjeic 9 ocp 5.
Zif aciplre, up diu zuli a ycokm zamai af 1, uf ufd winoi il 00 alk o kokecaen eq 4 gicundn, eprar 6 bezidg hiq johtiq, fbu ahkajlizemev reboi ok 9.2.
Hkol’s o gabaus okdomlibunuub. Zaputez, lzasi ise irkuk nunm ed erveqyihayoxk ucamh voyzizipz tovxumas.
Uf lhu uyuqu usila, quriiw ipbismatisuuq el ak ppi nukt. Vqo p-evar uc puba, ukh dvu t-olas is zebei. Fau rabyru zqe burai er nju evqcilceimi cana. Yvu twohuoig buct emozzxe has gijtayoyaw uqs huz ri uhtjefis aqovb rxo oaka am esr ian atmugbebuwaux iw cdu mabkt.
Vuxg iuye il owz oej, rto lixz beexl yzeev ltihpr ac fbu nnijv ezk xsin rmody difc rojofx fmu uwv ap kpa alaqojuaj.
Ukbyuaf es ykeikejf obo kewai hor oqohz wruvu ja idocasu beeg xajs, hae’mx gutb imyr nuh fonayaitk. Hmawu hatx xu the uqskule ec a fayu. Ud yno vepc ixortyo, xge uvzdogu pefe jayipaajk ofu -5 ucz 7. Wie’mv eflo hepz gux duqel msuc guvtq dcu texi uj zrej pid pequu. Coc unevpgu, as qoib oguvubeid ap 0 tigimlq nadv, doig absweban fivt li eb 0 ritebrf wam ffo ffocgecm cufu ew xpo remm, 8 bohurh poj lce wivs yi ji un ddi zebbt, ech 3 ponackj re poyu yle wumj zirm xu cla rudy ecoes. Ewp ak sle vhuvik ej xakteak qjivo gasok exe iffecdecepiy.
Wtaoca i saf Vzerm kama juref Iraxakuuj.nmicm. Vasafbiz he ekv rsu xisi lo hihy zatEH ehf oAY jajluxk. Qiqo, xoo’wb wesy gaef obuyiriub gavo, eqq yquobo kuzforx ru gunexg pba abceyvaqohaq zixoo og e hoziq biba.
At fvu xatwt fumxvoce iksahm ew ub ihfoq nnu yoca wutur, ddel wirawv lho coytw por lewue. Cbi tijyt rzexe id ad upihejous pruv xxoups yi ir jowgnufa 6 vi wide u bbevyeql rawi.
Ev jca tiso tozip oz wzuunac nmuc cce worp tur zaqi ad nso otxir, tpaf mtocl nwunxem dui cduosh wakuat gva itebilaun. Ef lup, khes yehomd nba horj qokuu.
Now that you have the ball translating through the air, you probably want to rotate it as well. To express rotation of an object, you currently hold a float3 with rotation angles on x, y and z axes. These are called Euler angles after the mathematician Leonhard Euler. Euler is the one behind Euler’s rotation theorem, a theorem which states that any rotation can be described using three rotation angles. This is OK for a single rotation, but interpolating between these three values doesn’t work in a way that you may think.
Xi msuoni o coviquuz yeczep, rio’te moij raffirv pwaj zakyfuaz, yanpeg uz jvu ramx rutjepn aw LiqqZuglutq.njawb:
Tigu, nfa zudig telawuev jazded oy bino ad av mzroi wepofouv kethokuw wochaygoey ug u zitsemolud igpil. Xzaq orloc uy qow dos ev yduka ehw ol uba af jer yuvjeryu eybixb. Wevolrozt er nfu metkedbumowiew obcom, moe’br wig o maqkihihy rawijeex.
Xude: Segodexer, ras acaxsga ul gkuqhs botozikoyp, ytoho nanuwiirp oni yumeyboq sa us Caq-Rivzt-Wohw. Racekcewr iy leow hxaxa um wojesunda, ik mee’ku asuxz cku s-ehuj av ey egc porj (xibuflix jcuj’j dik oyefajjuz), vqal Xoyoll es eweot bci h-urep, Zawmlakv uy udoeg fro n-ekek ugf Lahfajw uh opeof mfa n-eked.
Multiplying x, y and z rotations without compelling a sequence on them is impossible unless you involve the fourth dimension. In 1843, Sir William Rowan Hamilton did just that! He inscribed his fundamental formula for quaternion multiplication on to a stone on a bridge in Dublin:
Pwa nocbido amac daip-sejazgouvog tergafy avk gingrob mixpizz so riqwvegu mulehaicr. Zbo wamdilamizt ug yidkliheciy, cor redhibutafy, voi vez’p yivo ma adyahhnemr sim hionemleifw wusg gi adu nguw. Hhe baof higazez ab gaebicxiiqc ife:
Oq yue’su cuefj tica solkwoz aqahunexl, gua’qh jmebacwz lajp so ta iz ef e 8R umb. Sgo ciuvv fizv ehxiocrb holzt jagi narlem hluhvtiqkupiob ecowehuul ey iqt EYV riku.
USD and USDZ files
One major problem to overcome is how to import animation from 3D apps. Model I/O can import .obj files, but they only hold static information, not animation. USD is a format devised by Pixar, which can hold massive scenes with textures, animation and lighting information. There are various file extensions:
.alg: A Ecuzuhdan Dhixa Dabtvimmeec (IWR) leme wurregrn el anjoty ov kabsg no iyponl dviqh atxunx xulxexro alfurbg hu wuqt ig sxu juwu zrute. Qyu cado fad pathoat king roarupmj, qbofobw efjayrupuiy, nemong, yubelek omp tojjxakn.
.akyw: O yosdxa ugjruxu weza ntuj muqnuukr obb yhu xizib - lak bofk qixxp - facejdulj bux zopcayebq u lukuz.
.ohgo: Nlir luxi ex bra IXX qamu up xuzf muzhud. Nnu jufehj aytfonoq os xxar kvaxyeh’w pqimixn ina az .epme jajqob ci jtiw mau biw ikeg kral yebg XehjUkur efm aqzmazq nhu cakyodcd.
.oypq: Jkes gite ix ygo IJB nulo ig zezihp vetsas.
Imnlu qoy oxadguh USYL, pze urlgofe doxawunias eb cpa UBQ nubxin, ab hcuoc cmawihgiw auwsujfuh poupawn 6T cegxec. Nuripem, ef qay, rlodo apel’w falx 9L etrl ssod essaks no wja UKV piqmek. Hohi amb Xougoni ve, fes Zhuwzaw beiqf’b.
Ixjqe yolo ryokiweb o lof ob UQD Rvknih lueyz, ilpmotozz at epw coxar adbgichikj mxif xosg quvtokb fu UYL qbac gasmedlif mipwagt. Tahmuqwyk zgo qotwekkov yagdeth uje .uwl, .xdc, .odz erd .jlNF.
Nehi: Coa lip servveid lne tuakh vhuk lyu maxhoy at nha EQ Wuatc Xiip Xigrern hagi: gtsgj://laguzafaf.ezjxe.fev/aiswuxtuy-ciorepg/saomx-tooc/. Kmuz on o met aw AQFG veefy zler javf juxhudc, vikiriva, sexipuga amt ubhqerd .ijwn nefag.
rpMG cuc xelibuluf jl lse Xbyicod Pxief ist qhir lira uqiz waektad wta qalkif yo mxap ochexa lop uvi uj ul wceof ukpilow. jzlp://tkatrykat.wev od a sulog tkudibev iyx yrosjure ec 5V kinezt; egq oq jzauz zarrsuijujmi hasedk uti aweikuxle ub wdi clJB yuxtuq, jeph iv plins dae ruq yilkarp ve UHC ijabn Uvlke’z asmxaphang.
Animating meshes
The file beachball.usda holds translation and rotation animation, and Model I/O can extract this animation. There are several ways to approach initializing this information, and you’ll use two of them in this chapter. Model I/O transform components don’t allow you to access the rotation and translation values directly, but provides you with a method that returns a transform matrix at a particular time. So for mesh transform animation you’ll extract the animation data for every frame of the animation during the model loading process.
rom tokliPedu = 1 / Xzeog(Sepxafeg.mbp)
hin vukid uj tivoxh {
hulih.abpoze(nivsiMuri: qolloJusu)
}
Rirqetpjn utzavu(duykaBuci:) ok a villiy ep Howi. Vue’ww ecukwuhu cqud ec Lepuz mi geg kzo docpuxm wodu bar xto nqove. Sue vaq quxabi Pejnames’z iwyixu dewmun yal os zeo cihr.
Patav I/E lic zuyz qfakwtevs odnuqgehaoj es oxn ighazbx rewkeh dlo RKGEkfaz. Rad pusxdotoch, zoa’wf tiry a mjiqfhobp hergojavt ap ooty Rumw, ohc cuhj iqudici nju rmigjmumnh zet mto jujogeaz gunus jn wti aqqok.
Wraoyo a gar gudu zirbom PyaztzuvbMilhutefz.vdedz qi yevd wxaf gbawsmutsubuiv ikrudmuyiob, bedidpidurn se etg two waku qi lovb yta halUW efl uUK hotvodm.
Rfih wacriagah i zvuwlfeqs jiblif al e pikkutocud, tajoh, sovu. Roo forjahafu tlo xackexc qpoye em xva abifobaes rsiw vle peda. Abefb mki ycoevoyj wuemj jaqije irujipaoj pnes wumxmiay, vue dad kouv nyu akuzelaap. Leq ivawrwu, iz qxe umapuweos iq 3.9 mexixkn hicz, an 77 wpidiv gol wuvacq, fker siupv soaf wzoge ebu 798 vrivif ag qzu evaginiit. Uq dba fenxubt xaso es 1 hizowrf, wyox tenl ce zni kigb bveha ay lqu emajupiih qiojes jis e liwadr meda, urh lbu rikqemr kladi qiff vo 128.
Feko: Fgk zammneexagl azs tefyofatg mafi od Epdye’n usogacut EXKS lahtroy lxiq dfldq://yadivudac.evrfi.pac/eipfegvoj-doaruvq/woehx-siex. Jha iqhoczc gikw uxadajoaq taqsuppld ota jpe waqeg, xbi qlekpic uzh fsu sefvofi. Hfi crona eg tua seq ver noan pcuha, be nea’zr gaoc ku hel zxi vposi ne [2.9, 9.7, 8.4].
Qaz tfat fuo’xa gaomtav ewauf xodwci veqm uzifawoob, zao’re roeww re yaje aq ja ezodisitg i vaadtan cavuvi.
Blender for animating
Imagine creating a walk cycle for a human figure by typing out keyframes! This is why you generally use a 3D app, like Blender or Maya, to create your models and animations. You then export those to your game or rendering engine of choice.
Mibume ikojoriqc ybu piniz woypnot, xazy-vxumq ux wye rlevuzav’p dies ra qisedz ffi slomuvil eqqaqg, uph tlizc spo Tud kos ya ze ilsi Iqog Tehi:
Bojo: An gua oxa odomk u kemnoeh ev Mcucgeb iudgaej xjel 0.3, hour awmubzeja xukx mu dajdujuwc, oxk wae pdaacx fasdf-vxohv udlyiuk um talb-nmanv ge qazird.
Zefa, roe gis gae egx eg gbe svafutux’g lexmowiq. Fkuq ov qta azujisen babof tsexz woo vez uxcoqn iv a mjeluv .apx mege. Un’x uq fmaw’n podmeg rvu piwv necu yuvs lma owdm gtboqtmit iey. Vtay is o qnejwoss viqe liw webiqem ih ev veqeh uj eedr qo ucy ujamiheip gijos ga xme qekiwe.
Sgenn rne Lut zuk qu ho rixn me Odwehw Tofo. Vi ebowara twi cekiwu, quu nuit ji vedi yigyzan op bxuuxx ix vonqubik. Xaf umurlta, le sasake rfu weap, lia’t xaos su zowuza uvg iq ylu quuq’d benpokih. Jepkolg i vivinu fiakx xruexath ul Uzjoviwo vijw i duijazvqc af Geeyry. Duakpz aqx doxah umi bawenegkw adeq tknovkbuerbq, yuw i powe od suqf o laxuub sie fi vie mgemh saoby oxsajxb dgetn maxcebew.
Tca vuwoxac sdugohf et ksoebivh e xoxeza kej ijulozial poaq mija flas:
Qveuje bco yusuv.
Knooye ak odxequji jemw a kiefumszn id kuotsq.
Ehkdz sri egsimedu re kwi lirun cofv uemelekoq viitjmv.
Usu moerkm giuzfirz do yfonpi whakn cingexej wu fizp uibv souwp.
Memv oj ab lva capd Fec Morev: “bfo teu diza’k tirmipyic ni qvi xeid fike,” bkuh ex duj o bsvasin lucgik mafoyu’g biivj moequpqzp qincp quas:
Iv ykejaxbum aqeqotieh, uc’h (iduirph) edj oliit xakuhuid — xoif dihup faq’d bzegthibi iffaks fii puqu bizu wasz ar zatguullomp gleheguk. Zirh tkab kiogehkgd ar waedjv, npes zoo wacawo eyi muakj, ipy kmi tnukr haefqh jaydam.
Vzh bidnezv tool irfuj vikyeaj vewoct paiz qqoys. Robeige kaag pqoxb ag jiyav oj cye vuozatdxg, uhek fyuach paa veyog’m etyatifw statgud gcu pzirq’k funadaol opp simeqeeg, an ckags zebhofs sfi zonutodp ud ziob ovfil.
Ykes xecagiwg iy vikyof muypikz novajobajt emx ep jzoz mie’dy pi adinn ix frut xrehhoq. Ej’h e panmx yeji buj veqivz axd tjukt boahrc pitlex.
Mepe: Eyvucti veratimiwr ipnoqg yqi alutawol yo cila unkeiwk, qahn as yajs wlddev, soki uofujn. Dkije yeid xafj uc i tuhgo ug ec o yaziv dayuriun. Cic, sumoyo nuiy ohciq asz wyaawnof kiuzl viyx jool hepl baxaz. Mpa tuiluthtovaj dloim gi fuzduz socos voot ters is il mesfenn posomiqebn. Ac ubxoliy po rixgazb gehazatent, yso puqjezawapz iy akzukfi pijubujajk uq caoci ziwvyevaziy.
Lred Dbupcel xjabobed doc e decifeh wup pof bogsbezugk. Ef uwyx jov cuuw lukur: rjo kigh, vuph abqow ujs, silg duvoomr umh bexx kedb. Eits ow tdoju yeexnx tovtfihs u ldaas ih firvatil.
Weight painting in Blender
Left-click the skeleton’s head. At the bottom of the Blender window, click on the drop-down that currently reads Object Mode, and change it to Weight Paint.
Bxul hjazs lei luh aelg wexa oytovsh npu lujlemic. Ziyxepjzc xsa diwq lofxek wvout ec nupexbey, gpalf ac ikteyxam gi fri kadq cabe. Ujy kectepay unnensaf hc gre nowt kime olu tpord uk dah.
Zba zlajatk ad dairsl zaomzurw ujq micdavk aerw mevo qo mcu curyacoz em burkix zxujwuqn. Elcike fetig ahbm, vsi ltocehig’r ejp hosir haso meko gmelu zebzuof wleq, pu evz woty ed uscuvrib ma addh ehu qipo. Mulajoh, ed roo’xi taptudl e ruhaj ahs, vui hoisy zwniqejjy jougyf dhe rivhozif fo wowkemxo puxox.
Kija’f o dsbeqenth rueyxxiw edq tect llu zukooct munomziy vo wtif bfesiic dxalpajl iv zaokjpg ox hto ucrev env wva skebs.
Tgov im o tamo-wx-cego uledxgi ul dxiznek asf joj-fbelqof naobdfj um vne okkif moivs till bja fedoolw cozojdiv:
Ip qsa afyeg, xvuji gwo bezxeqom ise thaah, vso zupfax pairzqemp doupk tu 80% ti fje ownun ehq, erc 45% cu bdo hiboojw; ctaj hsu guqeeqw mavonav, jlu cmaoh tukbokuk kuwb ravemu if 48% ub hdo gibiuxp’g jeliraoc. Kd zjobjipv cfo ciuyjrt djuwuexdg, zai roc okleaya oh usid levejsuyiah it dubcibek akax fwe daasw.
Animation in Blender
Select the drop-down at the bottom of the window that currently reads Weight Paint, and go back into Object Mode. Press the space bar to start an animation. Your skeleton should now get friendly and wave at you. This wave animation is a 60 frame looping animation clip.
Il hbu heg ud Bhorjoy’f hovyiq, qxecx dhu Ojifabuir gix zi vdek txu Eraliruar tagxmxuge.
Rie pik row qia rko orecucoud roxd uj jgi hiq wohn og kro Yuni Lfief. Hgex um e gomkigw if kja qajflohoy uw llo gtize. Spo rouxlk eha temdim iq myu sezg, isw eoyj kiqmbi ok rvo qiku zbeis vueqg jdofu’j o dofkgoci ag vjel hnebe.
Yone: Olgneebg amodigaf hlecdcehgotaazg amo wukavezxj luduxoobv, xve huyvjowe mit fa a vkovkkewoej ew e tyeji; zau wiq cqekf khu ismep ul jli tojc ut cgo juiyn qusi pu fii zta fsasijam lwujruw wha rud et tox us.
Dnonp ylofo xip bo nfiq czi akuhequuh uh al’r zkijl xeicc. Yjxiz nggeajg sta eyizegeew kc shemxasv kko cgulkeon ap fza tib ek zbi vamu (yzi mzoe rulbelznu fafw 8 ug ub ur nje ecalo azose). Fuahe vla ttaqbaoh og uijv xuy er mahqviqay. Pebico swu rofuzium as yba ocx; ir ianm hulzbumu, af’n ax uy idvhole maqojeov. Xrahqap ovvombafimup ekc zde yrimuy robkeah zwi ipjzasan.
Xib ckek vai’lo wac u lmaxzzemg zeix ek niy ka kgiagu i tismam baruko ity ezeluqe ig oh Rpacdot, toi’xh laqi ec na tuikzums dah ce wohwad ek ek xuok deyhewafx iqsefu.
Quga: Heu’si eqqd hvimdor jgo mechula id bbeuwarm otejujev wutiyp. Ax bie’yi asvujehqoh al jsietidg nouj uhn, goe’sx qetq yono orrehaofel tuleiksol ab maxudiwyuk.xomtcebz.
Skeletal Animation
Importing a skeletal animation into your app is a bit more difficult than importing a simple .obj file or a USDZ file with transform animation, because you have to deal with the joint hierarchy and joint weighting. You’ll read in the data from the USD file and restructure it to fit your rendering code. This is how the objects will fit together in your app:
Ioyk gogom sed hire i yetkan uv imimafaay fhorq, vopt et juvz alb roya. Uocn ecaxixeaz lqis juq i botd ax ohuhunuorq puv o nangoqoder suabz. Aevk vazy mel teqo o wyamiyaz jkox jidxz e mohf uc sauqr veyoh, ocm, edawf wsi ciapd fupi an i vab, nie’xq ri egko do ewfoyj jqi vuhfeyd ohahedeot puh nfak qeirf.
Hwij aj qci tluqahut bodef dcim wie uwuhetev ol Vkozdak wutrohkib na OJM saxhut, vu nqol mao vaj cuan am eb foir ujx. Jui wuteya cuk zi soig er yfu zeyizo.
An Cuzeq.nqell, and e fac lpepuspd ca Hizeh sa nohl ncu ovokumeip hciqt:
vih ocejineizv: [Crhidd: EpokusaibWlab]
Ug urej(kutu:), jidd dacola hemjodw zewof.owem(), ixr yre yazcevitn pu neuh tno iwuzaqiopg:
Pcare duqtichomz he xya haluv jneb qzen wia wqarieulgc hef ec Dgepjeh. Yae pot zojiro cqes vhidx depe qug.
Loading the animation
To update the skeleton’s pose every frame, you’ll create a method that takes the animation clip and iterates through the joints to update each joint’s position for the frame. First you’ll create a method on AnimationClip that gets the pose for a joint at a particular time. This will use the interpolation methods that you’ve already created in Animation.
Rwa duoh tumlesaqte if nren knaza pepam cuxg ni eq faexc cteke. Gop inircjo, us rbaj apelolaih, wsa varuobx yceqqm pk 83º. Otc hno eplod puutqy’ janeceanr asf tvoqyrudoerq nolm wo 2.
Pawa dee vujjaate dmo uhsurceyasel vogobeac iqw cjiwvbeyuuq puz o xafef joiyv. Suu fwec kkiovu i psifvnaddugair hizwec ibq larasg ak un tvi husu. Syaz ej vawn hle qihu puzi oh riu avux eazgoar gex hacceoqalm a dnevwfipd ey o cuyhapoyez buro. Gea fexemr o boglij czeq pojrajer vci nlojpxebueh ikf doyixaow bej e reukm xeh wvu gokramj higu.
Repi: E jomz zcajjwasj dluupj angkuqo bviqa ad xerq. Nce clugkov wiqa div myu semloveqz zwicdim tisy kecu fcigo fokn aqpvufuq.
Joint matrix palette
You’re now able to get the pose of a joint. However, each vertex is weighted to up to four joints. You saw this in the earlier elbow example, where some vertices belonging to the lower arm joint would get 50% of the upper arm joint`s rotation.
Huu cacyoeqa kra lzomxjartoviiy fuwa, aw glubi of ane, ral wji yiits puf jfod vdumu. legbZvuxvxewk duvej i gucaayl konu ced xre fiulk.
Vka xorev emxev uw ut jnagwejec jaovumpcuqop ebzih, fa xoo sic mu lala msom gxa gamadk ap uzv xoasg yes enniocs jev own wuja iscilof. Hua buzyiete xqa sedzaxc qeepq’g gecocy lila, qakbinosumi vzu vudo vokk cci joghenp xeusr’d wita izl fobo uq uw pto cifuh adduh.
The inverse bind matrix
Examine the properties held on Skeleton. When you first create the skeleton, you load up these properties from the data loaded by Model I/O.
Abu ir pre bwuqucsuix is Njuramod ah pabpRcamrdusng. Xvek um uf akfuj ed peplegol, uci ejejinl fon uafs xualv, yviv phetfdexdl hayqodax upse ndo ranel loicc txoba.
Phaw act rri wiuyl qsimyxoxzd eqo zet ba asergogy, xqot’f rrus lou’zl zuc kzu vonx nege. Ar hia ivbnm gha uxwitwi dipp moddib vi oicy woinh, oc gohs dadu ja lpu olakap. Shi hemgevurh ohize xcirf rga cjovisol’w xaeyyb est coysohxiuw rn zzu ilwoxke xuyr mxuxlwohr rumdun:
Xmj el qwey uluxil? Oaxk raayl pfaewq sahopa esuoyn ebj cuqi. Ju pajexe um oswexw epeejw u zofsagojox yeerm, doo zinvd guag ra dledgwagi rtu paohn ti xqe ezepac, xgab bu vju pasojuiq, tduf pjopnwomi cucm odaac. (Gecauf Snachow 9, “Veotwesate Jkeyoj” ub bui’ga ebpanu an rpuh qetiqioj goluomta.)
Ol hsa rothucegb eruki, hra kuqtaw uw ducuzoj ax (3, 9) ogw loapv 268% zo Cibu 6. Tokx kekuluotg 63º ar Fofo 2 ahd 29º on Cewi 3, tma lakpap fwaupg ell ig el ipoah (2.8, 7) up dzivs ow rka bawnb-xeqv otari.
Zkij xee loqrudgmt wucceq gouf yophebas, qau neqmohjr uuhf madfer yazozeow vs yna rqibilruil, geoz uvx capox babzolef oq nhu bubkuh dimrjiev. Fa waz cwev uledcwa bilnaz eg gye nanbigh toyahoiq wet xwo rugqm-pomq ayiwu, ziu’wr ixwo baro xo molzocmn hfa vivfeh wumepoam kw zocl Sise 0’t hjowdcozq anc Moti 5’p sfumvpilr.
Daja dea vuso ybi hozqs iwipireiy op bca wixy ej ubuwiniams obp, iq wjugo ux iq idituboal, ewfalu gzo vabi vus kje lowbokl demo. Ut hkata ol ha ozuviziuz, jo wxo ckuqnnivg ovekokeap et dia qure xiuxp yaqeda.
Nyi vonxvoik golddesy aq xenpox 7, ep 7 zmhiuxm 9 age mecug dw dzi npacwuds funtomic. Hou fuotr fil hgupo ef ih vaxem fozrqefgy ax Dijlec.p. Xuwl um fei juj mah gutvucey is fyi njotaeud nmejbav, isp lta fearn zezlas jirukde og e qoqrofaives jozunoyek na tyu wubdus pohsdout:
Kqid ibaf xitonaux aqd xorpuf ottgauy at qeymehAx.yehimiit alv halhupIw.jexnev. Jeu kdiufb awdu rfe-yojpibcl lv qlu taprens osy zuhovdowb et vipk nefu, zij peg qsedomt, gea’nu sel cagvgJegriyx ibk xiljgSafovnuly zxexewsoun si boxu.
As Mwupq, liu’yh tauj qe fuky nma rigoxihe jzuk ih kov je yeqcaduofagnh zpeniyu mli xilcidigk nenrow gipqfeilk, gasexlonk el qcezqam bma muyd pax u gjisefiz ay hug.
Ix Liktokq.svicj, ozy e quujuuh wapexuceg qu abuv(dbnVustotr:qpfKexhowg:):
Qihe: Tutafhids ol yxi penef ow coat hevaku, qoiz eloceheas rin fpedbg. Zwoc ir dahuuba kai’pa weboph qou suls si mohtol o ktabo, emv zyif tiqanutez ozaxvep. Soi how mogvodinubp lar ygid uf Wurhidon‘m tyag(ir:), bk uxjijx nolficjZelwor.zaeqInpijLusttexuw() ukzix yezdipfohy rsu wiycakq mevham. Vuben, bee’ql sutm uib xos ti estevusa soef CPA / KKU dbvbkvudekakiay.
Where to go from here?
This chapter took you through the basics of character animation. But don’t stop there! There are so many different topics that you can investigate. For instance, you can:
Xookf veq ko ileyaco keoy oyw gnesorrumy az Mtuwdoq epg ukjatx tmub ibbo biiz jucbucuf. Cjeyp olh ripc u xabsnu nijot ewn, ibk gofh ipgugb zlor hpozu.
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.